feat(browser): trace captured website source-map locations (#897)
* refactor(browser): share captured-script acquisition boundaries Reuse stable capture/source acquisition and identity validation for module and source-map analysis. Preserve host I/O, malformed input, unavailable source and digest mismatch diagnostics. Refs #851 Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * feat(browser): trace captured website source-map locations Refs #851. Preserve selected capture/map byte identity, duplicate mappings and embedded source evidence through the pinned upstream codec. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * test(browser): verify source-map artifacts and synchronize generated contracts Cover byte-preserving map reads and actionable filesystem constraints. Refresh generated public schemas and metadata on current main. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * fix(browser): preserve inert source-map URL context The selected URL is local codec context and grants no transport authority. Preserve its reported text and verify normal/userinfo contexts through real public interfaces, alongside independent manifest byte identity. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import type { WebSourceLocationArtifacts } from "../../src/application/WebSourceLocationPorts.js";
|
||||
import { webModuleArtifactsFixture } from "./webModuleTrace.js";
|
||||
import { traceSourceMap } from "../../src/javascript/sourceMaps/TraceSourceMap.js";
|
||||
import type { WebSourceMapPort } from "../../src/application/WebSourceLocationPorts.js";
|
||||
import { ok } from "../../src/domain/result.js";
|
||||
|
||||
/** Inert codec seam for workflow tests; real process verification is separate. */
|
||||
export const webSourceMapDecoderFixture: WebSourceMapPort = {
|
||||
trace: (input) =>
|
||||
Promise.resolve(ok(traceSourceMap(input.text, input.url, input.position))),
|
||||
};
|
||||
|
||||
/** Source-owned map fixture with independent byte identity and retained capture context. */
|
||||
export const webSourceLocationFixture = (
|
||||
text = JSON.stringify({
|
||||
version: 3,
|
||||
sources: ["original.ts"],
|
||||
sourcesContent: ["original"],
|
||||
names: [],
|
||||
mappings: "AAAA",
|
||||
}),
|
||||
): WebSourceLocationArtifacts => {
|
||||
const { importMap: _importMap, ...script } =
|
||||
webModuleArtifactsFixture("generated");
|
||||
return {
|
||||
...script,
|
||||
sourceMap: {
|
||||
file: {
|
||||
path: "/analysis/app.js.map",
|
||||
sha256: createHash("sha256").update(text).digest("hex"),
|
||||
bytes: Buffer.byteLength(text),
|
||||
},
|
||||
url: "https://app.test/app.js.map?v=1#context",
|
||||
text,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/** Explicit fixture pairing; no capture authenticity or execution is asserted. */
|
||||
export const webSourceLocationArgs = {
|
||||
manifest_path: "/analysis/manifest.json",
|
||||
script_index: 0,
|
||||
source_map: {
|
||||
path: "/analysis/app.js.map",
|
||||
url: "https://app.test/app.js.map?v=1#context",
|
||||
},
|
||||
generated_position: { line: 1, column: 0 },
|
||||
};
|
||||
Reference in New Issue
Block a user