[PR #1109] [MERGED] fix(browser): compose nested source-map column offsets #2657

Closed
opened 2026-10-17 21:08:42 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1109
Author: @rudycelekli
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @N0zoM1z0

Base: main ← Head: validation/browser-nested-source-map-coordinates-20261008


📝 Commits (5)

  • e550d74 test(browser): verify native nested source-map coordinates
  • 5c6f874 test(browser): retain native source-map failure receipts
  • d630d99 Merge branch 'main' into validation/browser-nested-source-map-coordinates-20261008
  • f944626 test(browser): preserve nested source-map boundary contracts
  • e94c518 fix(browser): compose nested source-map column offsets

📊 Changes

6 files changed (+688 additions, -11 deletions)

View changed files

📝 docs/web-source-location.md (+7 -0)
📝 scripts/fixtures/browser-source-map-site.mjs (+31 -8)
➕ scripts/lib/browser-nested-source-map-e2e.mjs (+238 -0)
📝 scripts/verify-browser-source-maps.mjs (+3 -1)
📝 src/browser/WebSourceMapFetcher.ts (+49 -2)
➕ tests/boundary/browser/webSourceMapNestedCoordinates.test.ts (+360 -0)

📄 Description

Summary

Correct browser source locations from valid nested indexed source maps whose child starts on a later generated line. This focused bug fix has no linked issue; the executed compiler/browser/CLI regression below establishes the defect.

Problem and expected behavior

With an enclosing section at column 10 and a nested child on a later line at column 0, upstream flattening incorrectly retains column 10. ECMA-426 section-offset composition applies the enclosing column only when the child starts on the enclosing first line. Actual browser bundle analysis therefore returned displaced generated locations for valid compiler output.

Change and scope

Normalize indexed sections into absolute leaf offsets at the browser boundary before AnyMap. Retain empty parent boundary markers so gaps and empty indexed siblings preserve existing clipping behavior. Ordinary maps and leaf source/name/content identities remain intact. Document the browser coordinate contract. The dedicated source-map decoder already composes these offsets correctly and is unchanged. No dependencies or workflows change.

Contract and boundary impact

  • Semantic owner and earliest changed stage: browser source-map flattening in WebSourceMapFetcher.
  • CLI and MCP/tool-catalog contract: existing schemas and catalog unchanged; mapped locations become correct.
  • Provider, target-format, or platform compatibility: browser indexed source maps; ordinary leaf maps preserved.
  • Evidence and provenance: original fetched map text, byte counts and digests preserved.
  • Process execution, authorization and cleanup: existing browser lifecycle and fetch budgets preserved.
  • Generated metadata, package or installation impact: none.

Evidence and regression coverage

  • Four native owners wrap actual esbuild output in nested maps, run owned Chrome and the built public analyze-web-bundle CLI, and verify 14 mapping points each. Independent expected positions use ordinary compiler-leaf TraceMap and physical UTF-16 offsets in the complete generated text; they do not use AnyMap or a production nested-offset helper.

  • Current tests-only native BEFORE, head f9446261d9e8f96f3659935fdff8e14f5a93ca97: exactly two later-line public-map assertion failures; same-line and zero-outer-column controls pass. Compiler, browser and dedicated-decoder admission succeed first. Phase, source/map/generated digests, versions and first mismatched location are retained. esbuild 0.25.10 and Chrome 154.0.8037.97 actually ran.

  • Current boundary BEFORE: one affected browser-consumer failure and seven passing controls, zero retries. Expected [7, 0, a.ts] was observed as [7, 10, a.ts]. Controls cover ordinary leaves, same-line composition, sibling clipping, nested gaps, empty parents, depth-three composition and inherited stops. Clipping controls preserve existing best-effort behavior; they are not strict-valid-map claims.

  • Native AFTER, exact signed head e94c518fa03aa6ab84b82a3ffd0e968928208555: all four native owners pass, with unchanged frozen inputs, 14 points each, and all original compiler/CLI/MCP verifier cases passing.

  • Full AFTER CI, same exact head: all eight frozen boundary owners pass with zero retries; aggregate 5,217 passed, zero failed, 71 skipped (5,288 total); all 22 jobs succeed, including static checks, generated docs, build, all shards and native package lanes. Separate real-browser verification also succeeds.

  • Publication main 7914e36ab9adbbf591a6e1f3fafcb2e17f55d667 has byte-identical owning source and docs to the qualified base. The current six-file diff contains only this reviewed fix, owning documentation and regression fixtures/tests. Fresh policy and all open-PR file checks found no overlap. Upstream integration checks now also pass: all 24 exact-head checks succeed at e94c518fa03aa6ab84b82a3ffd0e968928208555; maintainer approval is recorded.

  • First immutable tests-only failure receipts are preserved. A later tests-only logging follow-up added only phase/proof serialization; scenario inputs and assertions remained unchanged.

  • Remaining proof gaps: new owners ran on the native Linux browser lane, not Windows; no new Windows owner claim. No real Hopper/Ghidra verification, because those providers are unaffected.

  • Observed and derived claims remain distinguishable.

  • Artifact identity, source provenance and failed attempts remain preserved.

  • Unverified platform coverage remains explicit.

Validation performed

Executed unchanged native workflows linked above: required real website source-map verification, real-browser verification, full static/build/docs and deterministic CI. Their exact-head reports and artifact digests are retained. No local substitute is claimed as native proof.

Compatibility, safety, and release

Compatible correction; no migration, catalog, package or release metadata change. Synthetic compiler fixtures only, no private data or credentials. Actual browser cleanup remains owned by the existing lifecycle helper. AI assistance was used for investigation, implementation and verification.

Review checklist

  • One focused outcome and conventional title.
  • Reason for no linked issue stated above.
  • Observable regression and meaningful controls covered.
  • Owning documentation updated.
  • Public CLI evidence includes displaced/corrected coordinates.
  • Final diff checked for unrelated changes, secrets and unsupported claims.

Signed-off-by: Rudy Celekli rudy@gradiahq.com


🔄 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/1109 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `validation/browser-nested-source-map-coordinates-20261008` --- ### 📝 Commits (5) - [`e550d74`](https://github.com/morluto/rea/commit/e550d745e7dc53c9be912cdef2492373c6937760) test(browser): verify native nested source-map coordinates - [`5c6f874`](https://github.com/morluto/rea/commit/5c6f8744d083c5ec158f42bda2215c0af1cb3d82) test(browser): retain native source-map failure receipts - [`d630d99`](https://github.com/morluto/rea/commit/d630d99b9f91daae60b3c8da3f186d825ee03a82) Merge branch 'main' into validation/browser-nested-source-map-coordinates-20261008 - [`f944626`](https://github.com/morluto/rea/commit/f9446261d9e8f96f3659935fdff8e14f5a93ca97) test(browser): preserve nested source-map boundary contracts - [`e94c518`](https://github.com/morluto/rea/commit/e94c518fa03aa6ab84b82a3ffd0e968928208555) fix(browser): compose nested source-map column offsets ### 📊 Changes **6 files changed** (+688 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/web-source-location.md` (+7 -0) 📝 `scripts/fixtures/browser-source-map-site.mjs` (+31 -8) ➕ `scripts/lib/browser-nested-source-map-e2e.mjs` (+238 -0) 📝 `scripts/verify-browser-source-maps.mjs` (+3 -1) 📝 `src/browser/WebSourceMapFetcher.ts` (+49 -2) ➕ `tests/boundary/browser/webSourceMapNestedCoordinates.test.ts` (+360 -0) </details> ### 📄 Description ## Summary Correct browser source locations from valid nested indexed source maps whose child starts on a later generated line. This focused bug fix has no linked issue; the executed compiler/browser/CLI regression below establishes the defect. ## Problem and expected behavior With an enclosing section at column 10 and a nested child on a later line at column 0, upstream flattening incorrectly retains column 10. ECMA-426 section-offset composition applies the enclosing column only when the child starts on the enclosing first line. Actual browser bundle analysis therefore returned displaced generated locations for valid compiler output. ## Change and scope Normalize indexed sections into absolute leaf offsets at the browser boundary before `AnyMap`. Retain empty parent boundary markers so gaps and empty indexed siblings preserve existing clipping behavior. Ordinary maps and leaf source/name/content identities remain intact. Document the browser coordinate contract. The dedicated source-map decoder already composes these offsets correctly and is unchanged. No dependencies or workflows change. ## Contract and boundary impact - Semantic owner and earliest changed stage: browser source-map flattening in `WebSourceMapFetcher`. - CLI and MCP/tool-catalog contract: existing schemas and catalog unchanged; mapped locations become correct. - Provider, target-format, or platform compatibility: browser indexed source maps; ordinary leaf maps preserved. - Evidence and provenance: original fetched map text, byte counts and digests preserved. - Process execution, authorization and cleanup: existing browser lifecycle and fetch budgets preserved. - Generated metadata, package or installation impact: none. ## Evidence and regression coverage - Four native owners wrap actual esbuild output in nested maps, run owned Chrome and the built public `analyze-web-bundle` CLI, and verify 14 mapping points each. Independent expected positions use ordinary compiler-leaf `TraceMap` and physical UTF-16 offsets in the complete generated text; they do not use `AnyMap` or a production nested-offset helper. - [Current tests-only native BEFORE](https://github.com/rudycelekli/rea/actions/runs/37815114142), head `f9446261d9e8f96f3659935fdff8e14f5a93ca97`: exactly two later-line public-map assertion failures; same-line and zero-outer-column controls pass. Compiler, browser and dedicated-decoder admission succeed first. Phase, source/map/generated digests, versions and first mismatched location are retained. esbuild 0.25.10 and Chrome 154.0.8037.97 actually ran. - [Current boundary BEFORE](https://github.com/rudycelekli/rea/actions/runs/37815114382): one affected browser-consumer failure and seven passing controls, zero retries. Expected `[7, 0, a.ts]` was observed as `[7, 10, a.ts]`. Controls cover ordinary leaves, same-line composition, sibling clipping, nested gaps, empty parents, depth-three composition and inherited stops. Clipping controls preserve existing best-effort behavior; they are not strict-valid-map claims. - [Native AFTER](https://github.com/rudycelekli/rea/actions/runs/37817004821), exact signed head `e94c518fa03aa6ab84b82a3ffd0e968928208555`: all four native owners pass, with unchanged frozen inputs, 14 points each, and all original compiler/CLI/MCP verifier cases passing. - [Full AFTER CI](https://github.com/rudycelekli/rea/actions/runs/37817004814), same exact head: all eight frozen boundary owners pass with zero retries; aggregate 5,217 passed, zero failed, 71 skipped (5,288 total); all 22 jobs succeed, including static checks, generated docs, build, all shards and native package lanes. [Separate real-browser verification](https://github.com/rudycelekli/rea/actions/runs/37817004955) also succeeds. - Publication main `7914e36ab9adbbf591a6e1f3fafcb2e17f55d667` has byte-identical owning source and docs to the qualified base. The current six-file diff contains only this reviewed fix, owning documentation and regression fixtures/tests. Fresh policy and all open-PR file checks found no overlap. [Upstream integration checks](https://github.com/morluto/rea/pull/1109/checks) now also pass: all 24 exact-head checks succeed at `e94c518fa03aa6ab84b82a3ffd0e968928208555`; maintainer approval is recorded. - First immutable tests-only failure receipts are preserved. A later tests-only logging follow-up added only phase/proof serialization; scenario inputs and assertions remained unchanged. - Remaining proof gaps: new owners ran on the native Linux browser lane, not Windows; no new Windows owner claim. No real Hopper/Ghidra verification, because those providers are unaffected. - [x] Observed and derived claims remain distinguishable. - [x] Artifact identity, source provenance and failed attempts remain preserved. - [x] Unverified platform coverage remains explicit. ## Validation performed Executed unchanged native workflows linked above: required real website source-map verification, real-browser verification, full static/build/docs and deterministic CI. Their exact-head reports and artifact digests are retained. No local substitute is claimed as native proof. ## Compatibility, safety, and release Compatible correction; no migration, catalog, package or release metadata change. Synthetic compiler fixtures only, no private data or credentials. Actual browser cleanup remains owned by the existing lifecycle helper. AI assistance was used for investigation, implementation and verification. ## Review checklist - [x] One focused outcome and conventional title. - [x] Reason for no linked issue stated above. - [x] Observable regression and meaningful controls covered. - [x] Owning documentation updated. - [x] Public CLI evidence includes displaced/corrected coordinates. - [x] Final diff checked for unrelated changes, secrets and unsupported claims. Signed-off-by: Rudy Celekli <rudy@gradiahq.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:08:42 +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#2657
No description provided.