-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add withKnownIssue comments to known Issues #1014
base: main
Are you sure you want to change the base?
Conversation
@swift-ci test |
### Motivation: The Comment passed to withKnownIssue() is currently only used when a known issue does not occur. When a known issue does occur, it is marked isKnown but does not contain any record of the withKnownIssue() comment, making it harder to understand why the issue was considered to be known, especially if there are multiple nested withKnownIssue() calls. ### Modifications: When an issue is marked "known" by a `withKnownIssue()` call, the recorded issue will now have multiple comments in its `comments` array: 1. The comment passed to `withKnownIssue()`, if any 2. The Issue's own comment(s) If the issue is recorded within multiple nested `withKnownIssue()` calls, only the comment of the innermost matching call is added to the Issue. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
cf99d11
to
c6cbd3d
Compare
@swift-ci test |
/// current task. | ||
/// | ||
/// If there is no call to `withKnownIssue()` executing on the current task, | ||
/// the value of this property is `nil`. | ||
@TaskLocal | ||
static var currentKnownIssueMatcher: KnownIssueMatcher? | ||
static var currentKnownIssueContext: KnownIssueContext? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task local could probably now be relocated to the new KnownIssueContext
type and be renamed current
.
precondition(!isKnown) | ||
isKnown = true | ||
if let comment { | ||
comments.insert(comment, at: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be useful and important for us to propagate the comment from withKnownIssue
(if any) to the issue in a way that allows distinguishing it from the issue's original comments (if it had any). If we don't, then clients who wish to display the issue might conflate the two categories of comments, which may be confusing to end users. We don't have a mechanism right now to distinguish the "original" comments from these, so I think it may be worthwhile to add a new field to Issue
to support this, and to generally contain any other relevant details about the issue having been marked as "known". (If we had such a property, the current isKnown
property could be derived from it.)
I'm not quite sure why this is inserting comment
into the array at index 0, but if the reason is so that clients could find it and assume the first comment was the known issue comment, that feels fragile.
Add withKnownIssue comments to known Issues
Motivation:
The Comment passed to withKnownIssue() is currently only used when a known issue does not occur. When a known issue does occur, it is marked isKnown but does not contain any record of the withKnownIssue() comment, making it harder to understand why the issue was considered to be known, especially if there are multiple nested withKnownIssue() calls.
Modifications:
When an issue is marked "known" by a
withKnownIssue()
call, the recorded issue will now have multiple comments in itscomments
array:withKnownIssue()
, if anyIf the issue is recorded within multiple nested
withKnownIssue()
calls, only the comment of the innermost matching call is added to the Issue.Checklist: