Skip to content

target 'lynx' template lowering collapses per-element source-map origins to the plan root #79

Open

Description

@Huxpro

Found by an adversarial audit of the #58 L0–L3 equivalence claims, against the #65 stack head 2fe14465f. Distinct root cause from #70 and #71.

Root cause

jsonValueToAst (packages/octane/src/compiler/compile-universal.js:449-451) reads each plan sub-node's PLAN_ORIGIN and attaches a per-node origin, so the interpreted plan encoding carries one source position per element.

lynxTemplateCreateStatementsAst (packages/octane/src/compiler/compile-universal.js:3967) takes a single origin parameter from lynxTemplateObjectAst and passes that same value to every lynxEnvCallAst/b.const it emits. It never reads node[PLAN_ORIGIN]. Every statement in the generated create() therefore maps back to the plan root's location.

Observed

For a component whose JSX spans authored lines 3–9, the entire create() body under target: 'lynx' decodes to only lines 3 and 9. Authored lines 4, 5, 6, 7 and 8 — four distinct JSX elements — have no source-map entry anywhere in the plan region. The same module under target: 'universal' retains a position per element.

OCTANE_COMPILE_ASSERT_LOC still passes, because every emitted node does carry an origin — it is simply the wrong, coarse one. The existing assertion checks presence, not granularity, so nothing currently catches this.

Consumer impact

A Lynx developer who hits a throw inside create() — for example the first-screen native-resource TypeError, which #70 shows is thrown from exactly these emitted statements — gets a stack frame that source-maps to the component's root element rather than the offending child.

The repo's own comment on assertNodeLocs calls per-node origins "the basis for trustworthy source maps and playground source-to-output navigation." The lynx target silently opts out of that for every host element inside an eligible template, which is precisely the hot path #63 makes the default.

This also compounds #70 item 3: the diagnostic already blames a different element under the two encodings, and under target: 'lynx' the source map cannot point at the right one either.

Suggested direction

Thread node[PLAN_ORIGIN] through lynxTemplateCreateStatementsAst per node, the way jsonValueToAst already does, rather than passing one plan-level origin down the whole recursion. If a granularity assertion is wanted, OCTANE_COMPILE_ASSERT_LOC would need to compare emitted positions against the authored element positions rather than only asserting an origin exists.

Related

Verification performed

Executed by the finding agent with source-map decoding across the compile-mode matrix. No red test is committed for this: source-map granularity is a compiler artifact rather than an equivalence counterexample, and the audit branch is scoped to the latter. Adversarial refuter panel had not adjudicated this candidate at time of filing.

Activity

  1. added
    bug
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions