Skip to content

Event props accepted by the glob but rejected by the regex silently lose their handler and leak a renderer Symbol into the wire props #77

Open

Description

@Huxpro

Found by an adversarial audit of the #58 L0–L3 equivalence claims, against the #65 stack head 2fe14465f.

Pre-existing, not a regression from the stack. Both the lynx and universal encodings behave identically here, so this is not a counterexample to #63 — it is a defect in the shared first-screen path that the audit surfaced while probing that claim.

Root cause: two different classifiers decide "is this an event prop"

  1. The compiler erases first-screen event callbacks using the renderer's glob list firstScreenEvents (bind*, catch*, capture-bind*, …) — packages/lynx/src/config.ts.
  2. lynxTemplateSlotKinds and lynxTemplateCreateStatementsAst classify the same prop with the regex LYNX_EVENT_PROP at packages/octane/src/compiler/compile-universal.js:3918, which additionally requires [A-Za-z]+ after the prefix. The renderer's eventPriority uses the same regex (packages/lynx/src/main-renderer.ts:625).

Names like bind-tap, catch-tap, and bind1 match the glob and fail the regex. The callback is erased to the FIRST_SCREEN_EVENT sentinel Symbol by (1), then treated as an ordinary prop by (2), so the Symbol is written straight into the host props bag and no event is ever installed.

Reproduction

Executed, <view class="page" NAME={props.onTap} /> compiled under both targets:

bindtap    slots=["e:bindtap"]   symbolProps=0  eventCmds=1   <- correct
bind-tap   slots=["p:bind-tap"]  symbolProps=1  eventCmds=0
bind1      slots=["p:bind1"]     symbolProps=1  eventCmds=0
catch-tap  slots=["p:catch-tap"] symbolProps=1  eventCmds=0

Identical on target: 'lynx' and target: 'universal'. Note JSON.stringify omits Symbol values, so the create command's props look clean in a serialized dump — symbolProps counts the own properties whose value is a Symbol.

Consumer impact

<view bind-tap={handler}> compiles with no diagnostic — the renderer's own hostProps allowlist admits it through the bind* glob — and then the handler silently never fires. It is neither installed as an event nor preserved as a prop; it is erased and replaced by an internal sentinel.

Whether bind-tap is a real Lynx event name is beside the point: the framework currently accepts the prop, destroys the callback, and reports nothing. It should either install the event or reject the name at compile time.

The leaked Symbol(octane.lynx.first-screen-event) in the create command props is a second problem — a renderer-internal marker crossing the wire in a position the protocol does not describe.

Additional consequence for L2

The slots table is the interface #63 declares for the future L2 patch applier (docs/lynx-specialized-target-l0.md §3.3–§3.4). It currently declares slot 0 as "p:bind-tap" for a value the compiler already treated as an event. An L2 applier trusting that table would patch a prop whose value is an internal Symbol rather than installing a listener.

This is latent today only because renderTemplate never reads node.slots (packages/lynx/src/main-renderer.ts) — the table is emitted but unused on the first-screen path, so nothing currently validates it against what create() actually does.

Suggested direction

Single-source the classification. Either derive LYNX_EVENT_PROP from the renderer's firstScreenEvents globs, or have the erasure step use the same regex, so a name cannot be an event for one stage and a prop for the other. A compile diagnostic for event-shaped names that match the glob but cannot be installed would close the silent-failure path.

Verification performed

Reproduced independently of the finding agent across both compile targets. No red test is committed for this on claude/octane-issue-58-adversarial-audit: that branch is scoped to counterexamples against the stack's equivalence claims, and both encodings agree here, so it is not one.

Activity

  1. added
    bug
    on Aug 18, 2026
  2. Huxpro commented on Aug 18, 2026

    @Huxpro
    OwnerAuthor

    Correction: severity overstated — no type-valid .tsrx can trigger this

    A refuter attacked the reachability claim in this issue and it does not hold. The mechanism is real and reproduces exactly; the consumer-impact framing was wrong.

    What I got wrong

    The issue says <view bind-tap={h}> "compiles with no diagnostic". True of compile() in isolation — and misleading about the actual authoring workflow. CLAUDE.md mandates tsrx-tsc --noEmit for any program containing .tsrx, and it rejects every triggering name:

    <view class="page" bind1={props.a} />   -> TS2322 Property 'bind1' does not exist on type 'LynxStandardProps'
    <view class="page" bind={props.a} />    -> TS2322, same
    <view class="page" bindtap={props.a} /> -> typechecks clean
    

    The error fires on unannotated components too — the JSX intrinsic prop check is independent of the props annotation — so skipping the annotation does not buy the fixture back.

    The desync cannot be reached by any declared name

    LynxStandardEventProps (packages/lynx/src/native-types.ts:170-204) enumerates 34 event names × 5 prefixes = 170 props, built from explicit LynxPrefixedEvent<'name', Type> members. I verified directly: there is no bind${string} index signature anywhere in LynxStandardProps.

    The refuter ran all 170 declared names through both matchers — the compiler's hostPropMatches against the firstScreenEvents patterns, and the renderer's EVENT_PROP — and found zero disagreements. The desync fires only on names whose suffix is empty or contains a non-letter (bind, bind1, bind2d, bind-tap, global-bind), every one of which is outside the declared prop set.

    The custom-element escape is also closed by default: packages/lynx/src/intrinsics.ts:279 ships export interface LynxCustomIntrinsicElements {} — empty — so that route needs a consumer augmentation declaring a function-valued prop that is not a Lynx event. That is a fixture the reporter must invent, not one Octane hands anyone.

    Detail the original report under-stated

    The sentinel does reach papi.setAttribute — my dump hid it because JSON.stringify silently drops symbol-valued entries. A String()-based dump shows attrs={bind1: Symbol(octane.lynx.first-screen-event)}. So the leak is real where it fires; it just cannot be made to fire from type-valid source.

    What survives

    • The two matchers genuinely disagree, and that is a latent inconsistency worth closing.
    • The slots table contract for the future L2 applier is still wrong for such names ("p:bind-tap" for a value the compiler already treated as an event).
    • Anyone bypassing tsrx-tsc, or any future bind${string} index signature added to LynxStandardProps, re-opens it immediately.

    Revised severity

    Not a live silent-failure for a consumer following the documented workflow. Treat as hardening / latent-inconsistency, ranked below #70, #81, #82, #83, and #84 — all of which fire on ordinary, type-valid code. The suggested fix is unchanged and cheap: single-source the classification so a name cannot be an event for one stage and a prop for the other.

    The attribution in the original report stands — the fix belongs in the compiler/renderer matcher pair, not in either applier.


    Generated by Claude Code

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