Repository navigation
perf(lynx): keep a run certifiable for direct teardown after a props write - #256
Conversation
…write A `mount-template-run` earns a certified single-command teardown by staying the run it was declared as, and `LynxDenseHostRecordStore` spent that certification on any logical write. An `update` routes through `writeRecord`, whose staged clone lands in the store at apply, so one touched cell anywhere in a table sent the next clear through the per-host expansion for every row. What `prepareDirectFullTeardown` certifies is topology: the run's nodes, its parent, its child order, and the node ownership those imply. It reads no prop. `set` now asks whether the record it is handed is the host already at that offset carrying different props, and only a write that changes more than props spends the certification. The store still answers for that host afterwards because the written record stays materialized, and both paths that drop a materialization already disqualify the store by themselves. The first screen has always settled it this way: there the staged records *are* the store, an update writes `record.props` straight onto the materialized record, and no `set` happens at all. The check is broader than a slot write on purpose. An `update` carries the whole next prop bag, so it can drop a name the program declares statically, and no overlay onto the run's values could express that. Nothing in the teardown needs it to. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
|
Note on CI, because the checks list here will look empty and that is not a draft
pull_request:
branches: [main, new-lynx]This PR's base is So the evidence for this head is the local run recorded in the body: Generated by Claude Code |
…ynx-e3-run-slot-update
|
Base branch #253 caught up to live CI cannot start on it. This also settles the one thing the body left open. It said Local validation on the merged head: Generated by Claude Code |
Summary
E3 (#81), stacked on #253 which checked in the contract as
it.fails.Sequence answer on #230: issuecomment-5473129307.
A
mount-template-runearns a certified single-command teardown by staying therun it was declared as, and
LynxDenseHostRecordStorespent that certificationon any logical write. An
updateroutes throughwriteRecord, whose stagedclone lands in the store at apply (
state.records.set), so one touched cellanywhere in a table sent the next clear through the per-host expansion for every
row.
mutatedconflated two claims: the store is still derivable from itsdeclaration, which a props write does break, and the store is still what the
teardown certified, which it does not touch.
prepareDirectFullTeardownis theflag's only reader, and what it certifies is topology — the run's nodes, its
parent, its child order, and the node ownership those imply. It reads no prop. So
setnow asks the narrower question: is this the host already at that offsetcarrying different props?
The store still has to answer for that host afterwards, and it does:
valuesnolonger derives the written props, but the written record stays in
materialized, and both paths that drop a materialization —deleteandclear— already disqualify the store by themselves. The first screen hasalways settled it this way: there
stagedRecordsis the store, an updatewrites
record.propsstraight onto the materialized record and nosethappensat all, so an in-place props write never spent the certification. This is the
clone-and-set route agreeing with the route beside it.
The check is deliberately broader than the issue title's "slot update", and it
has to be. An
updatecarries the whole next prop bag, so it can drop a name theprogram declares statically — #253's test does exactly that, updating a row to
{ id: 'row-2*' }against a program whose node declaresclass: 'row'— and nooverlay onto
valuescould express that state. Nothing in the teardown needs itto.
Validation
pnpm format:files:checkon the changed filespnpm typecheck(exit 0)pnpm test— 2447/2451 files, 26,778 passed, 4 failed, 1 skippednpx vitest run --project lynx— 48 files, 737 tests, all passingThe four failures are outside this diff and none of them loads the record store:
emitted function entry serves requests through the bundled handleradapter-vercellynxin the fileshould match previous onedrei-adapted-browserlynxin the filerestores focused input and its selected text after a keyed DOM reorderoctane-events-browserlynxin the fileescalates cleanup for a detached descendant after its leader exitsrspeedy-pluginstopProcessTreekills the orphan within 100 ms; imports nothing frompackages/lynx/srcThe last one still fails when run alone on an otherwise idle box, so it is a
process-group capability of this container rather than load. I did not re-run
the four against the parent commit — reverting the tracked files was refused in
this environment — so this is an argument from what each test loads, not a
before/after run. Repository CI on the current head is the check that settles it.
Correctness evidence
Red before green, both directions:
it.failsnow passes. Reverting theone-line change in
setreturns it to its exact recorded failure,sole destroy-run entered the expansion fallback. That test wraps the soledestroy-runcommand array in aSymbol.iterator-throwingProxy, soentering the expansion is observable at the batch boundary rather than inferred
from a timer — this is the deterministic, in-repo claim.
isPropsOnlyWrite, so that clause is load-bearing rather than decorative.was written, not from the run's
values: a repeat identical update makes nopapi prop call, and restoring
classafterwards touches onlyclass.Measurement — indicative, not certified
10,000 rows × 2 nodes, in-process fake PAPI, medians of 9 with interleaved arms,
timing
prepareLynxHostBatch+applyof the soledestroy-run:Before, every updated-arm sample (14.6–55.9 ms) sat above every pristine sample
except one GC outlier; after, the two arms interleave sample for sample.
These numbers came from a temporary probe added to the test file and then
removed, so their recipe is not in a repository. Under #230's protocol that
disqualifies them as a metric, and I am not resting the claim on them — the
deterministic
Proxyassertion above is the claim. They are recorded becausethey are consistent with
results/issue57-clear-teardown.md, which attributes13.7 ms of destroy-run expansion plus 31.4 ms of dense validation at this size on
a real browser, and both are what an updated run was paying again. A fake PAPI
makes removal nearly free, so on device the fraction would be smaller and the
absolute saving larger.
Follow-up owed: an update-then-clear arm checked into the stage harness. That
runs into #255 (stage harnesses have no CI coverage), so it is queued rather than
smuggled in here.
The pristine arm is unchanged, as expected:
setis not called on themount-then-clear path at all.
This also discharges, in principle, the caveat reported on #230
(issuecomment-5472327081) that E2's clear win was measured on create-then-clear
with no update between. On device it is still unmeasured; #241 owns that number.
Changes
packages/lynx/src/core/host-driver.ts—isPropsOnlyWriteonLynxDenseHostRecordStore;setconsults it instead of settingmutatedunconditionally; the
mutatedfield andprepareDirectFullTeardowndoccomments now say what the flag means.
packages/lynx/tests/host-driver.test.ts—it.failsmarker removed from theE3 contract test and its comment rewritten from defect to contract; two new
tests (the answers-from-what-was-written invariant, and the listener
neighbour).
.changeset/lynx-run-slot-update-certification.md.Risk / follow-ups
by another line of
prepareDirectFullTeardown— a recreate stages ageneration, a removed root fails the child scan, a rebound node only happens
under a native list. Removing those clauses individually breaks no test today.
They stay because the method answers a question about the store, not about the
one caller that currently asks it; the comment says so rather than implying
each is load-bearing.
ensure-public-instanceandvisibilitymutate the materialized record inplace and never reach
set, so they did not spend the certification beforethis change either. Unchanged here, noted because the flag's name suggests
otherwise.
abandonCompact()iteratesstagedRecords, and when that is a dense store —a batch that mounts a run and then issues a non-compact command against the
same range — the iteration materializes every host in the run. I could not
construct a sequence the universal core actually emits that reaches it, so this
is a hypothesis about a reachable shape rather than an observed cost, recorded
rather than chased here.
stageDeclared) are a separate promotion path and areuntouched. A written declared host still stops being free.
renderer-private record store. It therefore supplies no evidence either way for
E1 design: how a background-originated mount names an MTS-resident program (#230) #246 §6.4.
Provenance
agent-authored)