Fix xcresult snapshot test file attribution#1094
Merged
trunk-io[bot] merged 1 commit intoMay 19, 2026
Merged
Conversation
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1094 +/- ##
==========================================
+ Coverage 81.77% 82.10% +0.32%
==========================================
Files 69 69
Lines 14939 14986 +47
==========================================
+ Hits 12217 12304 +87
+ Misses 2722 2682 -40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TylerJang27
approved these changes
May 18, 2026
| } | ||
|
|
||
| fn normalize_file_path(file_path: Option<&String>) -> Option<String> { | ||
| file_path.map(|file_path| file_path.replace(' ', "%20")) |
Member
Author
There was a problem hiding this comment.
Unfortunately, yes. We didn't correct for this before when parsing XCResult file:// URLS, so for test identity backwards compat, we need to continue percent encoding spaces to ensure we don't create new test cases.
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.
Summary
documentLocationInCreatingWorkspacefallback path.Rationale
Swift SnapshotTesting trait failures can include framework files later in the call stack, such as
SnapshotsTestTrait.swift. The previous experimental failure-summary path selected the last Swift or Obj-C call-stack frame, so the reported JUnitfilecould point at SnapshotTesting internals instead of the test source that asserted the snapshot.The xcresult failure summary already contains better structured attribution fields. Although the legacy schema calls the preferred field
fileName, the inspected xcresult objects store a full absolute source path there, not just a basename. In the SnapshotTesting fixture,fileNameandsourceCodeContext.location.filePathboth point to/tmp/xcresult-snapshot-repro.sPh62f/Tests/SnapshotReproTests/SnapshotReproTests.swift; the call stack also includes full paths, but later frames point at SnapshotTesting internals.This change therefore prefers
fileName, thensourceCodeContext.location.filePath, and only falls back to the old call-stack heuristic when those structured fields are absent. The non-experimental legacy path remains available and unchanged in behavior.Testing
cargo test -p xcresulttest_swift_snapshot_testing_trait_failure_uses_assertion_file::case_1_experimental_failure_summaryfails by pointing atSnapshotsTestTrait.swift; restored the fix and confirmed it passes.