Skip to content

feat(v0.44): emit real Source Map v3 mappings with exact line/column provenance (#1210) - #1252

Merged
SisyphusZheng merged 1 commit into
devfrom
v044/a10.2-source-maps
Sep 2, 2026
Merged

feat(v0.44): emit real Source Map v3 mappings with exact line/column provenance (#1210)#1252
SisyphusZheng merged 1 commit into
devfrom
v044/a10.2-source-maps

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

Problem

Issue #1210 (umbrella #1155, Alpha.10). Two invalid map stories coexisted: an inline map with mappings: '' + x_openElement metadata (compile.ts), and a naive VLQ builder using trimmed line-text equality — first match wins, line-granularity only, no columns, duplicate source lines mis-mapped (plugin.ts).

Owner

Compiler semantic core owns original spans + generated emission provenance (new semantic-core/source-map.ts, Vite/Rollup-free per ADR-0148); the Vite shell owns composition (open:core returns the real map object as the single composition input; inline comment stripped at the boundary — one map story).

Before

mappings: '' + custom metadata; or line-text-equality guessing.

After

Real Source Map v3 segments with line/column fidelity derived from ProgramSourceMap records and per-line emission provenance. x_openElement retained as supplementary metadata only.

Why this is not a second semantic owner

One emitter, one composition handoff; the naive second emitter is deleted.

Evidence

  • New compiler-source-map-v3.test.ts: 9 consumer-based tests via @jridgewell/trace-mapping (already in deno.lock — no new dependency). Every program.sourceMap.records entry resolves via originalPositionFor to its authored file/line/column; the mandatory duplicate-location fixture (two byte-identical generated event-handler lines) maps to two distinct authored positions; diagnostics keep authored positions.
  • RED at base SHA: CompileElementResult.map did not exist (10 type errors); GREEN after.
  • Gates all exit 0: adapter-vite suite 739 passed; fmt/lint/typecheck/arch/freeze-semantics/package-surface/interface:snapshot/docs:truth; full deno task test (1639 + 150, 0 failed).
  • Emitted module text byte-identical except the map comment (fixture byte-identity tests pass).
  • Fresh kimi-code/k3-256k HIGH implementer session; orchestrator re-ran the consumer test file independently (9/9 green).

Scope / non-goals

No spec extensions; no snapshot-equality-only evidence; segment granularity is construct-start (not intra-line expression-level for JSON payloads) — recorded as residual.

Risk

Dev/HMR map pipeline output changes shape (real maps now); green e2e/island-delivery suites cover the boundary. Rollback: revert.

…provenance (#1210)

Alpha.10 truth closure: the compiler emitted a map object with
mappings:'' plus x_openElement metadata, and the Vite layer built VLQ
mappings by trimmed line-text equality (first match wins, no columns,
duplicate lines mis-mapped).

- new semantic-core/source-map.ts: base64-VLQ segment builder owned by
  the bundler-neutral core (ADR-0148), x_openElement demoted to
  supplementary metadata
- compile.ts records per-line emission provenance: verbatim blocks map
  line/column-exact; synthesized lines map to authored AST node starts;
  embedded program records map to authored spans
- open:core returns the real map object as the single Vite composition
  input; the inline-comment substitute is stripped at the boundary
- consumer-based tests via @jridgewell/trace-mapping (already in
  deno.lock): every program source record resolves to its authored
  file/line/column; byte-identical generated handler lines map to
  distinct authored positions; diagnostics keep authored positions

Implemented by fresh kimi-code/k3-256k HIGH session
(.agents/v044-kimi-implementer.md), packet A10.2. No frozen paths, no
new dependencies, no publish, no tag.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5b636f5
Status: ✅  Deploy successful!
Preview URL: https://c4b5efbe.lessjs.pages.dev
Branch Preview URL: https://v044-a10-2-source-maps.lessjs.pages.dev

View logs

@SisyphusZheng
SisyphusZheng merged commit eda7710 into dev Sep 2, 2026
9 checks passed
@SisyphusZheng
SisyphusZheng deleted the v044/a10.2-source-maps branch September 3, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant