Repository navigation
test(lynx): pin the destroy-run mirror against the record-map fallback - #243
Merged
Merged
Conversation
The teardown mirror built at the end of a compact `mount-template-run` copies the whole record map into a dense store so the run's later `destroy-run` can be expanded from the run's own shape instead of from the map. It is a pure fast path: identical commands, cheaper to produce. Nothing compared the two routes, so suppressing the mirror wholesale left all 728 lynx tests green. Paint the same three-row run twice and spend the mirror on one arm with an idempotent commit, then compare the two `destroy-run` expansions: emitted delta, host-API calls, and the resulting tree all have to agree. Red-verified by dropping the first row's listener detach, which surfaces as a `+ "setEvent"` diff. A marker host keeps `maxExplicitId` above the run's `firstId` so incremental compact declines and the mirror branch is actually reached; a route probe confirmed arm 1 takes `mirror` and arm 2 `records-fallback`. Also annotate `stages/results/issue57-clear-teardown` as historical: the candidate it times (b04e488) is not an ancestor of new-lynx, dcf94cf (octanejs#762) later rewrote the dense clear teardown it measures, and its headline (clear@10k at 0.800x React) is contradicted by the live 3-lane campaign (clear@10k 801 ms vs 304 ms, 2.6x). Normalizing the JSON through the evidence writer also fixes a round-trip failure that predates this branch. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
This was referenced Aug 30, 2026
Huxpro
marked this pull request as ready for review
August 30, 2026 12:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
E2 slice 1 from the ruling on #230 (issuecomment-5465592015): "a red test that
observes the mirror's retention … then either the mirror earns its coverage or
the copy goes." This slice gives it the coverage. Whether the copy goes is E2
proper, decided against #241's clear oracle.
What the mirror is. At the end of a compact
mount-template-run,host-driver.tscopies the whole record map into aLynxDenseHostRecordStoreand parks it on
state.teardownRecords, so the run's laterdestroy-runcan beexpanded from the run's own shape instead of by walking the map. The consumer
picks the route at
:6359:It is a pure fast path: same emitted commands, cheaper to produce.
Why nothing caught it. I suppressed
teardownMirrorCandidatewholesale in aclean worktree and all 728 lynx tests stayed green. That is not a fluke of
coverage — it follows from the mirror being observationally identical to the
fallback. No single-route correctness test can go red on it; only a
differential can.
The test. Paint the same three-row run twice. One arm keeps the mirror; the
other spends it first with an idempotent commit (any commit replaces
teardownRecords). Then compare the twodestroy-runexpansions: emitteddelta, host-API call log, and resulting tree all have to agree.
A marker host (
id: 50) is load-bearing — it liftsstate.maxExplicitIdabovethe run's
firstId, so incremental compact declines andstate.recordsstays aMap, which is the only way the mirror branch is reached. A temporary routeprobe confirmed arm 1 answers
mirrorand arm 2records-fallback; without themarker, arm 1 was silently taking
prepareDirectFullTeardown's early returninstead.
Red-verified. Dropping the first row's listener-detach commands from
expandRunTeardownturns the test red with a+ "setEvent"diff, then restored.(An off-by-one in
inRangedoes not go red — theorderedRoots.length !== command.countfallback re-synthesizes the ids. Worthknowing before writing the next mutant.)
Also:
stages/results/issue57-clear-teardownmarked historical. Called outin the same ruling. Three defects, all addressed:
b04e488d) is not an ancestor ofnew-lynx, anddcf94cfc8(perf(lynx): streamline dense clear teardown, perf(lynx): streamline dense clear teardown octanejs/octane#762) laterrewrote the dense clear teardown these numbers measure.
3-lane campaign (
Huxpro/lynx-js-framework-benchmark#41: clear@10k 801 ms vs304 ms, 2.6x, regime-invariant). Left unlabelled it reads as a current
claim.
(
stages/evidence.test.mjs:43, verified by stashing). Normalizing the JSONthrough
formatEvidenceJsonis what expands those single-line objects; thatchurn is the writer's canonical form, not a formatting preference.
Regenerating rather than annotating would need an app build, which is not
possible in this environment (
npx rspeedy build→ 404 from the proxy).#241 owns the live number.
Validation
pnpm format:checkpnpm typecheckpnpm testScoped to the changed surface rather than repo-wide:
npx vitest run --project lynx— 729 passed (base was 728; the new test isthe +1).
node --test stages/*.test.mjsinbenchmarks/lynx-table— 112 passed /112, including the round-trip oracle that was red at base.
pnpm format:files:checkon all three changed files — clean.pnpm typecheck:files packages/lynx/tests/host-driver.test.ts— 40 errors,byte-identical to base after stripping line/column (verified by stashing:
40 before, 40 after, same message multiset). This file is pre-existing red
under the scoped isolated typecheck; the diff adds nothing to it. Flagged
rather than fixed, since fixing 40 unrelated type errors is not this slice.
Not run:
pnpm format:checkandpnpm testrepo-wide.Risk / follow-ups
hypothesis, notverified. A full-suite census says the mirror is built 5 times and answers3 of 1,173
destroy-runexpansions (1,144 takerecords-fallback, 26dense-records); the direct fast path was never once blocked by a live mirror.Its footprint is a full record-map copy plus duplicate node/generation arrays
plus the run's whole
values, held from paint until the next commit — apeak-heap cost, not a post-clear one, consistent with Order 3's
o3teararm (+31.64 MB retained peak, −2.12 MB released), which is precisely the arm
where incremental compact is off and the mirror is the only survivor. Whether
deleting the copy helps or hurts is E2 proper's call against Clear/teardown pays 2.6–4× the peers' JS volume, regime-invariant, family-wide — attribute and shrink it (E2's cost half) #241's oracle
(clear@10k ≤ 1.15x react, clear-time events calls = 0, heapAfterClear ≤
upstream). This PR deliberately changes no behavior.
claude/octane-issue-66-phase-a-7wz97z, butcreate-a-prmandates atest/topic branch solabel-pr.ymlcan derive the type label. Topic branchused; flagging the conflict rather than silently picking a side.
Provenance
agent-authored)Generated by Claude Code