Repository navigation
Description
Found by an adversarial audit of the #58 L0–L3 equivalence claims, against the #65 stack head 2fe14465f. Counterexample to the #63 claim that "a module compiled under target: 'lynx' renders a first-screen batch deep-equal to the target: 'universal' encoding".
Root cause
The two encodings observe prop values at different points in the render walk.
- The template lowering emits every
env.p/env.ecall for a host before that host's child statements —lynxTemplateCreateStatementsAstinpackages/octane/src/compiler/compile-universal.jsruns the props loop, then the bindings loop, then recurses into children.TEMPLATE_ENV.pvalidates the value on assignment atpackages/lynx/src/main-renderer.ts:715. renderPlanNodedoes the opposite: it materializes all children first (packages/lynx/src/main-renderer.ts:803-809) and only then callshostNode, whose prop scan atpackages/lynx/src/main-renderer.ts:650is therefore the last thing to run for that subtree.
So when more than one prop value in a subtree can throw, the two encodings surface a different exception. Under a @try/@catch boundary the throw is recovered, so both renders succeed and simply paint different screens. This is not an error path.
Reproduction
Committed as a red test on claude/octane-issue-58-adversarial-audit (f70f46aa3):
packages/octane/tests/lynx-target-template-equivalence.test.ts → paints the same caught error when a prop value throws
export function Scene(props: { outer: unknown; inner: unknown }) @{
<view class="page">
@try {
<view class="risky" data-outer={props.outer}>
<text class="inner" data-inner={props.inner}>{'inner'}</text>
</view>
} @catch (error) {
<text class="fallback">{error.message as string}</text>
}
</view>
}with two ordinary consumer objects whose property read throws:
AssertionError: expected [ 'outer prop exploded' ] to deeply equal [ 'inner prop exploded' ]
A second observation from the same mechanism: with a component subtree inside the boundary, the child renders zero times under the template encoding and twice under the plan encoding ({count:0,text:["rendered=0"]} vs {count:2,text:["rendered=2"]}), both at hostCount: 3.
Why this is reachable
data-* is an allowlisted wildcard on the renderer's own intrinsics, so this needs no custom element and no augmentation — plain <view>/<text> and ordinary consumer objects.
Consumer impact
An app with an error boundary that renders error.message paints different text depending only on which compiler target built the module — in one case the framework's own internal diagnostic string. Side-effect counts inside the boundary differ too. Because adoption identity is positional, the background thread then adopts against a tree it did not produce.
Notes for the fix
The committed test asserts only that the two encodings agree; it does not pin either one's behavior, so either direction of fix (validate props after children on the template path, or before children on the plan path) turns it green. Picking which order is canonical is the design decision here.
Verification performed
Reproduced independently of the finding agent, with a fixture reduced to pure consumer code (no createLynxNativeResource). Adversarial refuter panel had not yet adjudicated this candidate at time of filing.
Activity
Huxpro commentedon Aug 18, 2026
Sharper manifestations of the same root cause — including a different
@tryarmFurther audit lenses found three consequences of the evaluation-order inversion reported above. Same mechanism, no new root cause, but the consumer impact is considerably worse than the error-text case originally filed. All executed.
1. The two encodings commit different
@tryarmsThe template path validates the parent's prop before rendering children, so the throw beats the suspension and
@catchwins. The plan path renders children first, souse()suspends and@pendingwins. Same source, same props — a different branch of the user's own error boundary, with the framework's internal diagnostic string painted as visible text.This reproduces identically across all five compile modes —
prod,hmr-vite,hmr-webpack,dev,profile— so it is not a dev-only or HMR-only artifact.2. The application's own error is masked, and its subtree never renders
Where the app itself throws during render,
target: 'lynx'replaces the app's error with the framework's native-resourceTypeError, because the child component is never invoked. An instrumented counter giveschildRenders=0under the template encoding vschildRenders=1under the plan encoding, while both produce a 3-host first screen — so the app keeps running and the loss is silent.Two consequences worth separating:
@catchboundary or a crash reporter is the framework's diagnostic, not the thrown application error, so the real bug is invisible.use()/useBatchprefetch registration, whichdocs/differences-from-react.mddocuments as deliberately eager in Octane. Undertarget: 'lynx'those fetches simply never start.3. The native-resource diagnostic blames a different element
With a native resource on both a parent and a descendant, the template encoding reports
data-outeron<view>(parent, validated first); the plan encoding reportsdata-inneron<text>(deepest child, rendered first). A developer fixing the reported element under one target finds the error moves rather than clears.The landed suite only ever places a native resource on a single node, so it cannot observe this.
Why this raises the severity
The original report framed the impact as different
error.messagetext. The arm flip is categorically worse: it is a different rendered branch of the user's own error boundary, and it means the first screen the background thread adopts against is a tree the user should never have seen. Combined with the skipped prefetch registration, the ordering inversion changes what work happens, not just what error surfaces.The fix direction is unchanged — decide which order is canonical and make both encodings observe prop values at the same point. The committed red test (
packages/octane/tests/lynx-target-template-equivalence.test.ts) still asserts only that the two agree, so it does not constrain that choice.Generated by Claude Code
Huxpro commentedon Aug 18, 2026
Correction: my fixture is weaker than I described, and the batch does not diverge for pure programs
Multiple refuters attacked this from different angles. The mechanism stands, but two things I said about it are wrong, and one of them is in the committed red test.
1. My "pure consumer code" fixture is not pure
The committed test
paints the same caught error when a prop value throwsuses:$$kindis the propertyisLynxNativeResourcereads (packages/lynx/src/resource.ts:22). So the throw fires inside the framework's own validation predicate — the object is impersonating the internal resource brand. I described this in the commit message and in this issue as "two ordinary consumer objects whose property read throws" and as "pure consumer code, nocreateLynxNativeResource." That was inaccurate: an app does not define$$kind.2. No app-authored throw can diverge
A refuter ran the decisive control (R4): two ordinary app errors thrown from the prop expressions —
data-bad={props.f()},data-worse={props.g()}— MATCH on both encodings ("outer expr" on both). Slot values are evaluated up-front in identical source order on both paths.So only the framework's own post-hoc validation checkpoint can diverge, and only after the app has already committed two independent violations of a rule the framework loudly refuses, at different depths. Everything narrower is exact parity, executed: single outer fault MATCH, single inner fault MATCH, single deep fault +
@catchMATCH, two faults on the same host MATCH, two faults in sibling subtrees MATCH, zero faults MATCH.3. The batch itself never diverges for a pure program
Probe D3 is my exact fixture with one change — the
@catchbody paints a constant instead oferror.message:With pure children the entire surface matches: painted text,
hostCount5,logicalCount7, and the whole host batch. So the "silently different painted screen" is the app choosing to render the framework's internal diagnostic string into a text node, not a structural divergence.The
childRenders=0 vs 1sub-case is likewise measured through an impure render (a counter mutated during render and read back during render), which.rulesync/rules/testing.mdexplicitly excludes as an oracle.4. Both orderings already coexist inside
target: 'lynx'Compiling the same fixture twice, both under
target: 'lynx', differing only by an unrelatedrefon the risky view (which tripslynxTemplateEligibleso that plan keeps the interpreted encoding): the ref-bearing lynx build matchesuniversalexactly. Both orderings therefore already ship side by side in everytarget: 'lynx'app and have since L1 — which is documented behaviour (§8: "eligible host-only templates emit create functions … and ineligible plans keep the interpreted encoding").That also means pinning this ordering would freeze
lynxTemplateEligible: admittingref-bearing hosts into templates — an obvious future slice — would break the test while changing nothing a consumer sees.What still stands
The
@tryarm flip is the stronger evidence and is not addressed by the above. Using a realcreateLynxNativeResource(not a forged brand) plus a real suspendinguse(), the two encodings commit different arms —@catchversus@pending— and both renders succeed:Identical across all five compile modes. That is a structural divergence in which branch commits, not a difference in which of two violations gets named — but it still requires a native resource on a prop, which the framework refuses on both paths, so it sits behind the same "app already violated a loud rule" precondition.
Revised severity
Downgrade from "different rendered branch of the user's error boundary" to: a real ordering difference in framework-internal validation, observable only when an app commits two simultaneous violations of a background-only-resource rule at different depths, or one such violation racing a suspension. Both paths reject the same programs with the same error class; what differs is which violation is named and how much abandoned work ran.
The committed red test should be re-cut against the arm-flip fixture with a real native resource, or dropped — its current
$$kindfixture does not represent a consumer program, and I should not have described it as one.I had this ranked first in my triage. On this evidence it belongs below #84, #90, and #81.
Generated by Claude Code
Huxpro commentedon Aug 18, 2026
Red test re-cut —
72482a268Acting on the correction above rather than leaving it as a recommendation.
packages/octane/tests/lynx-target-template-equivalence.test.tsno longer uses the{ get $$kind() { throw } }fixture. It now pins the arm-selection case, which is the part of this finding that survived scrutiny:A
@trybody whose parent carries a realcreateLynxNativeResourceand whose child suspends onuse(). The two outcomes are mutually exclusive, both renders succeed, and the encodings commit different arms. That is a difference in what gets painted on a renderable program — not a difference in which of two simultaneous rule violations gets named, which is all the previous fixture measured.The custom-element
__proto__case in the same file is unchanged.Validation:
pnpm format:filesclean,pnpm typecheck:filesshows only the pre-existingTS7016oncompile.jsthat the committed sibling suite also reports,pnpm syncno drift, both tests confirmed red.The severity revision stands — this belongs below #84, #90, and #81 in the triage, and it remains gated behind the app having already placed a background-only resource on a prop.
Generated by Claude Code