fix(debug-files): a dry run must not fail on a map with no debug-id - #47
Conversation
Code review
I traced the full Findings: None. Looks sound — merge as is. |
`--dry-run` is documented as the safe diagnostic, and it could not be used on a freshly built output directory at all. `sourcemaps inject --dry-run` writes nothing by design, so every map still has no debug-id when the upload preview reaches it — and the upload exited 11 on the first one. The JS bundler plugin works around this by skipping the upload step entirely on a dry run (`orchestrate.ts`, with the measurement in its comment), so the one safe way to preview the flow never exercised the flow. A dry run sends nothing, so an un-keyed map cannot register the unfindable symbol the real run refuses over. It is now reported (`dry run: no debug_id — …`) and counted (`unkeyed`) instead. When NOTHING is keyed, the run completes as a success saying so, rather than falling into the "all 0 source maps are stylesheet or type-declaration maps" branch — plainly the wrong message there, and the one it used to produce. Unchanged: a real run still exits 11 on the first un-keyed map, `--uuid` still keys a map on a dry run, and a dry run still packs everything it can key. Verified end to end on a directory with one paired bundle and one orphan map: `inject --dry-run` reports the id it would write, `upload --dry-run` exits 0 naming both un-keyed maps, and the real upload still exits 11. Four mutants caught (tolerance removed, tolerance extended to the real run, the all-unkeyed branch bypassed, the counter not incremented). Two new e2e flows. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1500e60 to
a295e0f
Compare
Code reviewMakes Findings: None. Looks sound — merge as is. |
Item §4 from the CLI-in-JS-flows audit: the whole flow cannot be dry-run. Independent of #45/#46 (different file), so it can merge in any order.
The problem
--dry-runis the documented safe diagnostic, and it could not be used on a freshly built output directory at all:sourcemaps inject --dry-runwrites nothing, by design.debug-files upload --type sourcemaps --dry-runexited 11 on the first one.@bugsee/bundler-plugin-coreworks around it by skipping the upload step entirely on a dry run — meaning the one safe way to preview the flow never exercises the flow.The fix
A dry run sends nothing, so an un-keyed map cannot register the unfindable symbol the real run refuses over. It is now reported and counted instead:
When NOTHING is keyed, the run completes as a success saying so, rather than falling into the
"all 0 source maps are stylesheet or type-declaration maps"branch — plainly the wrong message there, and the one it used to produce.Unchanged: a real run still exits 11 on the first un-keyed map (uploading it would register a symbol nothing can find),
--uuidstill keys a map on a dry run, and a dry run still packs everything it can key.Tests
Three unit tests (real run still refuses + dry run succeeds and packs the keyed map; an entirely un-injected build;
--uuidon a dry run) and two e2e flows against the mock server, asserting the warning text and that nothing is posted. Four mutants caught: tolerance removed, tolerance extended to the real run, the all-unkeyed branch bypassed, the counter not incremented.Gates:
cargo fmt --check,clippy --all-targets -D warnings(0), 496 unit tests + all suites,e2e_flows.pyALL PASS.Follow-on in the JS repo once this is released:
@bugsee/bundler-plugin-corecan drop its dry-run workaround and preview the real flow.🤖 Generated with Claude Code