Skip to content

feat(lynx): compile-time background core switch and an octane-block bench cell (#103 B0) - #126

Merged
Huxpro merged 12 commits into
new-lynxfrom
claude/octane-issue-66-phase-a-7wz97z
Aug 21, 2026
Merged

Huxpro merged 12 commits into
new-lynxfrom
claude/octane-issue-66-phase-a-7wz97z

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #103 B0: wire the Block background core into a real application, so the
first in-product A/B against the universal core can be measured instead of
argued about. Base new-lynx.

1. The core is a build-time choice. pluginOctane({ core: 'block' })
substitutes __OCTANE_LYNX_BACKGROUND_CORE__ through DefinePlugin,
environment.ts folds it to a module-scope boolean, and root.ts binds one core
for the life of the bundle. There is deliberately no per-root runtime option, so
Rspack tree-shakes the core the bundle did not select — which is what makes the
two benchmark cells a single-variable A/B rather than two applications that
resemble each other. benchmarks/lynx-bundle-size/core-switch.mjs builds the
same fixture twice and reports −35,411 B gzip on the background program
(75,516 → 40,105, and −133,794 B raw) with the main-thread program
byte-identical, under three controls: neither core's strings survive in the
other's bundle, each core's own probes are present so a stale probe set cannot
pass, and the main-thread comparison normalizes the whole-bundle debug-metadata
digest. Re-measured on the branch head, not on the commit that introduced the
switch — the block core has grown 367 B gzip since, from the /block subpath,
the deep freeze, and the supersession map.

The Block core has no component layer yet, so a compiled .tsrx component
reaching it is refused by name rather than mis-rendered.
withLynxBlockProgram(component, program) attaches a hand-written program that a
block build runs and a universal build ignores; that attachment is what lets one
application entry be driven by either core.

2. Two defects that only a real main thread exposes. Both were found by
driving the bench app end to end and both are fixed here with regressions
(packages/lynx/tests/block-first-screen.test.ts):

  • A main thread that painted a first screen keeps every optional wire behaviour
    dormant until the background's first batch has adopted or repaired that
    screen, so intrinsic template runs are unavailable for exactly one commit.
    The Block core mounted with mount-template-run regardless and had its whole
    first mount rejected — Octane Lynx rejected an unnegotiated intrinsic template run., a frozen page. It now consults the negotiation per mount and
    spells that one commit in the legacy vocabulary, with the same host and
    listener ids either way.
  • compileLynxBlockTemplate returned the caller's object. The wire shares a
    template program with the main thread without cloning and only offers the
    incremental compact acknowledgement for a frozen run, so a mutable program
    had its second commit rejected — Octane Lynx received an unnegotiated compact acknowledgement. It now returns a deeply frozen copy.

3. A benchmark cell. benchmarks/lynx-table gains octane-block (scoped
writes, the way a lowering with per-row reactive cells would write) and
octane-block-reconcile (the whole next list handed to the keyed reconciler, the
way setRows(next) does today), both built from the same app/src/index.ts with
only the build flag changed. web/run-web.mjs reports each as its own
÷ octane same-window ratio table; prototype/run-fcp.mjs picks the cell up
once its bundle exists.

4. A third defect, which only the numbers could find. The first A/B came
back with updateStorm at 1.27× — the Block core losing the one operation
that writes the same slot over and over. The cause was in the Block core's own
frame: write() appended an update, and an update states the host's
complete next props, so a frame that wrote one host fifty times carried
forty-nine commands of dead payload. It now supersedes — the new command
replaces the old one at its original index, which keeps it ordered against the
frame's structural work while making the frame proportional to the hosts that
changed rather than to the writes that changed them. Measured on the same
interaction, at 10,000 rows:

updateStorm @ 10k commits commands wire bytes validate prepare apply wall
universal core 10 4,000 223,602 2.9 ms 11.1 ms 41.9 ms 557.8 ms
block, before 3 50,000 2,783,466 41.2 ms 78.4 ms 274.6 ms 810.6 ms
block, after 3 3,000 166,892 2.4 ms 8.2 ms 34.0 ms 383.7 ms

update10th is the control: 1 commit / 1,000 commands / ~70 KB for both cores,
unchanged by the fix, because it writes each host once.

Neither deterministic count harness could see this defect, which is a fact
about the instruments and not a footnote: run.mjs and block-counts.mjs both
flush once per tick, the redundancy existed only between flushes, and both
therefore reported the two cores emitting identical command counts for this
storm. Only the real cells' wire profiler found it. Item 5 closes that gap.

5. The instrument that would have caught it. block-counts.mjs gains two
rows, updateStormOneFrame and selectStormOneFrame, which repeat the two
storms with every tick landing in one frame rather than its own. That is not
a synthetic shape: the app schedules storm ticks through a MessageChannel,
they land faster than the renderer commits, and the table above is the proof —
50 ticks arrived as 10 commits on the universal core and 3 on the Block core. It
is also the only column in which a redundant command can exist at all, because a
core that emits eagerly can invalidate its own command only while the frame is
still open, and every other row here closes the frame first.

A commands floor column is the gate axis those rows exist for: what the frame
strictly has to carry, beside what it carried. The runner now fails a frame that
carries fewer commands than its floor; carrying more is a reported residual.

@ 10,000 rows commands commands floor wire bytes
updateStorm (a frame per tick) 50,000 50,000 2,789,294
updateStormOneFrame 1,000 1,000 55,966
selectStorm (a frame per tick) 60 60 6,954
selectStormOneFrame 30 0 1,643

Red-green, at 1,000 rows: with supersession disabled the two new rows read 5,000
and 60 instead of 100 and 30, while every pre-existing row stays
byte-identical
. That the defect is visible only in the new column is the claim
the column exists to support.

selectStormOneFrame's floor is zero because the burst ends exactly where it
opened — the last tick reselects the row that was already selected, and every
row touched in between is back to row. What the core sends is one command per
distinct host it touched: the floor superseding a pending command can reach, not
the semantic one. That residual is reported rather than rounded away.

Why

B0 is the blocker for the first real in-product numbers on #103. Everything
before it measured the Block core in a harness; nothing had ever run it behind a
production main thread, and the three defects above are exactly what that gap was
hiding — a fake main that acknowledges everything cannot see the first two, and a
harness that flushes once per tick cannot see the third.

Changes

  • packages/rspeedy-plugin-octane: core: 'universal' | 'block' option, its
    define, and its type.
  • packages/lynx: LYNX_BLOCK_BACKGROUND_CORE in environment.ts; the core
    branch in root.ts; core/block-background.ts (the block root over the real
    transport); core/block-program.ts (withLynxBlockProgram); the negotiation
    predicate and legacy mount path in core/block-core.ts; the frozen-copy
    compile; command supersession in core/block-core.ts's frame;
    lynxClientTemplateRunsNegotiated in core/client-driver.ts; and a new
    @octanejs/lynx/block subpath.
  • packages/lynx/tests: block-background.test.ts,
    block-core-update-differential.test.ts, block-first-screen.test.ts, two
    supersession regressions in block-core.test.ts, plus the public-api and
    runtime-compatibility expectations.
  • benchmarks/lynx-bundle-size/core-switch.mjs: the byte proof for the switch.
  • benchmarks/lynx-table: app/src/block-program.ts, the build/flag plumbing,
    the two new cells, a README section stating what the cell does and does not
    measure, the re-run FCP@10k result file, and
    prototype/results/web-b0-block-cell.* as the checked-in record of the A/B
    below.
  • benchmarks/lynx-table, the instrument: the two frame-held rows and the
    commands floor column in block-counts.mjs, the tick helpers they share
    with the per-tick storms in block-workload.ts, the README section that says
    why the column exists, and the regenerated
    prototype/results/u0-block-core-counts.* — in which every pre-existing
    number is unchanged.

Why @octanejs/lynx/block and not the package root

@octanejs/rspeedy-plugin replaces the bare @octanejs/lynx request with the
first-screen facade on the main-thread layer, and an application entry is
compiled into both layers. An entry that reached the block surface through
the package root therefore failed to link on the main-thread side. The
replacement pattern is anchored (/^@octanejs\/lynx$/), so a subpath is not
rewritten.

Measured

Protocol per benchmarks/lynx-table/README.md: quiet host, fresh page per
sample, cells interleaved AB/BA, n=5, medians, same-window ratios only;
absolute ms are host-bound and are not comparable across hosts or sessions. Both
drive modes were built and smoked before any number was quoted, as the README
requires. Full record on #103; checked in as
benchmarks/lynx-table/prototype/results/web-b0-block-cell.*.

10,000 rows, all three cells in one window (octane = 1.00×)

op octane octane-block × octane-block-reconcile ×
create 1234 1087 0.88× 1039 0.84×
update10th 173 100 0.57× 118 0.68×
select 79 44 0.55× 57 0.72×
updateStorm 582 325 0.56× 623 1.07×
selectStorm 108 89 0.83× 215 1.99×

1,000 rows, same window

op octane octane-block × octane-block-reconcile ×
create 144 130 0.91× 115 0.80×
update10th 21 24 1.15× 20 0.92×
select 23 8 0.34× 19 0.85×
updateStorm 81 33 0.41× 66 0.81×
selectStorm 20 25 1.22× 37 1.84×

Against U0's update-path ceiling (update10th 0.59× / select 0.54× at 10k):
update10th measured 0.57× and select 0.55×, so the ceiling is met. Two
earlier windows read update10th 0.56× and 0.69×, select 0.66× and 0.55×; the
window-to-window spread is the same size as the distance to the ceiling, so the
supportable claim is "≈0.6× on both", not a figure to one decimal place.

The 1,000-row column is reported for completeness, not as a claim. Its
operations are 8–37 ms with ±1–6 ms error bars, so update10th at 1.15× and
selectStorm at 1.22× are within a band that also contains 1.00×. Only the
10,000-row column separates the cores.

selectStorm at 0.83× is not a weaker result on the same axis as select.
The deterministic counts say a select-storm tick and a single select are the
same operation on the wire — 2 commands and 225 B, identically on both cores —
so 30 ticks costing 108 ms against one select costing 79 ms means the single
op is dominated by the full-root walk (select@10k reconciles 10,042 child
blueprints against the Block core's 2 lookups) while the storm is dominated by a
per-tick round trip and presentation the background cannot reach. select and
update10th are the cells that measure the update path; the storms measure how
much of a frame's wall clock the background owns at all.

FCP@10,000, re-measured after the supersession commit: octane 1733.8 ms,
octane-block 1519.5 ms (0.88×), octane-direct prototype 958.8 ms
(0.553×). The pre-fix window on the same host read 1659.8 / 1525.5 (0.92×) /
954.7 (0.575×): the block cell's own absolute moved 6 ms across the two windows,
which is the expected null result — a mount emits create, never update, so
the first-screen path has nothing for supersession to remove, and the
0.88×–0.92× band is baseline movement. See the first-screen caveat below before
reading either figure as a first-screen win.

Validation

  • pnpm format:files:check (changed files)

  • pnpm typecheck (repo-wide, exit 0)

  • pnpm sync (clean, no generated changes)

  • targeted tests: --project lynx — 35 files / 453 tests, all passing,
    including the two new suites, the cross-core update differential, and the
    two supersession regressions.

  • All three defects red-green verified: each was reintroduced independently
    and the exact failure reproduced — the two browser error texts for the
    first-screen pair, and a 500-command frame for the supersession one —
    before the fix was restored.

  • The instrument in item 5 red-green verified the same way: supersession
    disabled in block-core.ts, block-counts.mjs re-run at 1,000 rows, the
    two new rows moved 100 → 5,000 and 30 → 60 while every pre-existing row
    held its exact value, then the core restored and the record regenerated at
    both scales with --reps 2.

  • Functional smoke end to end before any measurement, per the benchmark
    README's own protocol: prototype/smoke.mjs passes for octane,
    octane-block and octane-block-reconcile.

  • Tree-shaking verified in bytes on the benchmark application itself, not
    only on the size fixture. main.lynx.bundle raw, with the block core's
    diagnostics as probes:

    | build | bytes | `no component layer yet` | `a template needs at least one host node` |
    | --- | ---: | ---: | ---: |
    | universal | 481,444 | 0 | 0 |
    | block | 361,349 | 1 | 2 |
    | block, reconcile mode | 360,905 | 1 | 2 |
    
    The `2` is the known caveat below, not an anomaly: an entry is compiled
    into both layers.
    
  • pnpm test — 5 files failed / 2194 passed; 4 tests failed / 21,059
    passed / 1 skipped
    , in 2,600 s on a loaded 4-CPU container. Every
    failing file is attributed below; none is in a package this diff changes
    except rspeedy-plugin, which is checked directly. Run against the tree
    before the supersession commit; that commit is covered by the --project lynx run above. The instrument commit touches benchmarks/ only, and no
    vitest project includes that path.

failing file attribution
rspeedy-plugin native-demo.test.ts — "escalates cleanup for a detached descendant after its leader exits" Pre-existing per #66 §2.3. Re-run of the whole rspeedy-plugin project in isolation on this branch: 7/8 files, 64/65 tests pass, and this one still fails. It asserts stopProcessTree reaping a detached descendant — process management in a Linux container, downstream of the build and untouched by a core option, a define, and a type.
alien-signals hydration.test.ts Hook timed out in 10000ms in a beforeAll that server-renders a fixture. Passes in isolation on this branch in 11.5 s total. A fixed-deadline hook that only misses under a loaded parallel run; the same Vite-boot cost is measured in #127.
octane-events-browser suspense-hydration — focus/selection after a keyed reorder Real-browser focus assertion, packages/octane. Untouched by this diff; the same file is in the pre-existing set recorded on #121/#122.
drei-adapted-browser upstream-e2e.browser.test.ts — screenshot Screenshot comparison in packages/drei. Untouched by this diff; pre-existing in this container.
dropzone probes/hydration.test.ts packages/dropzone. Untouched by this diff; pre-existing in this container, and now diagnosed and filed as #127: the fixture boots a Vite dev server inside the it() body, ~4.3 s against the project's default 5,000 ms testTimeout, while hydration plus the event round trip is 61 ms of that.

packed-consumer.test.ts — listed as pre-existing-failing in earlier records —
passed in this run and in the isolated project run, so it belongs to the
load-sensitive class rather than the persistent one.

Risk / follow-ups

  • updateStorm was a real Block-core defect, and is fixed in this branch.
    It measured 1.27× at 10,000 rows in two independent windows; it now measures
    0.56×. The first hypothesis recorded on Lynx specialized background core: the Block model over the wire (#58 L2 body, post-attribution direction) #103 — a fixed per-commit cost, the
    Block core winning the one-off and losing the steady state — was wrong,
    and the correction is posted there: the Block core sent fewer commits (3 vs
    10) and 12.5× more commands. See summary item 4 for the cause and the
    before/after wire profile.
  • The one-frame instrument is a Block-core instrument, and that is a property
    of the two cores rather than a limitation of the harness.
    A frame boundary is
    caller-controlled in the Block core and scheduler-owned in universal-core, so
    the harness cannot hold a universal frame open the same way — and it would find
    nothing if it could. universal-core builds each frame from a whole-tree walk
    rather than from the writes that provoked it, so a value it has already
    superseded never becomes a command, and it cannot exceed one command per host
    per commit by construction. The measurement agrees: at 10,000 rows its
    updateStorm sends 4,000 commands over 10 commits for 50 ticks × 1,000
    changed rows
    — 400 per commit against 1,000 changed hosts, well under that
    ceiling. The Block core after the fix sends 3,000 over 3 commits, exactly 1,000
    per commit, exactly the floor; before the fix it sent 50,000, one per write.
    Deriving a frame from writes is what made the redundancy reachable, and it is
    the only place the new column can find any.
  • The reconcile mode's storms stay above 1.00×, and need no fix.
    octane-block-reconcile spends 500,000 block lookups on updateStorm and
    300,000 on selectStorm at 10,000 rows, against 50,000 and 60 for the scoped
    column. That is inherent to handing the whole list to the keyed reconciler
    every tick, which is the point of carrying the cell: it is the honest cost of
    today's setRows(next) shape, and the gap between the two columns is the
    size of the prize a component layer with per-row reactive cells would collect.
  • The bench cell is an architecture ceiling, not a framework measurement.
    The Block core has no component layer, so the cell is driven by a hand-written
    program (app/src/block-program.ts). The README says so, and says that
    octane-block must never be quoted without octane-block-reconcile beside
    it — reporting only the scoped-write mode would credit the Block model with a
    win that belongs to the scoped write. Here that rule cuts in the model's
    favour on the single-write operations: the reconcile mode still lands
    0.68×/0.72× on update10th/select at 10k.
  • The first screen is not comparable for this cell. The Block core has no
    adoption story yet: its first commit mounts its own tree, main finds a
    mismatch and repairs, and the painted first screen is discarded. FCP measures
    that repair, so the 0.88×–0.92× band says the block bundle reaches a settled
    10,000-row tree slightly sooner despite paying a repair — not that the Block
    core paints first screens faster. Every table operation, create included, is
    measured after run-web.mjs waits for the mount and settle()s, so the repair
    has landed before the first click. (An earlier revision of the README claimed
    create was not comparable; that was wrong and is corrected in this branch.)
  • A latent transport gap, observed and deliberately not changed here. The
    request side offers ack: LYNX_COMPACT_ACKNOWLEDGEMENT whenever compact,
    but the accept side refuses a compact reply after the first batch unless
    incrementalCompactRequested — which additionally requires the run and its
    program to be frozen. A producer that emits an unfrozen run is told to reply
    compact and is then rejected for doing so. Freezing the Block core's programs
    removes the symptom for this producer; the asymmetry itself is recorded on
    Lynx specialized background core: the Block model over the wire (#58 L2 body, post-attribution direction) #103 rather than patched inside a bench-enablement PR.
  • An app that attaches a block program pays for these modules in its
    main-thread bundle too, until the compiler emits programs into the background
    graph only. Noted in packages/lynx/src/block.ts, and visible as the 2 in
    the probe table above.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

claude added 3 commits August 21, 2026 05:57
… differential

Issue #103 B0, slices 1 and 2. A single build-time option picks which core
drives background commits, and a differential test proves the two cores agree
on the update path, not just on a first mount.

The switch. `pluginOctane({ core: 'block' })` substitutes
`__OCTANE_LYNX_BACKGROUND_CORE__` through DefinePlugin, `environment.ts` folds
it to a module-scope boolean, and `root.ts` binds one core for the life of the
bundle. There is no per-root runtime option, so Rspack tree-shakes the core the
bundle did not select: `benchmarks/lynx-bundle-size/core-switch.mjs` builds the
same fixture twice and reports a 35,779 B gzip smaller background bundle under
`core: 'block'`, with three controls — neither core's strings survive in the
other's bundle, each core's own probes are present so a stale probe set cannot
pass, and the main-thread program stays byte-identical once the whole-bundle
debug-metadata digest is normalized.

The Block core has no component layer yet, so a component reaching it is
refused by name rather than mis-rendered. `withLynxBlockProgram()` attaches a
hand-written program a block build runs and a universal build ignores, which is
what keeps one app entry driving both cores as a true single variable.

The differential. `block-core-update-differential.test.ts` walks a nine-step
ladder over 120 rows — create, update every tenth, select, move the selection,
swap, remove every seventh, append, clear, refill — through both cores over the
same transport and the same applier, comparing the painted tree, the handle
journal main publishes, and the recorded event bindings after every step. Two
differences are normalized with their reasons stated: the cores are independent
allocators, so integers are ranked by first appearance per column, and they
tear a range down from opposite ends, so intra-commit destroys are compared as
a set. The mutation-op counts are asserted equal rather than logged: the cores
do identical update work and differ only in how a mount is spelled.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Issue #103 B0, found by driving the benchmark app with `core: 'block'` in a
real browser: the page mounted its first screen and then froze, with a rejected
commit on the console. Two defects, both invisible to a fake main thread that
acknowledges whatever it is sent, and both reproduced here on the real one.

A main thread that painted a first screen keeps every optional wire behaviour
dormant until the background's first batch has adopted or repaired that screen,
because a first tree is compared against a legacy batch. The Block core mounted
with `mount-template-run` regardless and had its whole first mount rejected as
an unnegotiated template run. It now asks per mount and spells that one commit
in the vocabulary every peer understands, from the ids the run already
allocated, so a block is indistinguishable afterwards and a scoped write
addresses the same host either way.

`compileLynxBlockTemplate` returned the caller's program object. The wire shares
a template program with the main thread without cloning, and after the first
batch the only compact acknowledgement it will accept is the incremental form,
which requires a frozen run — so main answered the second commit compactly and
the transport rejected its own negotiated reply. The compiler now returns a
deeply frozen copy, which is the contract `universalPlan` already meets, and
copies rather than freezing in place so the caller keeps its own object.

`packages/lynx/tests/block-first-screen.test.ts` is the regression: a real main
thread paints a shell, the Block core mounts behind it and then fills a range
large enough to draw a compact acknowledgement, and the oracle is the painted
tree. Each defect reintroduced alone fails it with the exact error the browser
reported.

Also adds `@octanejs/lynx/block`, the surface a block program is written
against. The package root cannot serve an application entry: the Rspeedy plugin
replaces the bare `@octanejs/lynx` request with the first-screen facade on the
main-thread layer, and an entry is compiled into both layers, so an entry that
reached for the block surface through the root failed to link.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Issue #103 B0, slice 3. `BENCH_CORE=block` builds the same application entry
with `pluginOctane({ core: 'block' })`, and `web/run-web.mjs` measures it beside
`octane` in one window — same page driver, same bundle recipe, AB/BA
interleaving, fresh page per repetition — and prints the two-core ratio as its
own table rather than leaving it to be divided out of the vue-vdom column.
`prototype/run-fcp.mjs` picks the cell up once its mount-create bundle exists.

`app/src/block-program.ts` is what the cell runs: the benchmark page written
host-for-host against the Block core, because that core has no component layer
to run `App.lynx.tsrx` with. It is attached with `withLynxBlockProgram`, so one
entry drives both cores and `__OCTANE_LYNX_BACKGROUND_CORE__` folds the
attachment away in a `universal` build — probing the two bundles finds none of
the block program and none of the Block core in the universal one, which is what
makes the flag the single variable.

Read every number from this cell as an architecture ceiling: the program is
hand-written, exactly as `block-workload.ts` and `prototype/` are. The README
records that, the two drive modes that must be built before either is quoted,
and the one number that is not comparable — the Block core has no first-screen
adoption story, so `create` and FCP measure a repair of the painted first screen
rather than an adoption of it.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…e caveat

The FCP@10000 run now carries `octane-block`: 1525.5 ms against octane's
1659.8 ms in the same window (0.92×), with the `octane-direct` prototype
unchanged at 0.575× — the same ratio this host reported three days ago, which
is what says the window was comparable.

The 0.92× is not a first-screen win and must not be read as one. The Block core
has no adoption story: main paints the first screen from the same main-thread
program, the background's first commit mismatches, and main repairs. What the
number says is that a bundle carrying one core reaches a settled 10,000-row tree
slightly sooner *despite* paying a full repair, not that the Block core paints
first screens faster. `octane-direct` remains the ceiling that a real
first-screen story would aim at.

The README's caveat over-claimed in the other direction: it said `create` was
not comparable for this cell. It is. `run-web.mjs` waits for the mount and then
`settle()`s — two animation frames plus 30 ms — before the first click, so the
repair has landed before `create` is timed, and every table operation is
measured on a settled tree. Only FCP straddles the first screen.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
claude and others added 7 commits August 21, 2026 07:51
…beside it

Issue #103, B0's one measured regression, attributed and fixed.

B0's in-product A/B found `updateStorm` at 1.27x (block / universal) at 10,000
rows while `update10th` was 0.56x on the same rows and the same per-row work.
Reading the real cells' own wire profiler settled it, and it is not the fixed
per-commit cost that record guessed at:

  updateStorm @ 10k   commits   commands       bytes   main apply
  universal                10      4,000     223,602      41.9 ms
  block                     3     50,000   2,783,466     274.6 ms

The Block core sent *fewer* commits and 12.5x the commands. `write()` appended
an `update` per changed slot with no supersession, so fifty ticks writing each
row's label slot shipped fifty commands per host. An `update` carries the node's
complete next props, so applying only the last is byte-identical to applying the
whole run: forty-nine fiftieths of that payload was dead on arrival.

`update10th` is untouched by this because it writes each slot exactly once —
which is why the two cells were command-identical there and why the regression
looked mysterious rather than obvious.

The fix is a per-frame map from host id to where that host's live `update` sits.
A later write rewrites that command in place. Its original position is kept, so
the command stays ordered against the frame's structural work: a `move` or
`remove` for the same host does not read its props, and no other host's command
can observe them. `destroy` drops the id from the map; `flush` resets it.

This is not the slot-merging U1 §3 deferred to a scheduler. That asks whether
two *different* changes may share one command. This drops a command the core
has already invalidated itself.

After, in the same interaction: 3 commits, 3,000 commands, 166,892 bytes,
34.0 ms of main-thread apply — a quarter fewer commands and bytes than the
universal core in the same storm.

Red-first: the new count assertion reads 500 commands for 500 writes across 10
hosts before the change and 10 after. A second test pins the ordering property
the rewrite depends on, by writing a row, reconciling it away, and writing its
neighbour in one frame, then comparing against a fresh mount of the survivors.

`--project lynx` 35 files / 453 tests pass.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
`benchmarks/lynx-table/results/` is a scratch output directory and is
gitignored, so a run that is quoted anywhere durable needs a copy under
`prototype/results/` — the convention `web-u0-update-ceiling.*` and
`web-l0-session.*` already follow.

This is the post-supersession window: all three cells in one interleaved
n=5 run at 1,000 and 10,000 rows. At 10k the scoped block cell reads
update10th 0.57x and select 0.55x against U0's 0.59x/0.54x ceiling, and
updateStorm 0.56x where the pre-fix window read 1.27x.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The recorded window predated `perf(lynx): supersede a stale block-core
update instead of appending beside it`, so the file no longer described
the branch head. Re-run on a quiet host, n=5, cells alternating:

  octane 1733.8ms | octane-block 1519.5ms (0.88x) | octane-direct 958.8ms

This is the expected null result, and worth having as one. A mount emits
`create`, never `update`, so the first screen has nothing for
supersession to remove — and indeed the block cell's own absolute moved
6ms (1525.5 -> 1519.5) across the two windows. The ratio moved from
0.92x to 0.88x only because the octane baseline did, which is why the
supportable claim is the 0.88x-0.92x band rather than either endpoint.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…ch head

The recorded figure was taken when the switch commit landed. Three
commits since then added to the block core: the `@octanejs/lynx/block`
subpath, the deep freeze in `compileLynxBlockTemplate`, and the frame's
supersession map. Re-running `benchmarks/lynx-bundle-size/core-switch.mjs`
on the head:

  background gzip  75,516 -> 40,105   (-35,411 B, was -35,779 B)
  background raw  278,541 -> 144,747  (-133,794 B)
  main-thread program byte-identical across the switch

So the block core is 367 B gzip heavier than when the number was first
written, and the delta is quoted from a run against the code being
shipped rather than an earlier one.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
`block-counts.mjs` and `run.mjs` both flush once per tick, so a command the
core invalidates while a frame is still open cannot exist in anything either
reports. That is the instrument gap B0's record named after the in-product A/B
found an `updateStorm` regression the counts had called clean.

Two rows close it. `updateStormOneFrame` and `selectStormOneFrame` repeat the
storms with every tick landing in one frame, which is the shape the browser
actually produces: the app schedules storm ticks through a `MessageChannel`,
they land faster than the renderer commits, and the 10,000-row stage
decomposition observed four ticks of a 1,000-row change inside one drain.

A `commands floor` column is the gate axis those rows exist for — what the
frame strictly has to carry, beside what it carried. The runner now fails a
frame that carries fewer commands than its floor, which would mean it does not
state its own outcome; carrying more is a reported residual.

At 10,000 rows the new rows read 1,000 commands / 55,966 B against
`updateStorm`'s 50,000 / 2,789,294 B, and 30 commands against a floor of zero.
With supersession disabled they read 5,000 and 60 at 1,000 rows while every
pre-existing row stays byte-identical — the defect is visible only here, which
is the claim.

`selectStormOneFrame`'s floor is zero because the burst ends where it opened.
What it sends is one command per distinct host it touched: the floor
superseding a pending command can reach, not the semantic one. The gap is
reported rather than rounded away.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Two un-awaited renderAsync calls both read mounted === null (it is only
assigned after program.mount yields) and mounted the program twice over
one page tree. Renders now chain on a queue, so the second observes the
first's mount and becomes an update — the calling pattern the universal
core supports and coalesces. A rejected render still surfaces to its own
caller and does not wedge later renders.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
Same harness wart as #118: the counts harness writes non-Prettier-clean
JSON and this re-run missed its format pass, breaking the repo-wide lint
gate.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YHfFsy9CLaRovTFH8pTGyY
@Huxpro
Huxpro marked this pull request as ready for review August 21, 2026 21:04
# Conflicts:
#	benchmarks/lynx-bundle-size/README.md
#	packages/lynx/src/core/block-core.ts
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