Skip to content

fix(javascript): preserve and resolve complete source-map URLs - #1788

Merged
N0zoM1z0 merged 2 commits into
mainfrom
fix/source-map-url-resolution
Oct 11, 2026
Merged

N0zoM1z0 merged 2 commits into
mainfrom
fix/source-map-url-resolution

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Summary

Keep complete source-map URL evidence and resolve percent-encoded local paths to the selected map. Fixes #1781. Fixes #1782.

Problem and expected behavior

//# sourceMappingURL=app.js.map?variant=a*modern was truncated at *, collapsing distinct declarations and shortening source ranges. space%20part.js.map remained encoded during local lookup, reporting an unavailable map despite inventory containing space part.js.map.

The original declaration, SHA-256 and source span must stay intact, while local URL lookup removes query/fragment and percent-decodes the path exactly once.

Change and scope

Line-comment directives terminate at whitespace; the existing block-comment terminator stays unchanged. The owning url-reference path boundary reuses percentDecodeUrlPath, preserving literal invalid percent escapes and rejecting decoded NUL/invalid UTF-8. ESM, CommonJS, HTML and filesystem-expression policies are unchanged. These related producer corrections share public CLI/MCP regression coverage.

Contract and boundary impact

  • Semantic owner and earliest changed stage: comment-token extraction in the JavaScript domain and contextual URL lookup in the application path resolver.
  • CLI and MCP/tool-catalog contract: no schema change; both return complete declarations and correctly linked local source maps.
  • Provider, bridge, target-format, or platform compatibility: static JavaScript/URL handling. New fixtures use portable filenames; literal * is in URL query/fragment.
  • Evidence, artifact, provenance, or reconstruction contract: hash raw declarations, preserve exact ranges and distinct observations; link to the existing inventoried map identity.
  • Process execution, authorization, cleanup, or containment impact: none; no URL fetch, execution or additional filesystem authority.
  • Generated metadata, package, or installation impact: none; no generated outputs committed.

Evidence and regression coverage

  • Tests added or updated: two compiled CLI + real stdio MCP scenarios for modern/legacy line comments, distinct URLs, SHA-256/ranges/target edges, encoded spaces/percent/Unicode, one-pass decoding, suffixes and literal %ZZ. The same URL resolver's Worker/service-worker callers preserve encoded specifiers and link literal-space files. Resolver cases preserve rejected outcomes for NUL, invalid UTF-8, encoded separators/dots and traversal. Existing block-comment and 9M/9.5M-character regressions remain.

  • Base reproduction: both new public tests fail on unchanged production at aaeadf2d4: three star-containing declarations yielded only two reference observations, and the encoded-space reference did not link to its inventoried map.

  • User-visible output: declared_url/declared_url_sha256 remain original; resolved_path names the local decoded path, available: true, and maps_to targets the inventoried map node.

  • Remaining proof gaps: static relationships do not prove target JavaScript executes or debugger/provider behavior. Native Windows execution is not locally available.

  • 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

  • npm run test:focused -- src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts src/application/javascript/JavaScriptArtifactPathResolution.test.ts tests/acceptance/applications/applicationWorkflowCli.test.ts — 133/133 passed, including the unchanged capacity regressions.
  • Compiled runtime, targeted public tests after adding Worker/service-worker controls: node node_modules/vitest/vitest.mjs run tests/acceptance/applications/applicationWorkflowCli.test.ts -t 'source-map URL' — 2/2 passed (31 unrelated tests intentionally filtered).
  • Four additional actual Linux CLI probes passed: ordinary URL, literal-star filenames with modern/legacy line directives, and an encoded star; verified exact declarations, SHA-256, resolved paths and graph links.
  • npm run check — typecheck, lint/module boundaries, formatting, Knip, metadata and architecture guards passed.
  • After merging current main into the branch: npm run build:cached passed; targeted compiled CLI/MCP source-map scenarios plus the merged Mach-O regression passed 3/3 (40 unrelated tests filtered).

Compatibility, safety, and release

  • Breaking changes or migration steps: none; valid URLs now resolve as intended.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux compiled CLI and SDK stdio MCP; no native provider/browser execution claim.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: decode only local URL paths, once, after existing external/syntax guards; preserve lexical artifact-root confinement and selected-file lookup.

Review checklist

  • This PR addresses concrete bugs.
  • One focused outcome; Conventional Commit title.
  • Related issues are linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs/contracts/generated metadata require no changes.
  • Representative CLI/MCP output is described above.
  • Final diff checked for secrets, unrelated cleanup, and unsupported claims.

Keep line-comment URL declarations intact and percent-decode local URL paths
once, preserving raw Evidence identity and artifact-root confinement.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-11T09:56:13.381057Z 521ffac PR opened
ℹ️ 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.

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed the two producer fixes and public CLI/stdio-MCP regressions; both failed on the affected base. Raw URL/digest/ranges and distinct observations remain intact, while local URL paths decode once and retain existing external/confinement/invalid-byte guards. The shared Worker/service-worker callers are covered too. Relevant suites passed 133/133, final affected scenarios and main integration passed, and static checks passed. Two independent source reviews found no blockers. Waiting for current-head CI and automated review before merge; no native target execution claim.

@N0zoM1z0
N0zoM1z0 merged commit ce845ba into main Oct 11, 2026
31 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/source-map-url-resolution branch October 11, 2026 10:19
@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

2 participants