Skip to content

Decode EncodedEvent -> Event#1684

Merged
jerryjrchen merged 2 commits intoswiftlang:mainfrom
jerryjrchen:decode-encoded-event
Apr 23, 2026
Merged

Decode EncodedEvent -> Event#1684
jerryjrchen merged 2 commits intoswiftlang:mainfrom
jerryjrchen:decode-encoded-event

Conversation

@jerryjrchen
Copy link
Copy Markdown
Contributor

@jerryjrchen jerryjrchen commented Apr 21, 2026

Motivation:

Enables re-use of EncodedEvent decoding logic for interop and exit tests

The decoding is lossy, i.e. you can't recover all the original Event
details. For example, testID is left as nil, which we may want to
address in the future.

The current decoding supports these use cases:

  • Corelibs XCTest manually re-defined the record type to decode events
    from the fallback event handler.

    Now, it can use this decoding init directly.

  • Exit tests only decoded a subset of event kinds.

    Now, they still only process a limited set of event kinds. But, the
    implementation is simplified and we can easily extend it to support
    future event kinds if so desired.

Resolves rdar://175287183

Modifications:

  • Implement decoding EncodedEvent -> Event

  • Adopt for exit tests

  • Test common decoding scenarios, included decoding issueRecorded and valueAttached event kinds

Checklist:

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

### Motivation:

Enables re-use of EncodedEvent decoding logic for tools support interop.
Today, corelibs XCTest manually re-defines the 

Resolves rdar://175287183

### Modifications:

* Implement decoding EncodedEvent -> Event

* Test common decoding scenarios, included decoding issueRecorded and
  valueAttached event kinds
@jerryjrchen jerryjrchen added this to the Swift 6.4.0 (main) milestone Apr 21, 2026
@jerryjrchen jerryjrchen self-assigned this Apr 21, 2026
@jerryjrchen jerryjrchen added the enhancement New feature or request label Apr 21, 2026
@jerryjrchen jerryjrchen requested a review from grynspan as a code owner April 21, 2026 22:30
@jerryjrchen jerryjrchen requested a review from briancroom as a code owner April 21, 2026 22:30
@jerryjrchen jerryjrchen added the tools integration 🛠️ Integration of swift-testing into tools/IDEs label Apr 21, 2026
@jerryjrchen jerryjrchen added the interoperability ↔️ Work related to Swift Testing and XCTest interoperability label Apr 21, 2026
@jerryjrchen jerryjrchen moved this from Backlog to In review in [Swift Testing] Interoperability Apr 22, 2026
Comment thread Tests/TestingTests/ABI.EncodedEventTests.swift
Comment thread Tests/TestingTests/SkipInfoTests.swift
@jerryjrchen jerryjrchen requested a review from grynspan April 22, 2026 23:10
This makes it easier to handle new event types and simplifies (?) the
logic for managing currently support event kinds.

No functional change in behaviour. This technically enables exit tests
to handle .testSkipped event kinds, but this cannot occur in practise.
Comment on lines +193 to +194
/// ``testID`` and ``testCaseID`` are always `nil` because we need information
/// from the associated `ABI.EncodedTest` to properly decode those values.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So it'll just be follow-on work to fill in these missing property values, I take it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test.Case.ID isn't stable yet, so we can't really decode it right now. Test.ID may need to be modified to allow it to take a flat string instead of a SourceLocation, but I think it's feasible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's ok to have as nil for the time being because interop does not look at this field.

@jerryjrchen jerryjrchen merged commit fa5a211 into swiftlang:main Apr 23, 2026
35 checks passed
@jerryjrchen jerryjrchen deleted the decode-encoded-event branch April 23, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request interoperability ↔️ Work related to Swift Testing and XCTest interoperability tools integration 🛠️ Integration of swift-testing into tools/IDEs

Projects

Development

Successfully merging this pull request may close these issues.

3 participants