Skip to content
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

Define and implement a strawman stable JSON schema for output. #383

Merged
merged 5 commits into from
May 10, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Apr 29, 2024

This PR defines a JSON schema for events output from swift-testing via either --experimental-event-stream-output or abiEntryPoint_v0(). The JSON schema needs to be formally reviewed separately.

We are already writing an experimental JSON stream using "snapshot" types and we don't want to break folks experimenting with it before we have a final JSON schema, so for now that remains the default. To opt into the new schema, pass --experimental-event-stream-version 0 (note that this argument is not forwarded from swift test. See swiftlang/swift-package-manager#7534.)

Resolves #368.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan self-assigned this Apr 29, 2024
@grynspan grynspan added enhancement New feature or request tools integration Integration of swift-testing into tools/IDEs public-api Affects public API labels Apr 29, 2024
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Linux

@grynspan grynspan force-pushed the jgrynspan/defining-json-schema branch from 4a13767 to b6f6b87 Compare April 30, 2024 13:46
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan force-pushed the jgrynspan/defining-json-schema branch 2 times, most recently from dcb933e to 6cdc0ca Compare May 9, 2024 17:29
@grynspan grynspan changed the title Define and implement a stable JSON schema for output. Define and implement a strawman stable JSON schema for output. May 9, 2024
@grynspan grynspan requested a review from plemarquand May 9, 2024 17:31
@grynspan grynspan force-pushed the jgrynspan/defining-json-schema branch from 6cdc0ca to fb2d51a Compare May 9, 2024 18:22
@grynspan grynspan marked this pull request as ready for review May 9, 2024 18:22
@grynspan grynspan force-pushed the jgrynspan/defining-json-schema branch from fb2d51a to f0a4206 Compare May 9, 2024 18:27
@grynspan
Copy link
Contributor Author

grynspan commented May 9, 2024

@swift-ci please test

/// This event is the first event posted after ``Runner/run()`` is called.
case runStarted
indirect case runStarted(_ plan: Runner.Plan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is added because it's used elsewhere, but isn't this quite a large payload potentially? I wonder about the impact of that

But also (ironically): if we do add this here, for parity should we also be adding it to the corresponding run ended event?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty chunky, yes, but remember that the value is CoW, so not as large as you might think. I'm open to alternative designs.

I left it out of the runEnded case precisely because it was relatively large.

//

/// A namespace for ABI version 0 symbols.
enum ABIv0: Sendable {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for right now, but if/when we expose this outside the module I'd like to bikeshed alternative naming conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This enum is definitely not ever meant to be API. It's a namespace for ABI-version-0 symbols only.

I'm open to alternatives.

Copy link
Contributor

@stmontgomery stmontgomery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few more data modeling suggestions but generally this is looking great to me now, thanks!

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan merged commit d5f9851 into main May 10, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/defining-json-schema branch May 10, 2024 19:01
grynspan added a commit to swiftlang/swift-package-manager that referenced this pull request May 10, 2024
Follow-on to #7534. swift-testing has an additional argument specifying the
schema version of the JSON being used that we also need to pass through SwiftPM.

See: swiftlang/swift-testing#383
grynspan added a commit to swiftlang/swift-package-manager that referenced this pull request May 10, 2024
…7551)

Follow-on to #7534. swift-testing has an additional argument specifying
the schema version of the JSON being used that we also need to pass
through SwiftPM.

See: swiftlang/swift-testing#383
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…wiftlang#7551)

Follow-on to swiftlang#7534. swift-testing has an additional argument specifying
the schema version of the JSON being used that we also need to pass
through SwiftPM.

See: swiftlang/swift-testing#383
grynspan added a commit to swiftlang/swift-package-manager that referenced this pull request May 15, 2024
…7551)

Follow-on to #7534. swift-testing has an additional argument specifying
the schema version of the JSON being used that we also need to pass
through SwiftPM.

See: swiftlang/swift-testing#383
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…wiftlang#7551)

Follow-on to swiftlang#7534. swift-testing has an additional argument specifying
the schema version of the JSON being used that we also need to pass
through SwiftPM.

See: swiftlang/swift-testing#383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request public-api Affects public API tools integration Integration of swift-testing into tools/IDEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define and implement a stable JSON schema for output.
4 participants