[PR #1887] [CLOSED] fix(javascript): recover retained prefixed source maps #4879

Closed
opened 2026-10-31 00:56:19 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/retained-source-map-prefixes


📝 Commits (1)

  • 851cd98 fix(javascript): recover retained prefixed source maps

📊 Changes

5 files changed (+99 additions, -17 deletions)

View changed files

📝 src/application/javascript/JavaScriptArtifactAnalysis.ts (+5 -2)
📝 src/browser/WebSourceMapFetcher.ts (+1 -1)
📝 src/domain/sourceMapEnvelope.ts (+13 -0)
📝 src/javascript/sourceMaps/SourceMapFormat.ts (+1 -14)
➕ tests/acceptance/applications/sourceMapPrefixCli.test.ts (+79 -0)

📄 Description

Summary

Retained source maps with the standard )]}' response prefix lost their original-source evidence during directory analysis. Apply the existing source-map parsing normalization to retained artifacts, while preserving their original bytes and identity. Fixes #1882.

Problem and expected behavior

A bundle.js.map containing )]}' followed by a valid version-3 map produced partial graph coverage and no original.ts source node. Removing only the prefix produced complete coverage. The same retained map now recovers its original source and embedded content without changing the retained map's digest or provenance.

Change and scope

Move the existing sourceMapJsonText implementation, unchanged, to the shared domain source-map envelope module. Application analysis, browser collection, and point tracing use that single parsing view. The application parser now applies it before JSON parsing; package manifests and other JSON inputs keep their existing behavior.

Contract and boundary impact

  • Semantic owner and earliest changed stage: domain-owned source-map text framing, consumed during application artifact parsing.
  • CLI and MCP/tool-catalog contract: unchanged schemas; both analysis surfaces now recover the same original-source evidence.
  • Provider, bridge, target-format, or platform compatibility: existing source-map framing support is reused; no engine or bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: normalize only the parsing view; retain original file bytes, map SHA-256, embedded content SHA-256, and source declarations.
  • Process execution, authorization, cleanup, or containment impact: none; no new remote requests or production process execution.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • New compiled CLI and stdio MCP acceptance coverage uses a retained BOM-prefixed map with response framing and CRLF. It asserts original-source recovery, complete coverage, both digests, provenance, and unchanged retained bytes.

  • On base fb94d9dde0ccda83ae520ac6fb22b1d283562cf3, both new surface tests failed because the original-source node was absent. Both pass after the fix.

  • A separate actual CLI control reproduced the loss twice and recovered the original after removing only the prefix.

  • Existing point-tracing, browser HTTP source-map collection, filesystem source-map locations, and source-map envelope tests pass, including existing malformed-input paths.

  • Review: independent read-only review of the frozen complete patch passed both standards and issue-contract checks, with no actionable findings.

  • Remaining proof gaps: full deterministic coverage is left to upstream CI. No live browser or native-provider workflow was run; this report concerns retained local artifacts.

  • 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

All local checks used Node 24.18.0 / npm 11.16.0 on macOS 27.0.1 arm64.

  • npm run test:focused -- tests/acceptance/applications/sourceMapPrefixCli.test.ts before the application fix — 2 expected regression failures.
  • npm run test:focused -- tests/acceptance/applications/sourceMapPrefixCli.test.ts src/javascript/sourceMaps/TraceSourceMap.test.ts tests/boundary/browser/webSourceMapFetcher.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts src/domain/sourceMapEnvelope.test.ts — 111 tests passed across 5 files, including freshly built CLI/MCP workflows.
  • npm run check — passed typecheck, lint, formatting, knip, metadata, module boundaries, and architecture guards; 758 lint warnings, zero errors.
  • npm run verify:test-discovery — all 843 test files discovered exactly once.
  • git diff --check — passed.
  • Upstream CI — awaiting maintainer approval for this fork contribution (action_required); no CI jobs have executed. This is not counted as a passing check.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: actual REA CLI/MCP on macOS and existing browser HTTP boundary tests; live browser and native engines not run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: normalization retains the existing invalid-input handling and introduces no external fetch or new execution authority.

Review checklist

  • This PR addresses a concrete reproduced problem and has one focused outcome.
  • The title follows Conventional Commits and the related issue is linked.
  • Tests cover observable evidence recovery and existing malformed-input paths.
  • No owning docs, schemas, or generated metadata require changes.
  • Representative CLI/MCP output and actual validation are recorded above.
  • The final diff contains no secrets, unrelated cleanup, or unsupported provider claims.

