Skip to content

fix(coverage): match the cloud source-map path candidates - #3320

Merged
BartWaardenburg merged 2 commits into
mainfrom
fix/source-map-path-contract
Oct 9, 2026
Merged

BartWaardenburg merged 2 commits into
mainfrom
fix/source-map-path-contract

Conversation

@BartWaardenburg

Copy link
Copy Markdown
Collaborator

Summary

The pre-upload warning of fallow coverage upload-source-maps (#3298, #3310) copies the path rules that Fallow Cloud uses to resolve sources[] entries. Until now, nothing kept the two implementations equal.

This PR adds tests/fixtures/source-map-path-contract.json, a public fixture of path cases. Each case gives raw, sourceRoot (or null), mapPath, and the expected ordered candidate list. A new test in source_map_sources.rs runs every case through source_candidates. Fallow Cloud vendors the same file at a pinned commit and runs it against its implementation, so a rule change on one side fails a test.

The cases cover tsc dist-relative sources, sourceRoot: "/" with rootDir: src, webpack namespaces (./ and ../ forms), webpack:///, Angular CLI workspace-relative sources, Turbopack [project]/, file:/// sources, percent encoding (invalid %zz, truncated %4, %+1, %FF, multi-byte, double decode %2541), Windows drives, backslashes, and map paths with ., .. and doubled slashes.

Fixes found by the fixture

  • webpack:///@scope/app/./src/x.ts lost @scope/app as a webpack namespace. A / right after webpack:// now means no namespace.
  • An empty sourceRoot added a leading /. It is now ignored.
  • The parent-directory candidates used the map path as given, so dist/../out/a.js.map gave a dist/... candidate. The map path is now canonicalized first.
  • Empty candidates are no longer listed.

Each fix is necessary: reverting any one of them alone fails a named fixture case.

Verification

  • cargo test -p fallow-cli --lib coverage::source_map_sources: pass.
  • npm run verify:fast and npm run verify:full: pass. The full run does not include the release jobs or the network and real-project smoke tests.
  • Real project: fallow coverage upload-source-maps --dry-run on a public Storybook Angular webpack build (nl-design-system/rijkshuisstijl-community) gives the same warning with 3.33.0 and with this branch.

Add tests/fixtures/source-map-path-contract.json, a public fixture of
source-map path cases with the expected ordered candidate list. The Rust
check of `fallow coverage upload-source-maps` now runs every case, and
Fallow Cloud runs the same file against its implementation, so a drift
between the two fails a test.

The fixture found four differences, now fixed in the CLI:

- `webpack:///@scope/app/./src/x.ts` lost its first segments as a
  webpack namespace. A `/` right after `webpack://` means no namespace.
- An empty `sourceRoot` added a leading `/`. It is now ignored.
- The parent-directory candidates used the map path as given, so
  `dist/../out/a.js.map` gave a `dist` candidate. The map path is now
  canonicalized first.
- Empty candidates are no longer listed.
@BartWaardenburg
BartWaardenburg merged commit 9909983 into main Oct 9, 2026
45 checks passed
@BartWaardenburg
BartWaardenburg deleted the fix/source-map-path-contract branch October 9, 2026 18:40
@BartWaardenburg

Copy link
Copy Markdown
Collaborator Author

Released in v3.33.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant