Skip to content

feat(lynx): direct-emission first screen with unchanged adoption capture (issue-58 L3) - #65

Merged
Huxpro merged 3 commits into
new-lynxfrom
claude/octane-issue-58-l3-direct-first-screen
Aug 19, 2026
Merged

Huxpro merged 3 commits into
new-lynxfrom
claude/octane-issue-58-l3-direct-first-screen

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on the L2 spike PR (#64); first slice of #62 (L3 of the #58 roadmap). The synchronous first screen now lands on the Element PAPI through direct emission instead of the staged command pipeline:

  • host-driver.ts gains applyLynxFirstScreenDirect(container, nodes, batch): one walk over the rendered record tree doing createElement → props (planLynxHostPropPatch + applyProps, unchanged for correctness) → selector install → event-token journal (installNativeEvent, ids read from the batch's event commands so the deterministic 1,000,000-seed assignment stays single-sourced in the renderer) → child-first append — no command staging, no cloned record/generation maps, no operation replay, no activeNodes indirection. The container's LynxHostState afterward is indistinguishable from the staged path, so captureLynxFirstTree, background adoption, mismatch repair, capability handoff, and buffered-event replay are untouched.
  • Native-list trees return false and keep the staged path (they are also the trees adoption declines today). Any failure faults the container exactly like the staged apply.
  • main-renderer.ts exposes the id-assigned record tree on LynxFirstScreenRenderResult.nodes; the batch remains the wire/adoption product.
  • main-thread.ts renderFirstScreenNow tries the direct path first and falls back for declined trees.

Why (measured, in-product)

The L0 evidence located the first-screen cost in the interpret → record graph → command batch → prepare → generic apply pipeline. #63 removed the interpreter for eligible templates; this PR removes the staging/apply half in the real stack. Same-window mount-create FCP@10k, fresh page per sample, AB/BA, n=5 (benchmarks/lynx-table/prototype/results/fcp-10000-l3.md):

cell median FCP
pre-L3 stack (preserved build, same harness) 1782.9 ms
L1+L3 stack 1542.8 ms (0.865×, −240 ms)
architecture floor (L0 prototype cell) 979.1 ms

The remaining gap to the floor is owned by the still-built command batch and record graph, background-thread boot, capture-side validation, and the engine floor — the next L3 slices, tracked in #62.

Validation

  • lynx + octane + octane-prod projects: 862 files / 12,760 tests green — including the full first-screen, adoption, mismatch-repair, buffered-event, and milestone integration suites now running through the direct path.
  • new packages/lynx/tests/first-screen-direct.test.ts: differential equivalence — direct and staged appliers produce deep-equal adoption snapshots, event-token journals, and physical PAPI trees for a fixture with keyed rows, events, and a hidden Activity subtree; red-green verified by deliberately dropping the hidden-attribute write. Also pins the native-list fallback.
  • scoped pnpm typecheck:files on the touched packages clean.
  • pnpm test (full repo run beyond the projects above not executed in-session); native-engine gates (Explorer/Android/iOS) unchanged and still open per the roadmap.

Risk / follow-ups

  • The command batch is still constructed (it remains the returned product and the mixed/list fallback input); making it lazy is a follow-up measured against the same harness.
  • captureLynxFirstTree still re-plans host prop patches for main-thread-prop validation; a hasMainThreadProps fast exit is a follow-up flagged in the exploration notes.
  • Direct path currently covers list-free trees only — exactly the adoptable set; list-bearing first screens keep today's behavior byte-for-byte.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

@Huxpro Huxpro left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the direct applier against the staged path and the adoption contract. The equivalences that matter hold: listener ids are minted once in renderLynxFirstScreen and the applier consumes the batch's own event commands, so token encoding inputs are identical by construction; events-on-hidden converges with the staged install-then-remove; the end state satisfies captureLynxFirstTree's invariants clause-by-clause; and the native-list decline happens before any PAPI mutation and covers exactly the trees adoption already skips. The differential suite (deep-equal adoption snapshots, event journals, and physical trees, with a red-green check) is the right shape of evidence.

Independently verified on this head: the full lynx project green (26 files / 342 tests), a production BENCH_AUTOROWS build of the lynx-table app producing both bundles, and the web smoke passing at 10k rows through this direct path — so the stack is sound to rebuild benchmark entries against.

Two inline findings, both about the exported applyLynxFirstScreenDirect rather than the integrated flow: the fault path skips the staged applier's lifetime-invalidation/flush-journal steps (no test covers a mid-walk throw), and the applier skips the envelope validation the staged path performs. Neither blocks the measurement claims; the fault-path one is the one I'd fix before this merges.


Generated by Claude Code

Comment thread packages/lynx/src/core/host-driver.ts Resolved
Comment thread packages/lynx/src/core/host-driver.ts Resolved
@Huxpro
Huxpro force-pushed the claude/octane-issue-58-l2-kernel-spike branch from 09e0cd5 to 4924e40 Compare August 18, 2026 16:08
claude added 3 commits August 18, 2026 16:08
…ure (issue-58 L3)

renderFirstScreenNow now applies the rendered record tree straight to the
Element PAPI (applyLynxFirstScreenDirect): no command staging, cloned record
maps, or operation replay, while the container state stays indistinguishable
from the staged path so captureLynxFirstTree, background adoption, mismatch
repair, and buffered-event replay are untouched. Listener ids stay
single-sourced in the renderer's batch; native-list trees keep the staged
path. Equivalence pinned by a differential snapshot/journal/physical-tree
test alongside the existing first-screen and adoption suites.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
…alidation

Per review: a mid-walk PAPI fault now mirrors the staged applier — the
flush obligation survives (cleanupNeedsFlush journaled on flush failure)
and directly installed main-thread worklets are invalidated through the
shared invalidateMainThreadLifetimesAfterFault before rethrow. The exported
applier also validates the batch envelope (renderer id, positive safe
version) before touching PAPI. Fault-injection and envelope tests added.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
@Huxpro
Huxpro force-pushed the claude/octane-issue-58-l3-direct-first-screen branch from 5dc3c52 to 2fe1446 Compare August 18, 2026 16:11
Huxpro added a commit that referenced this pull request Aug 18, 2026
Counterexample to the #65 claim that `applyLynxFirstScreenDirect` leaves the
container indistinguishable from `prepareLynxHostBatch` + `apply`. RED on this
stack head.

The staged applier validates host placement before mutating: a `#text` host
under a non-text parent is refused with "#text host N may only be placed
directly under a text host." The direct applier runs no equivalent check, so it
paints the same tree — 2 instances against the staged path's 0. The refusal is
what keeps an invalid tree away from the engine, so an applier that skips it is
not substitutable for one that performs it.

Reachable from authored `.tsrx`: the renderer rejects `<view>{text}</view>` at
compile time ("does not allow authored primitive text under <view>"), but an
explicit `children` prop is skipped by that attribute check and compiles clean,
after which the renderer materializes the string into a `#text` host under the
view. This sits entirely on the plan encoding — a `children` binding makes the
template ineligible — so it is an applier-level divergence independent of #63.

Asserts only that the two appliers agree, so either repair passes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015bSFKJDuqGJALcNAEiycA4
@Huxpro
Huxpro changed the base branch from claude/octane-issue-58-l2-kernel-spike to new-lynx August 19, 2026 17:13
@Huxpro
Huxpro marked this pull request as ready for review August 19, 2026 17:13
@Huxpro
Huxpro merged commit 3071653 into new-lynx Aug 19, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants