Skip to content

perf(lynx): #230 Order 3 — the four-build split - #240

Merged
Huxpro merged 3 commits into
new-lynxfrom
perf/lynx-order3-four-build-split
Aug 30, 2026
Merged

Huxpro merged 3 commits into
new-lynxfrom
perf/lynx-order3-four-build-split

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

#230 Order 3 read the create residual as background state that accumulates because a root which never paints a first screen never reaches the incremental-compact rung it negotiated. The reading was right about the rung and wrong about the residual.

postFirstTreeLazyPublicInstances turns out to be a single gate: set only in the first-tree adoption handoff (core/transport.ts), read per commit when the background decides whether to request an incremental compact, and on the host side the admission for both incrementalCompactCandidate and teardownMirrorCandidate (core/host-driver.ts). So the four builds are that one enabler crossed with the two consequences it admits:

arm enabler incremental compact teardown mirror digest
o3ctl — off off 0a52f5938f43b87f
o3cmp on live live e880ffb94bdb56d2
o3tear on suppressed live 919ba7cb574975af
o3gen on live suppressed 697bea26b94b6220

stages/issue230-order3-arms.mjs is the recipe those digests came from, so they can be rebuilt rather than taken on trust — see Reproducing this below.

o3ctl was byte-identical to the octane-hux entry as rebuilt at this base, which is a stronger statement than "it is the shipping build": that entry comes from scripts/build-octane-upstream.mjs against a clean checkout and this control from scripts/build-app.mjs against the worktree, so two independent build paths at 8938c1260 emitted the same bytes. That comparison was against the working tree of the benchmark repository rather than its history, and that working tree is now gone (below), so it stands as a recorded observation rather than something you can re-check without rebuilding both sides.

Wall clock: a null, and demonstrably a null

15 readings per arm, three windows. No arm's 95% interval clears control's on latency, btsCpu, mtsCpu or fcp. The three windows say why that is a null rather than an effect too small to resolve — every arm's delta changes sign between windows:

latency delta vs control window 1 window 2 window 3
o3cmp +15 −39 +9
o3tear +58 −19 −13
o3gen +15 +3 −22

The same bundle also reads 1735.5 / 1658.2 / 1795.6 ms across the three windows — a 138 ms spread against within-window intervals of ±40 to ±71. That is why each window is compared only with itself, and why a number here cannot be read against one from another window, including benchmark #40's.

Heap: where the signal actually is

The runner captures heap once per entry per window, so the windows are the samples — and they agree to within 64 kB on a 31.64 MB difference:

main-thread heap, MB o3ctl o3cmp o3tear o3gen
peak (w1 / w2 / w3) 51.20 / 51.22 / 51.20 51.19 / 51.21 / 51.19 82.81 / 82.87 / 82.85 51.20 / 51.21 / 51.21
after clear (w1 / w2 / w3) 10.72 / 10.72 / 10.72 10.72 / 10.72 / 10.72 8.60 / 8.60 / 8.60 10.71 / 10.68 / 10.71

Background heap does not move in any arm, which is where the effect has to be: the record store lives on the main thread.

Why

Three results, and the first is the one that redirects the E-train.

  • The rung is not where the create residual lives. o3cmp reaches everything the negotiation offered and creates 10,000 rows in the same time as the build that reaches none of it. An E-train aimed at reaching the rung faster would be aimed at nothing. o3cmp is the arm to trust here: it only adds a line, so C12's warning about a constant-folding ablation removing more than the code it deleted does not apply to it. It does apply to o3tear and o3gen, which fold a candidate to false; those two are upper bounds.
  • The teardown mirror is a heap trade, not a time trade, and the trade is currently bad. 2.12 MB more released on the clear for 31.64 MB of retained peak. The mechanism is in the open: the mirror does new Map(state.records) per mount-template-run — 70,000 records at 10,000 rows — and the copy is retained on state.teardownRecords until the next batch. o3cmp does not pay it: once incremental compact succeeds state.records is no longer a Map, so the mirror's own instanceof Map guard declines. The two consequences of the one enabler are therefore not independent, and the mirror is only reachable in the arm with incremental compact switched off.
  • Order 3's root cause is confirmed by measurement, not by reading. The mirror can only run when an incremental compact was requested, which in the shipping build is impossible. Folding a candidate to false cannot add a 31 MB copy, so the only way o3tear diverges is that its enabler executed — and the enabler sits on the branch taken when no first tree is adopted. This app does not adopt a first screen, and so never reaches the rung it negotiates.

Reproducing this

node benchmarks/lynx-table/stages/issue230-order3-arms.mjs patch o3tear | git apply -
BENCH_DIST_TAG=o3tear node benchmarks/lynx-table/scripts/build-app.mjs
node benchmarks/lynx-table/stages/issue230-order3-arms.mjs patch o3tear | git apply -R -

Each edit is stated as the exact text it replaces rather than as a line number, so it refuses to apply to a tree it does not describe instead of silently patching the wrong line of a moved file. … arms.mjs audit reports that refusal ahead of time.

What that gets you is the arms and the digests. It does not get you these three windows: the four o3* entries, the octane-hux refresh, and the runner records lived only in an uncommitted working tree that no longer exists. A fourth window would be a new measurement, and by the drift documented above it could not be read against these three.

Changes

  • benchmarks/lynx-table/stages/issue230-order3-split.mjs — reads the runner's window records, pools them on the two opposite rules the two metric families need, and writes the checked-in record. Split from collection the way The PaintingContext ceiling package: cross-framework confirmation, engine report, the guardrail, and a device correctness gate #234 D splits judgement from collection: the runner lives in another repository and needs a browser, so keeping the arithmetic here is what lets the claim be re-derived and re-checked from records already on disk.
  • benchmarks/lynx-table/stages/issue230-order3-split.test.mjs — 7 tests over the arithmetic that could otherwise lie quietly.
  • benchmarks/lynx-table/stages/issue230-order3-arms.mjs — the build recipe, added in 6a14e29eb. The record previously cited a path under a scratch directory that did not survive the machine it was written on, which left three of its four digests with no reachable recipe.
  • benchmarks/lynx-table/stages/issue230-order3-arms.test.mjs — 13 tests, including the one that pins the record's provenance pointer at a path in this repository.
  • benchmarks/lynx-table/stages/results/issue230-order3-split-10000.json — the record, carrying the commit and all four bundle digests.
  • benchmarks/lynx-table/README.md — the window, under §7's attribution family.

