Repository navigation
test: pin what a bound-slot update costs a run's teardown certification - #253
Merged
Merged
Conversation
`heapMtsAfterClear` is one post-collection `Runtime.getHeapUsage` reading. A scalar can say a 3.3 MB gap exists and can never say who owns it, which is why E2 closed on clear cost and explicitly did not close on retention: a named remainder nominates nobody. `stages/heap-retention.mjs` folds V8 heap snapshots taken at four points on a fresh page into named buckets, and `heap-retention-analyze.mjs` is the pure half that decides the claim, tested without spending a measurement window. The fourth capture is what makes the other three readable. A second create-and-clear on the same page separates a bucket still holding rows from one that grew a backing store for them and kept it -- a distinction no single cycle can draw, and the difference between a leak and a high-water mark. Three properties the tables are built to preserve, each with a test: - the share column divides by the gap being attributed, never by the summed rows, so the shares do not total 100% and the unattributed part stays visible; - shrinking buckets are kept, because a bucket that shrinks across create-then-clear is the evidence that its teardown ran; - the tail past the top-N is a remainder named `(other growth)`, the same shape as `off_boundary` and under the same rule. Column offsets are read from `snapshot.meta.node_fields` rather than hardcoded, and a missing column is a hard failure rather than a silent misread of the wrong column. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
A `mount-template-run` earns direct teardown by staying exactly the run it was declared as. `prepareDirectFullTeardown` refuses a dense store whose `mutated` flag is set, because a written host is no longer derivable from its program, and `LynxDenseHostRecordStore.set` sets that flag on its first call. An `update` to a bound slot goes through `writeRecord`, whose staged clone reaches the dense store at apply (`state.records.set`). So replacing one value the program already reserved a place for -- no topology, no new host, nothing the certification checks -- costs the whole run its fast teardown. A table whose author touched a single cell pays the expansion fallback for every row on the next clear. The test is checked in as `it.fails`. That states the contract E3 owes rather than pinning today's behaviour as expected, and it inverts by itself: when a slot update stops spending the certification the test starts passing, and `it.fails` turns red to say the marker should come off. It reaches the teardown before failing, so it also shows the writes themselves already land -- including on a non-root node and on the second row, so a run that wrote the right value at the wrong offset fails here rather than passing on a single-row coincidence. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
…slot-update-certification
Huxpro
marked this pull request as ready for review
August 31, 2026 04:41
6 of 7 tasks
Owner
Author
|
Live base merged in ( Not this PR's. No Local validation on the merged head: Generated by Claude Code |
1 task done
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
E3's opener. It makes the target executable before any of the delicate work in
host-driver.tsstarts, and it names a cliff that was not previously written down anywhere.A
mount-template-runearns direct teardown by staying exactly the run it was declared as.prepareDirectFullTeardown(packages/lynx/src/core/host-driver.ts:940) refuses a dense store whosemutatedflag is set — "the store was created from one frozen program and loses this eligibility on every logical set/delete" — andLynxDenseHostRecordStore.setsets that flag on its first call, unconditionally.An
{op:'update'}to a bound slot routes throughwriteRecord, which clones the accepted record intostagedRecords; at apply,state.records.set(id, record)lands that clone in the dense store and tripsmutated. So replacing one value the program already reserved a place for — no topology, no new host, nothing the certification actually checks — costs the whole run its fast teardown.Consequence: a table whose author touched a single cell pays the expansion fallback for every row on the next clear. At 10,000 rows that is the entire run.
Why this shape
The test is checked in as
it.fails. That states the contract E3 owes rather than pinning today's behaviour as expected, and it inverts by itself: when a slot update stops spending the certification, the test starts passing andit.failsturns red to say the marker should come off. Committing it green-as-status-quo would have enshrined the defect; leaving it red would have broken CI.It observes the fallback the same way the neighbouring certified-teardown regression does — a
Proxyon the soledestroy-runthat throws whenSymbol.iteratoris read, so entering the expansion is a hard failure at the batch boundary rather than an inferred one.It also reaches the teardown before failing, which is itself informative: the slot writes already work. The failure is entirely about what they cost. The assertions cover a non-root node and the second row, so a run that wrote the right value at the wrong offset fails here rather than passing on a single-row coincidence.
What E3 still owes
Not in this PR — it is the implementation, and it belongs in its own change with the
octane-core-extendtreatment:LynxDenseHostRecordStore, so the peer's frozenvaluesarray is never written (the freeze at:6957is a deliberate ownership boundary: "a mutable array would let the peer rewrite hosts it already mounted", and E3 must preserve that, not remove it);updatehandler — take the slot path only when every name in the patch is a binding the program declared and no static prop moved;Per #246 §6.4 this needs no wire change: slot kinds live receiver-side, and
LynxSetDeltais a compact encoding ofupdate, not new applier capability.Validation
pnpm format:checkpnpm typecheckpnpm testnpx vitest run --project lynx— 734 passed | 1 expected fail (735), 48 files. The expected fail is this test.pnpm format:files packages/lynx/tests/host-driver.test.tspnpm syncclean.pnpm typecheck:files packages/lynx/tests/host-driver.test.tsreports 46 errors — the same 46 with and without this diff, and none inside the added range. They are the scoped-runner-versus-tsconfig.testing.jsonissue already reported on #236, not this change's.Not run repo-wide: test-only diff in one package, so
typecheck/testwere left to CI.Risk / follow-ups
it.failsmarker is load-bearing: whoever lands E3 must remove it in the same change, and the test will fail loudly if they forget.LynxTemplateRunDeclarationunder a native<list>) has the same frozen-values shape and is not covered here.claude/octane-issue-66-phase-a-7wz97zfor this session, butcreate-a-prrequires afeat/|fix/|docs/|test/|perf/topic branch solabel-pr.ymlcan read the type. Topic branch used; flagging the conflict rather than resolving it unilaterally.Provenance
agent-authored)Generated by Claude Code