🍒 [6.4] Simplify and fix encoded event ordering issues with test repetitions#1803
Merged
harlanhaskins merged 1 commit intoJul 18, 2026
Merged
Conversation
harlanhaskins
requested review from
briancroom,
grynspan,
jerryjrchen and
stmontgomery
as code owners
July 17, 2026 22:29
stmontgomery
approved these changes
Jul 17, 2026
Base automatically changed from
harlan/expose-iteration-to-json-schema-6.4
to
release/6.4.x
July 18, 2026 00:07
…1793) This fixes an issue introduced with #1528 where we now accidentally report `testStarted`/`testEnded` for non-parameterized repeated tests in an inconsistent way. (this is copy/pasted from a comment I left in-source, and normally I don't like leaving verbose comments in source but this one's confusing enough.) For all test cases of a given test, we emit the following set of events internally. ``` testStarted testCaseStarted (for each case) ... testCaseEnded (for each case) ... testEnded ``` For parameterized tests, this is what clients expect; the test itself has a distinct start/end from all the cases. For non-parameterized tests, however, clients don't need a redundant `testCaseStarted`/`testCaseEnded` for a single case, so we elide it. However, we don't know which `iteration` we're on until we've started running test cases, and subsequent iterations will post additional `testCaseStarted`/`testCaseEnded` events. To provide a coherent façade to our clients: - For non-parameterized tests, elide the outer `testStarted`/`testEnded` events, and replace `testCaseStarted`/`testCaseEnded` with `testStarted`/`testEnded`. - For parameterized tests, emit all events. This extracts the mapping from `Event.Kind` to `EncodedEvent.Kind` into a failable initializer on `EncodedEvent.Kind`, which splits the kind-mapping from the field-population logic, and then simplifies the logic for determining when to substitute/elide `test`/`testCase` events. - [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. Resolves rdar://182236497
harlanhaskins
force-pushed
the
harlan/fix-test-case-iteration-output-6.4
branch
from
July 18, 2026 01:48
552776c to
0e1e450
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a bug in event emission for
testStarted/testEndedevents introduced with the implementation of ST-0024Affects clients of JSON event schema, but not existing clients of Snapshot SPI.
Issues:
rdar://182236497
Original PRs:
Simplify and fix encoded event ordering issues with test repetitions #1793
Risk:
Low (only affects consumers of the JSON event schema, fixes a regression since 6.3)
Testing:
Ran existing unit tests in CI and locally, added new unit tests.
Reviewers:
@stmontgomery