Skip to content

test(sourcemap): consolidate source map regressions - #2034

Merged
morluto merged 4 commits into
morluto:mainfrom
xu91102:fix/source-map-unnamed-sources
Oct 12, 2026
Merged

morluto merged 4 commits into
morluto:mainfrom
xu91102:fix/source-map-unnamed-sources

Conversation

@xu91102

@xu91102 xu91102 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Expand the existing nullable journey with both embedded and unembedded unnamed slots, real TraceMap controls, aligned source/declaration indices, content availability and digests, original map bytes and complete coverage.
  • Assert exactly three known originals across the three valid maps, including their distinct map digests, so extra fabricated original nodes fail the test.
  • Exercise [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.
  • Remove the boundary matrix's superseded single [42] row. Other malformed-content, cardinality and reconstruction cases remain.

Contract and boundary impact

  • Semantic owner and earliest changed stage: existing retained source-map acceptance and filesystem boundary tests; production parsing is unchanged.
  • CLI and MCP/tool-catalog contract: unchanged; both compiled public surfaces are exercised.
  • Provider, bridge, target-format, or platform compatibility: unchanged; use the existing trace-mapping dependency.
  • Evidence, artifact, provenance, or reconstruction contract: preserve unknown slots, aligned content, map/source digests, source identity and malformed-map limitations.
  • Process execution, authorization, cleanup, or containment impact: existing owned temporary-directory cleanup and CLI/MCP harness retained.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests updated: sourceMapPrefixCli.test.ts and javascriptArtifactReconstruction.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.
  • Independent Standards and Spec review of the final diff — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: compiled CLI and stdio MCP on macOS; no browser/native provider or cross-platform run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: only existing test fixtures and assertions change; no production authorization or external provider changes.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed (no production contract changes).
  • User-visible CLI/MCP assertions cover representative valid and rejected evidence.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T04:33:08.106022Z bbcacd9 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@xu91102 xu91102 changed the title fix(sourcemap): retain named originals beside unknown source names test(sourcemap): verify unnamed source evidence through CLI and MCP Oct 12, 2026
@xu91102 xu91102 changed the title test(sourcemap): verify unnamed source evidence through CLI and MCP test(sourcemap): consolidate source map regressions Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants