Plumb the schema version through the JSON ABI layers.#956
Merged
grynspan merged 7 commits intoFeb 19, 2025
Conversation
This PR plumbs the schema version (0 or 1) through the Swift types and functions that produce our JSON output, allowing them to change behaviour based on which version is in use. As a proof-of-concept as much as anything else, this PR also adds an (unsupported) `_tags` field to the JSON output for a test record, but only with ABI version 1.
…s much as is feasible)
grynspan
commented
Feb 12, 2025
| return version.eventHandler(encodeAsJSONLines: encodeAsJSONLines, forwardingTo: targetEventHandler) | ||
| } | ||
|
|
||
| return switch versionNumber { |
Contributor
Author
There was a problem hiding this comment.
We could refactor this switch to produce an any ABI.Version.Type, or even move it into ABI as ABI.version(withVersionNumber:), but that would require returning an existential any which would preclude its eventual use in Embedded Swift.
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test |
stmontgomery
approved these changes
Feb 18, 2025
Merged
2 tasks
stmontgomery
added a commit
that referenced
this pull request
Sep 6, 2025
…ize relevant content (#1287) This PR formally defines an "experimental" event stream version (named `ABI.ExperimentalVersion`) which represents content that is considered experimental. It then adopts the new experimental version in several places to conditionalize the inclusion of fields on event stream models which are not yet officially included in any defined, supported version. Finally, it uses this new version everywhere that intentionally always uses the _highest experimental_ version, such as the exit test back channel and the [recently-added](#1253) experimental console output recorder. ### Motivation: The event stream now has an established versioning system (as of #956) and can easily conditionalize content based on version. As a general rule, we prefer to exclude content which has not gone through Swift Evolution review when delivering data to event stream consumers which expect to receive content from a supported version. The fields this PR conditionalizes have underscore prefixes and have code-level documentation indicating their unofficial-ness, but the fact that they are included at all in supported/non-experimental version streams could lead to misuse or unintentional breakages in the future if the names or semantics of these fields change. ### 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.
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 PR plumbs the schema version (0 or 1) through the Swift types and functions that produce our JSON output, allowing them to change behaviour based on which version is in use.
As a proof-of-concept as much as anything else, this PR also adds an (unsupported)
_tagsfield to the JSON output for a test record, but only with ABI version 1.I've split this PR into two commits: the first plumbs the version through as an integer argument, while the second uses the type system to represent different ABI versions. The latter uses a protocol that we can extend so that different ABI versions have differing behaviours (although that's too coarse-grained for things like
_tags.)Checklist: