fix(parsers): preserve format boundaries and query occurrence identity

Normalize parsed facts at their owning boundaries across PE exports and certificates, ELF section names, GPU bundles, IL2CPP generic types, dyld slice selection, source maps, environment replay, and JavaScript mapped arguments. Preserve partial facts and explicit unsupported cases; clarify the corresponding documentation.

Validation: 831 affected tests passed with one existing skip across 23 files; build, typecheck/lint, documentation, formatting, and 2133-file test discovery passed. Format controls are synthetic; real Unity, GPU, and ARM-device execution is unverified.

Fixes #6709
Fixes #6688
Fixes #6719
Fixes #6718
Fixes #6704
Fixes #6703
Fixes #6692
Fixes #6723
Fixes #6687
Fixes #6726
Fixes #6696
Fixes #6691
Fixes #6727
This commit is contained in:
morluto
2026-10-23 22:01:16 +08:00
parent 4193bc5bf8
commit 5f702dd6cc
60 changed files with 2069 additions and 211 deletions
@@ -142,6 +142,23 @@ it("keeps ignore-list precedence and section-local indexes for duplicate sources
});
describe("upstream source-map point evidence", () => {
it("keeps repeated separators in distinct resolved source identities", () => {
const report = trace({
...leaf,
sources: ["dir/original.ts", "dir//original.ts"],
sourcesContent: ["single", "repeated"],
mappings: "AAAA,ACAA",
});
expect(
report.matches.map((match) =>
match.state === "mapped" ? match.resolved_url : null,
),
).toEqual([
"https://app.test/maps/dir/original.ts",
"https://app.test/maps/dir//original.ts",
]);
});
it("preserves every duplicate-column/source-URL candidate and its own embedded bytes", () => {
const report = trace({
...leaf,
+8 -5
View File
@@ -11,6 +11,7 @@ import { z } from "zod";
import { javaScriptRuntime } from "../../domain/runtimeVersion.js";
import { javaScriptWorkerMemoryLimitBytes } from "../../process/JavaScriptWorkerMemoryLimit.js";
import { webSourceOffset } from "../../domain/webSourcePosition.js";
import { resolveJavaScriptSourceMapUrl } from "../../domain/javascript/javascriptSourceMapPaths.js";
import {
webSourceMapReportSchema,
type WebSourceMapReport,
@@ -68,7 +69,7 @@ export const traceSourceMap = (
let bytes = 0;
const matches: WebSourceMapReport["matches"] = [];
for (const segment of segments) {
const match = originalMatch(segment, map, inspected.declarations);
const match = originalMatch(segment, map, url, inspected.declarations);
bytes += Buffer.byteLength(JSON.stringify(match)) + 1;
if (bytes > WEB_SOURCE_MAP_LIMITS.outputBytes)
throw new SourceMapFormatFailure(
@@ -158,6 +159,7 @@ const greatestPosition = (
const originalMatch = (
segment: Readonly<SourceMapSegment>,
map: TraceMap,
mapUrl: string,
declarations: readonly SourceMapSourceDeclaration[],
): WebSourceMapReport["matches"][number] => {
if (segment.length === 1) return { state: "generated-only" };
@@ -179,10 +181,11 @@ const originalMatch = (
source_index: declaration.sourceIndex,
reported_source: declaration.source,
reported_source_root: declaration.root,
resolved_url:
declaration.source === null
? null
: (map.resolvedSources[segment[1]] ?? null),
resolved_url: resolveJavaScriptSourceMapUrl(
declaration.source,
declaration.root,
mapUrl,
),
ignored: declaration.ignored,
content:
declaration.content === null