🔄 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/1887 **Author:** [@xu91102](https://github.com/xu91102) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/retained-source-map-prefixes` --- ### 📝 Commits (1) - [`851cd98`](https://github.com/morluto/rea/commit/851cd983a4ba2cb96ffc3b81af382aef39bf0925) fix(javascript): recover retained prefixed source maps ### 📊 Changes **5 files changed** (+99 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/JavaScriptArtifactAnalysis.ts` (+5 -2) 📝 `src/browser/WebSourceMapFetcher.ts` (+1 -1) 📝 `src/domain/sourceMapEnvelope.ts` (+13 -0) 📝 `src/javascript/sourceMaps/SourceMapFormat.ts` (+1 -14) ➕ `tests/acceptance/applications/sourceMapPrefixCli.test.ts` (+79 -0) </details> ### 📄 Description ## Summary Retained source maps with the standard `)]}'` response prefix lost their original-source evidence during directory analysis. Apply the existing source-map parsing normalization to retained artifacts, while preserving their original bytes and identity. Fixes #1882. ## Problem and expected behavior A `bundle.js.map` containing `)]}'` followed by a valid version-3 map produced partial graph coverage and no `original.ts` source node. Removing only the prefix produced complete coverage. The same retained map now recovers its original source and embedded content without changing the retained map's digest or provenance. ## Change and scope Move the existing `sourceMapJsonText` implementation, unchanged, to the shared domain source-map envelope module. Application analysis, browser collection, and point tracing use that single parsing view. The application parser now applies it before JSON parsing; package manifests and other JSON inputs keep their existing behavior. ## Contract and boundary impact - Semantic owner and earliest changed stage: domain-owned source-map text framing, consumed during application artifact parsing. - CLI and MCP/tool-catalog contract: unchanged schemas; both analysis surfaces now recover the same original-source evidence. - Provider, bridge, target-format, or platform compatibility: existing source-map framing support is reused; no engine or bridge changes. - Evidence, artifact, provenance, or reconstruction contract: normalize only the parsing view; retain original file bytes, map SHA-256, embedded content SHA-256, and source declarations. - Process execution, authorization, cleanup, or containment impact: none; no new remote requests or production process execution. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - New compiled CLI and stdio MCP acceptance coverage uses a retained BOM-prefixed map with response framing and CRLF. It asserts original-source recovery, complete coverage, both digests, provenance, and unchanged retained bytes. - On base `fb94d9dde0ccda83ae520ac6fb22b1d283562cf3`, both new surface tests failed because the original-source node was absent. Both pass after the fix. - A separate actual CLI control reproduced the loss twice and recovered the original after removing only the prefix. - Existing point-tracing, browser HTTP source-map collection, filesystem source-map locations, and source-map envelope tests pass, including existing malformed-input paths. - Review: independent read-only review of the frozen complete patch passed both standards and issue-contract checks, with no actionable findings. - Remaining proof gaps: full deterministic coverage is left to upstream CI. No live browser or native-provider workflow was run; this report concerns retained local artifacts. - [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 All local checks used Node 24.18.0 / npm 11.16.0 on macOS 27.0.1 arm64. - `npm run test:focused -- tests/acceptance/applications/sourceMapPrefixCli.test.ts` before the application fix — 2 expected regression failures. - `npm run test:focused -- tests/acceptance/applications/sourceMapPrefixCli.test.ts src/javascript/sourceMaps/TraceSourceMap.test.ts tests/boundary/browser/webSourceMapFetcher.test.ts tests/boundary/filesystem/javascriptSourceMapLocations.test.ts src/domain/sourceMapEnvelope.test.ts` — 111 tests passed across 5 files, including freshly built CLI/MCP workflows. - `npm run check` — passed typecheck, lint, formatting, knip, metadata, module boundaries, and architecture guards; 758 lint warnings, zero errors. - `npm run verify:test-discovery` — all 843 test files discovered exactly once. - `git diff --check` — passed. - [Upstream CI](https://github.com/morluto/rea/actions/runs/38153067783) — awaiting maintainer approval for this fork contribution (`action_required`); no CI jobs have executed. This is not counted as a passing check. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: actual REA CLI/MCP on macOS and existing browser HTTP boundary tests; live browser and native engines not run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: normalization retains the existing invalid-input handling and introduces no external fetch or new execution authority. ## Review checklist - [x] This PR addresses a concrete reproduced problem and has one focused outcome. - [x] The title follows Conventional Commits and the related issue is linked. - [x] Tests cover observable evidence recovery and existing malformed-input paths. - [x] No owning docs, schemas, or generated metadata require changes. - [x] Representative CLI/MCP output and actual validation are recorded above. - [x] The final diff contains no secrets, unrelated cleanup, or unsupported provider claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:19 +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#4879
No description provided.