[PR #1786] [CLOSED] fix(javascript): keep asterisks in line-comment source-map URLs #4817

Closed
opened 2026-10-31 00:55:21 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1786
Author: @falkoro
Created: 10/11/2026
Status: ❌ Closed

Base: main ← Head: fix/1781-source-map-line-comment-asterisk


📝 Commits (1)

  • 3a5ac73 fix(javascript): keep asterisks in line-comment source-map URLs

📊 Changes

3 files changed (+64 additions, -1 deletions)

View changed files

📝 src/domain/javascript/javascriptStaticAnalysisCalls.ts (+4 -1)
📝 src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts (+10 -0)
📝 tests/boundary/filesystem/javascriptSourceMapComments.test.ts (+50 -0)

📄 Description

Summary

Fixes #1781. analyze-javascript-application cut a //# or //@ sourceMappingURL at the first *. For //# sourceMappingURL=app*part.js.map it recorded declared_url: "app" and linked an unavailable reference instead of the inventoried app*part.js.map.

Problem and expected behavior

addSourceMapDirectives ended every directive URL at /[\s*]/u. Stopping at * is only needed so a block-comment URL ends before */. A line comment has no closing delimiter, and ECMA-426 MatchSourceMapURL takes the URL as a run of non-whitespace. Expected: the full declared URL, available: true, and a maps_to edge to the inventoried map.

Change and scope

Line comments (comment.type === "CommentLine") now end the URL at whitespace only. Block comments keep the existing [\s*] boundary. URL resolution is not touched (percent-encoded local paths are #1782).

Contract and boundary impact

  • Semantic owner and earliest changed stage: source-map directive extraction in src/domain/javascript/javascriptStaticAnalysisCalls.ts.
  • CLI and MCP/tool-catalog contract: none; existing fields carry the corrected value.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: declared_url, its digest and source range now cover the whole line-comment URL.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated:
    • src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts: //# and //@ line comments containing *.
    • tests/boundary/filesystem/javascriptSourceMapComments.test.ts: reconstruction of a directory with a real app*part.js.map for both markers. Asserts a single source-map node, the full declared_url, available: true, the maps_to target and its source range.
  • Base reproduction: on 85ccef34 all four new cases fail (declared_url is app, two source-map nodes). They pass with this change.
  • User-visible CLI output (built CLI, issue fixture, --max-heap-mb 512 --json), source-map reference observation:
    • before: {"declared_url":"app","resolved_path":"app.js","available":false}
    • after: {"declared_url":"app*part.js.map","resolved_path":"app*part.js.map","available":true}
    • same result for //@; block-comment control /*# sourceMappingURL=app.js.map*/ still resolves app.js.map.
  • Remaining proof gaps: * is not a valid Windows filename, so the boundary fixture only runs on Linux/macOS. These files are not in the Windows curated lane.

For evidence-bearing changes:

  • 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

Linux x64, Node 24.18.0, npm 11.16.0:

  • npm run test:focused -- all src/domain/javascript/*.test.ts plus tests/boundary/filesystem/javascriptSourceMapComments.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts tests/boundary/filesystem/sourceToBundlePaths.test.ts tests/boundary/filesystem/javascriptArtifactGraphObservationLookup.test.ts src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts: 48 files, 904 tests passed.
  • npm run check: passed (0 lint errors, warning count unchanged from main; architecture guards passed).
  • npm run verify:test-discovery: passed.
  • npm run build:cached, then node scripts/rea.mjs analyze-javascript-application <fixture> --max-heap-mb 512 --json for //#, //@ and the block-comment control: output above.
  • git diff --check: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; Linux only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new file access; the longer URL still goes through the existing confined resolver.

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, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1786 **Author:** [@falkoro](https://github.com/falkoro) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/1781-source-map-line-comment-asterisk` --- ### 📝 Commits (1) - [`3a5ac73`](https://github.com/morluto/rea/commit/3a5ac73c0c1505cd0b2c825dd24173045baebf64) fix(javascript): keep asterisks in line-comment source-map URLs ### 📊 Changes **3 files changed** (+64 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptStaticAnalysisCalls.ts` (+4 -1) 📝 `src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts` (+10 -0) 📝 `tests/boundary/filesystem/javascriptSourceMapComments.test.ts` (+50 -0) </details> ### 📄 Description ## Summary Fixes #1781. `analyze-javascript-application` cut a `//#` or `//@` sourceMappingURL at the first `*`. For `//# sourceMappingURL=app*part.js.map` it recorded `declared_url: "app"` and linked an unavailable reference instead of the inventoried `app*part.js.map`. ## Problem and expected behavior `addSourceMapDirectives` ended every directive URL at `/[\s*]/u`. Stopping at `*` is only needed so a block-comment URL ends before `*/`. A line comment has no closing delimiter, and ECMA-426 `MatchSourceMapURL` takes the URL as a run of non-whitespace. Expected: the full declared URL, `available: true`, and a `maps_to` edge to the inventoried map. ## Change and scope Line comments (`comment.type === "CommentLine"`) now end the URL at whitespace only. Block comments keep the existing `[\s*]` boundary. URL resolution is not touched (percent-encoded local paths are #1782). ## Contract and boundary impact - Semantic owner and earliest changed stage: source-map directive extraction in `src/domain/javascript/javascriptStaticAnalysisCalls.ts`. - CLI and MCP/tool-catalog contract: none; existing fields carry the corrected value. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: `declared_url`, its digest and source range now cover the whole line-comment URL. - Process execution, authorization, cleanup, or containment impact: none. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: - `src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts`: `//#` and `//@` line comments containing `*`. - `tests/boundary/filesystem/javascriptSourceMapComments.test.ts`: reconstruction of a directory with a real `app*part.js.map` for both markers. Asserts a single source-map node, the full `declared_url`, `available: true`, the `maps_to` target and its source range. - Base reproduction: on `85ccef34` all four new cases fail (`declared_url` is `app`, two source-map nodes). They pass with this change. - User-visible CLI output (built CLI, issue fixture, `--max-heap-mb 512 --json`), source-map reference observation: - before: `{"declared_url":"app","resolved_path":"app.js","available":false}` - after: `{"declared_url":"app*part.js.map","resolved_path":"app*part.js.map","available":true}` - same result for `//@`; block-comment control `/*# sourceMappingURL=app.js.map*/` still resolves `app.js.map`. - Remaining proof gaps: `*` is not a valid Windows filename, so the boundary fixture only runs on Linux/macOS. These files are not in the Windows curated lane. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Linux x64, Node 24.18.0, npm 11.16.0: - `npm run test:focused --` all `src/domain/javascript/*.test.ts` plus `tests/boundary/filesystem/javascriptSourceMapComments.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts tests/boundary/filesystem/sourceToBundlePaths.test.ts tests/boundary/filesystem/javascriptArtifactGraphObservationLookup.test.ts src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts`: 48 files, 904 tests passed. - `npm run check`: passed (0 lint errors, warning count unchanged from main; architecture guards passed). - `npm run verify:test-discovery`: passed. - `npm run build:cached`, then `node scripts/rea.mjs analyze-javascript-application <fixture> --max-heap-mb 512 --json` for `//#`, `//@` and the block-comment control: output above. - `git diff --check`: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; Linux only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new file access; the longer URL still goes through the existing confined resolver. ## Review checklist - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:55:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4817
No description provided.