Skip to content

Commit 8ae8829

Browse files
ryansolidClaude via Cursorcursoragent
committed
reader-seat design doc: S1 §2.2 as done, §4.8 floor levers, §4.9 M4 split and deletions
Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 23160e6 commit 8ae8829

1 file changed

Lines changed: 117 additions & 16 deletions

File tree

‎documentation/plans/reader-seat-rebuild.md‎

Lines changed: 117 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,30 @@ and the raise primitives. Everything with a lane or a verdict in it reaches
8989

9090
### 2.2 `lanes.ts` split
9191

92-
- `core/lanes-core.ts` (sub-hold core): create (`newLane`), judge-blocked
93-
(`lanesBlocked`/`nestedBlocked`, parent waits for a lane's flights — F-6
94-
2026-10-28 amendment), reveal at seam (`laneSeam`, `laneSeams`), link
95-
(`linkLanes`/`linkBlocked`/`unlink`), end with parent (`endLanes`,
96-
`dissolveLane`, `supersede`). `verdictLane(t)` lives here: a verdict
97-
record is a lane record with no node set. Installs `lanesBlockedHook`,
98-
`laneSeamsHook`, `endLanesHook`, `laneOutcomeHook`.
99-
- `core/lanes.ts` (optimistic layer): guess values (`_x._lane`),
100-
`laneWrite`/`optimisticWrite`, `applyGuesses`, `fold`, supersession of
101-
guesses, `laneStage`, and the guess arms of `laneRead` (rows L6, L7, D4,
102-
V5, Vl5). Installs `laneReadHook`, `laneStageHook`, `laneWriteHook`,
103-
`applyGuessesHook`, `laneCorrectionsHook`.
104-
- An `isPending`-only app imports `verdict.ts` → `lanes-core.ts`; it must
105-
not retain `lanes.ts`. The byte saving is **measured** at the swap PR with
106-
`scripts/size` (scenario: isPending without createOptimistic), not
107-
estimated here.
92+
As done at S1 M4 (97ed6a00e; the plan above it read "verdict record with
93+
no node set" — F-vset reading 2 keeps the node set as the reveal record,
94+
so `verdictLane` and the set are the core's):
95+
96+
- `core/lanes-core.ts` (sub-hold core): the lane records (`lanes`,
97+
`newLane`, `verdictLane`), link/blocked/reveal/landing, `laneStage`,
98+
`dissolveLane`, the seated rows (`laneSlot`, `seatRows`, `seatedRows`,
99+
`preSnapshotBits`), the packed-result applier (`applyMarks`),
100+
`laneApply`/`laneServe`, `laneSeam`/`laneSeams`, `endLanes`,
101+
`lanesBlocked`/`nestedBlocked`/`revealing`, the derivation arm of
102+
`laneWrite`, `adoptParked`/`adoptReaders`/`adoptSubs`/`adoptFrame`, and
103+
`judged`/`markJudged`. Installs `installLaneHooks(...)` (twelve hooks)
104+
and `GlobalQueue._verdictLane`.
105+
- `core/lanes.ts` (optimistic layer): `pendingGuesses`, `guessedValueOf`,
106+
`pendingGuessOf`, `guessed`/`laneGuessed`, `kept`/`reverted`, `take`,
107+
`rerun`, `optimisticWrite`, `inFlight`, `applyGuesses`, `reverting`,
108+
`supersede`, `covered`, `guessFlights`, `laneCorrections`,
109+
`laneOutcome`, `stale`/`answered`, the guess arm of `laneWrite`
110+
(`guessWrite`), `revertLanding`. Installs `installGuessHooks` (outcome,
111+
applyGuesses, corrections — scheduler.ts) and `installOptimisticHooks`
112+
(guessFlights, take, covered, guessWrite, revertLanding — lanes-core.ts).
113+
- An `isPending`-only app imports `verdict.ts` → `lanes-core.ts` and does
114+
not retain `lanes.ts` (`treeshake.test.ts` pins both directions).
115+
Measured (§4.9): `+ isPending/latest` −1,661 B minified.
108116

109117
### 2.3 `verdict.ts` keeps
110118

@@ -558,6 +566,99 @@ install them; the packed-result convention (`slot` → `applyMarks` +
558566
`serveSlot`) against base's inline early returns; M3b's arms. Stopped
559567
here for the budget call (ruling 2).
560568

569+
### 4.8 Results (S1 floor levers, 2026-10-29)
570+
571+
Ruling 3 (budget deferred, not waived; two levers, no golfing beyond
572+
them). Minified bytes per module (`scripts/size` prod build; per-module
573+
figures are standalone-minified × chunk scale, so they drift a byte or
574+
two with the scale — chunk totals are the authoritative ones):
575+
576+
| core floor | base | before (a) | after (a) | after (b) |
577+
| ------------------------------------------------------------- | ---------: | ---------: | ---------: | ---------: |
578+
| **chunk total** | **19,908** | **20,721** | **20,599** | **20,411** |
579+
| core.js | 7,144 | 6,761 | 6,676 | 6,603 |
580+
| scheduler.js | 4,757 | 4,801 | 4,788 | 4,751 |
581+
| async.js | 3,561 | 3,577 | 3,567 | 3,537 |
582+
| seat.js | 0 | 1,116 | 1,113 | 1,104 |
583+
| owner.js | 1,273 | 1,278 | 1,275 | 1,264 |
584+
| others (constants/effect/error/graph/heap/identities/signals) | 3,173 | 3,188 | 3,180 | 3,152 |
585+
586+
- **(a) hook M3b's re-derive arms out of the floor** (186616316): the in-place re-derive arms in `recompute` now run behind
587+
`verdictApplyHook`'s installer; engine-less bundles carry neither the
588+
arms nor the guards. −122 B in the floor; engine scenarios +106
589+
(`+ isPending/latest` 34,037 → 34,143) for the installer and hook call.
590+
- **(b) direct side effects on the plain rows** (a1348b19a): `plainRows`
591+
fires its mechanisms itself (`joinPass`, `stagedRead` carrying W,
592+
`staleReader`, `markLateLinker`, `link`) and returns the slot alone; the
593+
packed convention stays for the engine rows (`seatedRows`, verdict
594+
rows), applied by `applyMarks` in lanes-core.ts behind `applyMarksHook`.
595+
Per row family in the floor: direct is smaller for every plain family
596+
(`plainRows` grew +32 B; the applier, 145 B, and its call site leave
597+
only once every floor family is direct — so direct per family and the
598+
applier gone is the per-family optimum, not a global choice). The
599+
hydration claim became a table slot (`SLOT_SNAPSHOT`; `claim` in
600+
core.ts; `snapshotCaptureActive` in scheduler.ts so the chunk declares
601+
it before seat.ts reads it and the minifier folds the guard — the
602+
first cut had it in core.ts, TDZ-ordered after seat.ts, and measured
603+
+70 B). −188 B in the floor; engine scenarios +211 (`+ isPending/latest`
604+
→ 34,354), +110 (live page), +278 (compiled live) for the claim arms and
605+
the applier's relocation.
606+
607+
Floor after both levers 20,411 (base +503; was +813). CSR app floor
608+
37,520 (base +505). Behaviour-neutral at each step (signals suite +
609+
shadow 0 classes; full battery at (b): solid/web green, generator 2k × 3
610+
the two known cases only).
611+
612+
### 4.9 Results (S1 M4 — lanes split and deletions, 2026-10-29)
613+
614+
Split (97ed6a00e, §2.2): `+ isPending/latest` 34,354 → 32,693 (−1,661;
615+
vs base +2,285), live page 121,239 → 119,577 (−1,662; vs base +2,452),
616+
compiled live 130,036 → 128,328 (−1,708); floors unchanged (the engine
617+
is not in them). The `+ isPending/latest` chunk now carries
618+
`lanes-core.js` 6,798 and no `lanes.js` (base: `lanes.js` 5,677 — the
619+
sub-hold core in base was already most of `lanes.js`; the optimistic
620+
layer it drops is the 1,661).
621+
622+
Deletions. Each candidate was tried as a cut on the head and judged by
623+
the differential (signals suite + shadow; the subsumed set also by the
624+
full battery: solid 917 / web 1,551 + 3 expected fail / generator 2k × 3
625+
seeds the two known cases only / shadow 0 classes). Where a mechanism's
626+
firing could be counted, a probe counted it on base and head.
627+
628+
Subsumed — deleted:
629+
630+
| deletion | commit | evidence | `+ isPending/latest` | live page | floor |
631+
| ------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------: | --------: | ----: |
632+
| `laneServed` / `MARK_SERVED` / `laneServedHook` | 5ea7d894a | base drops a served reader's pending source 24× in the signals suite; head 0× — the seat's slot never leaves the source on the reader (the stale screen is served with `staleReader`'s mark, not a pending source to drop) | −104 | −106 | 0 |
633+
| `reruns`' `if (!u._lane)` carve-out for `REACTIVE_FRAME_READ` | 23160e65d | the carve-out still retained the mark 141× (49 no-ops) on head; clearing unconditionally changes no result — the re-read re-raises it through MARK_ST (`staleReader`) when the flight is still up (#4397) | −7 | −7 | −7 |
634+
635+
Not subsumed — kept, with the failing tests the cut produces:
636+
637+
- `holdWork` / `REACTIVE_WINDOW` / `CONFIG_ASYNC`: 32 failures
638+
(`latest-two-readers-one-ask-4393`, `verdict-memo-flight-no-reask`,
639+
`latest-first-one-pass-4402`, …). The hold's work-splitting is pass
640+
scheduling, not a read decision; no slot covers it.
641+
- `adoptParked`: 28 failures. Adoption is the M3b answer to #4417 and
642+
lives on the pass side.
643+
- `revealing`: 7 failures.
644+
- `laneDirty`'s verdict render-effect arm: 4 (`latest-memo-inline-parity`).
645+
- `laneSeams`' verdict-lane arm: 11; its plain arm: 6.
646+
647+
Not decidable by the differential — kept, flagged:
648+
649+
- `heldBy` (lanes-core.ts, `laneSeams` filter `!blocked(t) || heldBy(t, r)`):
650+
its true arm fires **0× on base and 0× on head** across the signals
651+
suite (probe), and the full battery is identical with it cut (−281 B
652+
on `+ isPending/latest` / −278 live page; 0 floor). The differential
653+
cannot show the table subsumes code nothing exercises; it is either
654+
dead since before S1 or guarded by a case no suite reaches. Left in
655+
place for a ruling (and a test, if the case exists).
656+
657+
Already gone or out of scope: `markVerdictReader`, `provisionalVerdict`,
658+
`route` (M3a); the verdict-lane node set (F-vset reading 2 — kept as the
659+
reveal record); `stagedScreen` (store.ts still calls it — S4, the store
660+
twins).
661+
561662
## 5. Swap plan
562663

563664
Three to five PRs, serial, each in its own worktree (brief §4 item 4):

0 commit comments

Comments
 (0)