Repository navigation
test(sourcemap): consolidate source map regressions - #2034
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 401189ee6f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const [index, raw] of names.entries()) { | ||
| if (raw === null) { | ||
| unnamedSources += 1; | ||
| continue; |
There was a problem hiding this comment.
Preserve embedded content for unnamed declarations
When sources[index] is null but sourcesContent[index] is a string, this early continue never reads or hashes that content. The emitted unknown scope records only the declaration count and map digest, so the embedded original's own bytes/digest disappear from CLI/MCP results even though TraceSourceMap already models this input as reported_source: null with retained embedded content (src/javascript/sourceMaps/TraceSourceMap.test.ts:135-140). Represent the unnamed declaration with its null identity and content/digest rather than skipping it.
AGENTS.md reference: AGENTS.md:L11-L11
Useful? React with 👍 / 👎.
Summary
The standalone null-content and unnamed-source acceptance files repeat the existing source-map journeys. Keep their distinct controls and assertions in
sourceMapPrefixCli.test.ts, and replace a weaker malformed-name boundary row with a CLI/MCP rejection scenario that also checks that later named entries do not leak into the graph.Refs #2023 and #2024. The production nullable-source fixes are already on main in ee50ed1; this PR updates existing regression coverage.
Problem and expected behavior
A valid map may contain absent embedded content or unnamed slots without losing its named declarations, source indices or artifact identity. A malformed non-string source name must reject the map explicitly and must not invent any originals. Those assertions should live in the existing public workflows without duplicate positive fixtures.
Change and scope
TraceMapcontrols, aligned source/declaration indices, content availability and digests, original map bytes and complete coverage.[42, "discarded.ts"]through CLI and stdio MCP separately from valid maps, checking partial coverage, the rejection reason, provenance, unchanged bytes and zero original nodes.[42]row. Other malformed-content, cardinality and reconstruction cases remain.Contract and boundary impact
Evidence and regression coverage
Tests updated:
sourceMapPrefixCli.test.tsandjavascriptArtifactReconstruction.test.ts; no new test file.Base evidence: the issue fixtures originally reproduced lost declarations on 2ff850d. The current main already contains their production fix and overlapping acceptance coverage; this diff consolidates the useful additional assertions.
User-visible CLI/MCP output: named originals and explicit unnamed observations are retained for valid maps; malformed names expose an unknown parse observation with partial coverage and no invented original.
Remaining proof gaps: full deterministic CI and other operating systems are pending; no live browser or native provider run.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
Executed with Node 24.18.0 / npm 11.16.0 on macOS arm64:
npm run test:focused -- tests/acceptance/applications/sourceMapPrefixCli.test.ts tests/boundary/filesystem/javascriptArtifactReconstruction.test.ts src/javascript/sourceMaps/TraceSourceMap.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts src/domain/sourceMapEnvelope.test.ts— final diff: 54 tests / 5 files passed.npm run check— final diff: all 6 tasks and architecture guards passed; 844 lint warnings, 0 errors.npm run verify:test-discovery— final base: 909 test files discovered exactly once.Compatibility, safety, and release
Review checklist
type(scope): outcome.