[GH-ISSUE #2023] [Bug] Retained maps with sourcesContent null lose their source declarations #675

Closed
opened 2026-10-15 18:27:16 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @xu91102 on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2023

Before submitting

  • Searched open/closed issues and recent/open PRs; this is a different behavior from #1939 and the open package-pattern work #2018.
  • Uses source-owned fixtures with no credentials or private target data.

Area

Evidence, artifacts, or reconstruction — JavaScript application analysis.

Observed behavior

REA exits 0 with partial coverage and no source-map-original node. Replacing sourcesContent:null with an omitted field or [null] retains original.ts. The existing trace decoder accepts the null field as absent content.

Reproduction

In a built source checkout, materialize the fixture:

node --input-type=module <<'JS'
import { mkdirSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
const root = resolve("fixture");
const files = {
  "bundle.js": "export const answer = 42;\n//# sourceMappingURL=bundle.js.map\n",
  "bundle.js.map": "{\"version\":3,\"sources\":[\"original.ts\"],\"sourcesContent\":null,\"names\":[],\"mappings\":\"AAAA\"}",
  "original.ts": "export const answer: number = 42;"
};
for (const [path, text] of Object.entries(files)) {
 const target = resolve(root,path);
 mkdirSync(dirname(target),{recursive:true});
 writeFileSync(target,text);
}
JS
node scripts/rea.mjs analyze-javascript-application "$(pwd)/fixture" --format json > observed.json

Inspect normalized_result.graph.edges for specifier, resolved_path, and resolution_status, or source-map-original nodes and the graph coverage. The affected source checkout was built and the public CLI was executed on these exact fixture shapes before this report.

Expected behavior

Treat a null sourcesContent field as absent embedded source content, consistent with the existing nullable decoder schema. Retain source names, original map bytes/digest and content_available:false. Keep malformed arrays and scalar content invalid.

Format/loader reference. Runtime/decoder controls were executed rather than inferred from documentation.

Impact and scope

Static application reconstruction loses known original-source evidence. No live browser or native engine is required to reproduce the local directory-analysis failure.

Version and runtime

  • Source revision: 2ff850de68dc9b05c6faf2bbfd26d56bc2d5d27c (main at investigation start).
  • Node 24.18.0, npm 11.16.0, macOS 27.0.1 arm64.
  • Interface: compiled CLI.
  • Target: source-owned local directory.

Source-derived analysis

hasValidSourceMapContents admits undefined and aligned arrays but rejects null; the browser collection profile and retained-artifact parser both use this predicate even though the trace decoder schema explicitly permits null.

Originally created by @xu91102 on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2023 ### Before submitting - [x] Searched open/closed issues and recent/open PRs; this is a different behavior from #1939 and the open package-pattern work #2018. - [x] Uses source-owned fixtures with no credentials or private target data. ### Area Evidence, artifacts, or reconstruction — JavaScript application analysis. ### Observed behavior REA exits 0 with partial coverage and no source-map-original node. Replacing sourcesContent:null with an omitted field or [null] retains original.ts. The existing trace decoder accepts the null field as absent content. ### Reproduction In a built source checkout, materialize the fixture: ```sh node --input-type=module <<'JS' import { mkdirSync, writeFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; const root = resolve("fixture"); const files = { "bundle.js": "export const answer = 42;\n//# sourceMappingURL=bundle.js.map\n", "bundle.js.map": "{\"version\":3,\"sources\":[\"original.ts\"],\"sourcesContent\":null,\"names\":[],\"mappings\":\"AAAA\"}", "original.ts": "export const answer: number = 42;" }; for (const [path, text] of Object.entries(files)) { const target = resolve(root,path); mkdirSync(dirname(target),{recursive:true}); writeFileSync(target,text); } JS node scripts/rea.mjs analyze-javascript-application "$(pwd)/fixture" --format json > observed.json ``` Inspect `normalized_result.graph.edges` for `specifier`, `resolved_path`, and `resolution_status`, or source-map-original nodes and the graph coverage. The affected source checkout was built and the public CLI was executed on these exact fixture shapes before this report. ### Expected behavior Treat a null sourcesContent field as absent embedded source content, consistent with the existing nullable decoder schema. Retain source names, original map bytes/digest and content_available:false. Keep malformed arrays and scalar content invalid. [Format/loader reference](https://tc39.es/ecma426/#sec-GetOptionalListOfOptionalStrings). Runtime/decoder controls were executed rather than inferred from documentation. ### Impact and scope Static application reconstruction loses known original-source evidence. No live browser or native engine is required to reproduce the local directory-analysis failure. ### Version and runtime - Source revision: `2ff850de68dc9b05c6faf2bbfd26d56bc2d5d27c` (main at investigation start). - Node 24.18.0, npm 11.16.0, macOS 27.0.1 arm64. - Interface: compiled CLI. - Target: source-owned local directory. ### Source-derived analysis hasValidSourceMapContents admits undefined and aligned arrays but rejects null; the browser collection profile and retained-artifact parser both use this predicate even though the trace decoder schema explicitly permits null.
bsakaguchi 2026-10-15 18:27:16 +00:00
Author
Owner

@chqcjq commented on GitHub (Oct 12, 2026):

Verified on current main (85c547793): sourcesContent: null no longer drops source declarations. original.ts appears in the graph as a source-module node, and the source map reference is preserved. The fix from the merged PR is working. This issue can likely be closed.

<!-- gh-comment-id:6128730556 --> @chqcjq commented on GitHub (Oct 12, 2026): Verified on current main (85c547793): `sourcesContent: null` no longer drops source declarations. `original.ts` appears in the graph as a `source-module` node, and the source map reference is preserved. The fix from the merged PR is working. This issue can likely be closed.
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#675
No description provided.