Validation

  • pnpm format:files:check on all changed paths — clean. The record is unchanged by Prettier, which is writeEvidenceJson doing its job.
  • pnpm sync — no generated changes.
  • pnpm format:check (repo-wide) — not run; scoped check used.
  • pnpm typecheck — not run; no TypeScript changed.
  • pnpm test — not run; this touches no package source.
  • targeted: node --test stages/issue230-order3-split.test.mjs → 7/7, … issue230-order3-arms.test.mjs → 13/13.
  • full stages suite → 131/132. The one failure is stages/results/issue57-clear-teardown.json not matching what the evidence writer would produce; verified pre-existing by stashing these changes and reproducing it on the pristine head. It belongs to dcf94cfc8 (perf(lynx): streamline dense clear teardown octanejs/octane#762), not this branch.
  • The recipe verified end to end rather than asserted: all three non-control arms apply with git apply, produce exactly the expected edit in the expected files, and revert to a clean tree. The hunks were extracted from 8938c1260 rather than transcribed.
  • Arm liveness proved before the window rather than assumed: the lynx suite under each arm gives control 730/730 green, o3cmp and o3gen failing exactly the 3 compact-guard tests, o3tear those plus 8 host-driver tests.
  • Each of the three statistical guards red-verified — t keyed by n instead of df, wall clock pooled across windows, heap spread reported as zero — each breaking exactly one test.
  • Five recipe guards red-verified: the exactly-once match refusal, a hunk that stops describing the recorded commit, the diff header's line counts, a control arm that quietly acquires a hunk, and an end-of-file context bug. The provenance-pointer test was red before the record was repointed, on the dangling path itself.

Risk / follow-ups

  • These four builds must never ship. Every arm relaxes the compact acknowledgement guard so a second segment can be applied over a live one, which knowingly loses the reachability of hosts nobody observed — the hazard pinned in PR test: pin why the incremental compact path refuses a live segment (#230) #239. They are measurement instruments. No packages/ source is changed by this PR; the recipe is data, imported by nothing.
  • A coverage gap, separate from the result: suppressing the teardown mirror alone changes no test in the 730-test lynx suite. The certified dense teardown is reachable only behind incremental compact today, and nothing pins it independently.
  • The three windows cannot be replayed. Their inputs are gone, as described under Reproducing this. What survives is the recipe, the digests, and the pooled readings in the record.
  • The recipe is pinned to 8938c1260. If packages/lynx moves under it, arms.mjs audit reports the drift rather than patching the wrong line — but at that point the digests describe a tree that no longer exists, and re-measuring is the only honest repair.
  • Web lane only; nothing here claims anything about device or native, or about the absolute ratio against upstream.
  • The heap claim rests on three windows agreeing, not on a spread inside one window.
  • Arm order is alphabetical and fixed, so position cannot cancel across windows. It is not what moves o3tear: the other three arms sit in positions 1, 2 and 3 and agree within 9 kB.
  • Branch naming: the harness assigned claude/octane-issue-66-phase-a-7wz97z, but create-a-pr mandates a feat/|fix/|docs/|test/|perf/ topic branch so the label bot can read the type. I used the repo convention; flagging the conflict as in the other PRs in this stack.

Provenance

  • An agent produced this diff (agent-authored)

…ompact rung

Issue #230 Order 3 read the create residual as background state that accumulates
because a root which never paints a first screen never reaches the
incremental-compact rung it negotiated. The reading was right about the rung and
wrong about the residual.

`postFirstTreeLazyPublicInstances` is one gate, set only in the first-tree
adoption handoff and admitting both `incrementalCompactCandidate` and
`teardownMirrorCandidate`. The split is that enabler crossed with the two
consequences it admits: control, both, teardown-only, incremental-only. Control
is byte-identical to the vendored shipping bundle.

Fifteen readings per arm, three windows. No arm's interval clears control's on
latency, btsCpu, mtsCpu or fcp, and each arm's delta changes sign between
windows, so this is a null rather than an effect too small to resolve. The same
bundle spans 138 ms across the three windows against within-window intervals of
±40 to ±71, which is why a number here cannot be read against one from another
window.

The signal is in heap, and only in the arm where the certified dense teardown
runs without incremental compact: 31.64 MB more retained peak for 2.12 MB more
released on the clear, reproduced to within 64 kB across the three windows. The
mirror copies the whole record map per mount-template-run and retains it on
`state.teardownRecords`; once incremental compact succeeds, `state.records` is no
longer a `Map` and the mirror's own guard declines, so the two consequences are
not independent.

That divergence is also what proves the enabler executed, which confirms Order
3's root cause by measurement rather than by reading: folding a candidate to
`false` cannot add a 31 MB copy, and the enabler sits on the branch taken when no
first tree is adopted.

Adds `stages/issue230-order3-split.mjs` so the record can be re-derived from run
records already on disk, with tests for the arithmetic that could otherwise lie
quietly — the runner's own ci95 convention, the refusal to pool wall clock across
windows, and the heap spread that makes the delta readable.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
Huxpro and others added 2 commits August 29, 2026 12:12
"Byte-identical to the vendored octane-hux rows-0 bundle" is true of the
benchmark repository's working tree and false of its history: the refresh of
that entry to 8938c12 is uncommitted there, and the committed entry is still
the 07115d6 build.

The match is also worth more than the original phrasing claimed. The reference
comes from build-octane-upstream.mjs against a clean checkout and the control
from build-app.mjs against the worktree, so this is two independent build paths
at one commit emitting the same bytes, not a build compared with itself.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
The record cited `scratchpad/o3/arm.py::<arm>` as the provenance for three of
its four bundle digests. That scratch directory did not survive the machine it
was written on, so the digests had no reachable recipe: three numbers you could
only take on trust, in a record whose whole purpose is that you do not have to.

`stages/issue230-order3-arms.mjs` is that recipe as a repository artifact. Each
of the four edits is stated as the exact text it replaces rather than as a line
number, so it refuses to apply to a tree it does not describe instead of
silently patching the wrong line of a moved file. `patch <arm>` emits a unified
diff for `git apply`, which makes the revert `git apply -R` rather than a second
code path that could disagree with the first; `audit` reports drift against
whatever tree you are standing in.

The hunks were extracted from 8938c12 rather than transcribed, and all three
non-control arms were verified end to end: each applies with `git apply`,
produces exactly the expected edit in the expected files, and reverts to a clean
tree.

The record's `patchFile` now names this file. That is a three-value edit and the
record stays byte-identical to what `writeEvidenceJson` produces for it.

Also corrects the README: the four `o3*` entries, the `octane-hux` refresh and
the three runner records lived only in an uncommitted working tree and are gone
too. What survives is the recipe, the digests and the pooled readings — enough
to rebuild the arms, not enough to replay those three windows, and by the drift
the report itself documents a fourth window could not be read against them.

`unifiedDiff` split the trailing newline as a line, so a change within `context`
of the end emitted a context line for a line the file does not have. Not
reachable by these four hunks, but the function is exported; it now splits the
newline off first and refuses a text that has none.

13 tests. Five guards red-verified by breaking each in turn: the exactly-once
match refusal, a hunk that stops describing the recorded commit, the diff
header's line counts, a control arm that quietly acquires a hunk, and the
end-of-file context bug. The pointer test was red before the record was
repointed, on the dangling path itself.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
@Huxpro
Huxpro marked this pull request as ready for review August 30, 2026 12:47
@Huxpro
Huxpro merged commit 247c484 into new-lynx Aug 30, 2026
16 of 20 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.

1 participant