Skip to content

test(lynx): cover the target:'lynx' first screen end to end (#87) - #96

Merged
Huxpro merged 2 commits into
new-lynxfrom
test/lynx-target-first-screen-coverage
Aug 19, 2026
Merged

Huxpro merged 2 commits into
new-lynxfrom
test/lynx-target-first-screen-coverage

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

The lynx vitest project compiles its fixtures with the background preset
(lynxRspeedyRenderers → lynxRspeedyBackgroundRenderers → target: 'universal'), so no committed test has ever executed target: 'lynx'
output
— while the real Rspeedy main-thread bundle carries the L1 slot-kind
table and create-function locals verbatim.

L1 (#63) and L3 (#65) were each covered alone. lynx-target-templates.test.ts
compares compile output and first-screen batches and never reaches
host-driver.ts; first-screen-direct.test.ts compares the appliers and never
sees a template-encoded plan. The pair production ships fell between them.

Reported as #87.

Changes

  • packages/octane/tests/lynx-target-first-screen.test.ts: one fixture,
    compiled at both targets, rendered, then applied through both appliers —
    four cells over the same fake Element PAPI, compared on physical tree and
    adoption snapshot.
  • packages/lynx/tests/_fixtures/fake-element-papi.ts: the fake Element PAPI
    moves out of first-screen-direct.test.ts so both packages drive the same
    host emulation instead of duplicating it. That suite is otherwise unchanged
    and still passes (8/8).

It lives in packages/octane/tests/ because compiler-executing tests must
(issue #66 §2 note 2: importing compile.js inside the lynx project fails,
the plugin tries to transform the compiler itself).

#87's suggested remedy does not work. It proposes a lynx-target vitest
project running packages/lynx/tests/** with the main-thread renderers,
mirroring octane/octane-prod. But lynxMainThreadRenderer carries the
main-thread-render-only capability — the main renderer deliberately never
publishes effects, refs, state ownership, or later updates
(packages/lynx/README.md:98-103) — so recompiling the background suites under
it would fail them by design, not find bugs. The uncovered thing is the
composition, and a test is the right size for it.

Validation

A premise guard runs first: the fixture must actually reach the create-function
encoding ("kind": "template", "slots", an n0 local) and the universal
build must not contain it. Without that, an eligibility regression would quietly
turn the four cells into universal compared with itself and the suite would
stay green while proving nothing. It caught exactly that during development —
my first fixture put a component at the @for body root and never templated at
all.

No changeset: test-only.

Scope — what this does and does not catch

Stated plainly, because a differential is easy to over-read. It compares cells
against each other, so it catches divergence between encodings or between
appliers, and it does not catch a regression that moves all four cells together.
Measured, not assumed:

deliberate break result
direct applier skips native event installation 1 failed / 1 passed — caught; the staged path installs events differently, so the cells diverge
shared applyProps drops the class patch 2 passed — not caught; it breaks all four cells identically
direct applier skips the hidden-attribute write 2 passed — not caught; this fixture has no hidden nodes

Absolute prop application stays pinned by the host-driver suite. What this adds
is the composition #87 names, plus @if/@else coverage — the L1 fixture has
only @for.

Risk / follow-ups

  • @try/@pending through the template encoding is still unexercised at
    runtime, which is the residual the completeness critic flagged and target 'lynx' and target 'universal' render different first screens when a prop value throws #70's
    neighbourhood. This fixture does not reach it.
  • The fake PAPI is now shared, so a change to it moves two suites at once. That
    is the point — they were meant to agree — but it is worth knowing when reading
    a failure in either.
  • @lynx-js/testing-environment (packages/lynx/src/testing.ts) exposes the
    vendored element tree and would be a stronger host than the fake. Using it
    here would have meant a second, differently-shaped harness in the same
    comparison; keeping one host across all four cells is what makes the cells
    comparable. Worth revisiting if the fake ever diverges from the real one.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

The `lynx` vitest project compiles its fixtures with the background preset
(`lynxRspeedyRenderers` -> `target: 'universal'`), so no committed test ever
executed `target: 'lynx'` output, while the real Rspeedy main-thread bundle
carries the L1 slot-kind table and create-function locals verbatim. L1 and L3
were each covered alone: the compile-output differential compares first-screen
batches without reaching `host-driver.ts`, and the applier differential never
saw a template-encoded plan. The pair production ships was uncovered (#87).

One fixture, compiled at both targets, rendered, then applied through both the
direct and staged appliers: four cells compared on physical tree and adoption
snapshot. A premise guard asserts the fixture really does reach the
create-function encoding and that the universal build does not, so the cells
cannot quietly degrade into comparing `universal` with itself.

#87 suggests a whole `lynx-target` vitest project over `packages/lynx/tests/**`.
That does not work: the main-thread renderer carries `main-thread-render-only`,
so the background suites would fail by design. The gap is the composition, and
a test is the right size for it.

Scope, stated honestly: this is a differential across encoding x applier. It
catches divergence between cells — skipping native event installation in the
direct applier turns it red — and not a regression that moves all four cells
together, such as dropping the class patch in the shared `applyProps`. Absolute
prop application stays pinned by the host-driver suite.

The fixture also adds `@if`/`@else` to the covered shapes; the L1 fixture has
only `@for`. `@try`/`@pending` through the template encoding stays open.

The fake Element PAPI moves to `tests/_fixtures/` so both packages drive the
same host emulation rather than duplicating it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
@Huxpro
Huxpro changed the base branch from perf/lynx-template-local-naming to new-lynx August 19, 2026 18:31
@Huxpro
Huxpro marked this pull request as ready for review August 19, 2026 18:31
# Conflicts:
#	packages/lynx/tests/first-screen-direct.test.ts
@Huxpro
Huxpro merged commit 0e1c117 into new-lynx Aug 19, 2026
1 check failed
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.

1 participant