[GH-ISSUE #851] [Feature] Trace website module resolution with URL identities and captured-source evidence #356

Closed
opened 2026-10-15 18:24:14 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @N0zoM1z0 on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/851

Analyst outcome

Trace browser module specifiers to their URL identities and available captured script bytes, without turning HTTP paths into host filesystem paths or refetching changed assets.

Refs #774; follows recovery adapter #827 / #848.

Existing boundary and gap

export_web_scripts preserves exact retained bytes, URL variants and a manifest. Its local analysis_input intentionally does not claim browser import-map, root-relative, remote URL, query/fragment or lazy-module semantics. Existing JavaScript parsing/graphs and static/runtime reconciliation should be reused.

Delivery

  • A shared CLI/MCP inspection/trace primitive for explicitly selected module relationships and capture manifests. Keep resolution, source extraction and artifact identity in separate responsibilities behind typed ports; no second browser controller or custom execution language.
  • Retain the raw specifier, reported source URL, caller-selected importer/import-map base URL, import-map identity/diagnostics, source location and resolution result. Distinguish static inference under a selected map from browser-observed module loading or execution.
  • Resolve relative/root-relative/absolute URLs and bare/prefix/scoped import maps with a pinned mature upstream where it meets the browser contract. Verify its behavior first; older implementations can mishandle null entries or prefix backtracking. Do not silently emulate Node package resolution.
  • Bind candidate targets to exact captured source/file digests. Keep query/fragment module identities, source-vs-response representations, collisions and absent/lazy targets explicit; no guessed module identity from a response URL with a fragment removed.
  • Preserve literal dynamic-import relationships and unknown computed imports. Reuse existing parser seams rather than add regex parsing.
  • Join generated/original source-map evidence only when actual map bytes are available, with exact artifact identity. Missing maps remain unavailable; fetching requires a separately selected operation.

Verification

Focused input/result/port/identity and malformed/ambiguous/blocked-map tests, SDK schema validation and CLI/MCP parity. Real Chrome local fixtures compare native import.meta.resolve and actual module loading for scopes, null blocking, prefix backtracking, root/remote paths, query/fragment variants and missing/lazy content. Extend the existing conditional real-browser CI lane for the relevant paths. Verify the packaged artifact when public composition changes; no global browser/toolchain installation.

References

Originally created by @N0zoM1z0 on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/851 ## Analyst outcome Trace browser module specifiers to their URL identities and available captured script bytes, without turning HTTP paths into host filesystem paths or refetching changed assets. Refs #774; follows recovery adapter #827 / #848. ## Existing boundary and gap `export_web_scripts` preserves exact retained bytes, URL variants and a manifest. Its local `analysis_input` intentionally does not claim browser import-map, root-relative, remote URL, query/fragment or lazy-module semantics. Existing JavaScript parsing/graphs and static/runtime reconciliation should be reused. ## Delivery - A shared CLI/MCP inspection/trace primitive for explicitly selected module relationships and capture manifests. Keep resolution, source extraction and artifact identity in separate responsibilities behind typed ports; no second browser controller or custom execution language. - Retain the raw specifier, reported source URL, caller-selected importer/import-map base URL, import-map identity/diagnostics, source location and resolution result. Distinguish static inference under a selected map from browser-observed module loading or execution. - Resolve relative/root-relative/absolute URLs and bare/prefix/scoped import maps with a pinned mature upstream where it meets the browser contract. Verify its behavior first; older implementations can mishandle null entries or prefix backtracking. Do not silently emulate Node package resolution. - Bind candidate targets to exact captured source/file digests. Keep query/fragment module identities, source-vs-response representations, collisions and absent/lazy targets explicit; no guessed module identity from a response URL with a fragment removed. - Preserve literal dynamic-import relationships and unknown computed imports. Reuse existing parser seams rather than add regex parsing. - Join generated/original source-map evidence only when actual map bytes are available, with exact artifact identity. Missing maps remain unavailable; fetching requires a separately selected operation. ## Verification Focused input/result/port/identity and malformed/ambiguous/blocked-map tests, SDK schema validation and CLI/MCP parity. Real Chrome local fixtures compare native `import.meta.resolve` and actual module loading for scopes, null blocking, prefix backtracking, root/remote paths, query/fragment variants and missing/lazy content. Extend the existing conditional real-browser CI lane for the relevant paths. Verify the packaged artifact when public composition changes; no global browser/toolchain installation. ## References - [HTML module specifier resolution](https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier) - [Open WC import-map resolver](https://github.com/open-wc/open-wc/tree/master/packages/import-maps-resolve) (MIT; candidate, not yet admitted as equivalent) - [JSPM low-level import-map library](https://jspm.org/docs/import-map/) (Apache-2.0; candidate) - [ES Module Shims](https://github.com/guybedford/es-module-shims) (MIT; candidate)
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#356
No description provided.