Skip to content

Commit 5417006

Browse files
ryansolidClaude via Cursor
andcommitted
fix(signals): seat a verdict reader per hold — the posture is released when the probed hold lands
A pass that probed (isPending/latest) or read a verdict memo (#4050) is a verdict reader only while something it asked about is held. The probed nodes are remembered per node (verdict.ts probeMemory; a render effect laneDirty re-runs inherits the memo's) and resolved to their holds at use (probesHeld/holdOf, through _fam.node for a derived store's leaves), so a probed hold's landing releases the posture with nothing to walk; toward a later, isolated hold the node is whatever its reads make it (D-25 as amended 2026-11-01). CONFIG_VERDICT stays node-level; every site that seats a pass on it now asks probesHeld: frameRead, read's staged fast path and serve, the pending arm's observeFlight, stagedRead's effect push, the store's node-less staging, the held re-pass arm, enterLane's guard, laneRead's entered, a boundary's display-ahead swap. A boundary output's fallback read brackets the memory as it does REACTIVE_PROBED. Shadow: the 49 gated rows (4393 x28, 4491 x15, 4504 x4, verdict-memo-flight-no-reask x2) and the #4544-clause rows (4439, 4362, createProjection.async, fuzz-findings-l2, errored-recovery-wedge, createErrorBoundary) no longer differ; lane rows unchanged; no new rows. Pin flipped with citation: latest-two-readers-one-ask-4393 (beside, #4408) — c1101 is display-ahead of the hold m1:1122 is the work of. Co-authored-by: Claude via Cursor <[email protected]>
1 parent 290c551 commit 5417006

9 files changed

Lines changed: 207 additions & 29 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
A verdict posture is per hold (D-25 as amended): a pass that probed (`isPending`/`latest`) or read a verdict memo is a verdict reader only while something it asked about is still held. The probed nodes are remembered per node and resolved to their holds at use, so a probed hold's landing releases the posture; toward a later, isolated hold the node is whatever its reads make it (#4393, #4491, #4504, #4544 clause).

‎documentation/plans/seat-per-hold.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ Node-level `CONFIG_VERDICT` is still stamped at every window (`markVerdictReader
162162

163163
## 6. Mechanism sketch
164164

165-
**Representation.** Per node: `_seats: Transaction[] | null` — holds the node is a _verdict reader_ of (resolved through `resolveTx` at use; merges fold by identity). Work needs no new slot: it is `txOf(el)` + a staging, or `flushTransaction` at the head (in-flush), or `bornInto`. Mainline is the absence. Node-level `CONFIG_VERDICT` stays with its two remaining jobs (§3). The probed-node either-order service stays as today (it is node-level by construction: the probe and the plain read are of the same node in the same pass; the next pass's `CONFIG_VERDICT` carries it — exactly what `verdict-contract` L156 pins).
165+
**Representation (as built, 2026-11-01 — approved in place of the `_seats: Transaction[]` sketch below).** Per node, a _probe memory_ (verdict.ts `probeMemory`, a `WeakMap`): the nodes its last asking pass asked about — its own tracked window reads (`verdictValue`, unless its creators read the future, #4341), the probes a verdict memo it read handed on (#4050, core.ts `read`), or, a render effect, those of the memo whose lane re-staging re-ran it (`laneDirty`). A pass's first contribution replaces the previous pass's list (`_depGen` names the pass). No hold is stored: the posture is _resolved to holds at use_ — `probesHeld(c, flush)` asks `holdOf(p)` of each remembered node now (a held node's transaction; a lane node's, the hold its lane is under; a derived store's leaf, whatever holds its family's derive, `_fam.node`, D-30; a node staged this flush or in flight and not held yet, the flush's hold to be — counted only for a read of the flush's own proposal, `flush`). So the posture is toward the hold that held the probed node at the probe and any hold it merged into (D-4: `resolveTx` is implicit — the node is simply held by the merged transaction), and released at that hold's landing with nothing to walk: after the landing nothing holds what the memory names. Node-level `CONFIG_VERDICT` stays as today — set by a window or a #4050 read, cleared by a pass that asked nothing, by the #3884 head clear and by `holdWork` — and every site that seats a pass on it now asks `probesHeld` too (`frameRead`, `read`'s staged fast path and `serve`, the pending arm's `observeFlight`, `stagedRead`'s effect push, store.ts's node-less staging, the held re-pass arm at the head, `enterLane`'s guard, `laneRead`'s `entered`, a boundary's display-ahead swap). Work needs no new slot: it is `txOf(el)` + a staging, or `flushTransaction` at the head (in-flush), or `bornInto`. Mainline is the absence. The probed-node either-order service stays as today (the probe and the plain read are of the same node in the same pass; `holdOf` of that node is the hold).
166+
167+
The original sketch, kept for the record:
168+
169+
**Representation (sketch).** Per node: `_seats: Transaction[] | null` — holds the node is a _verdict reader_ of (resolved through `resolveTx` at use; merges fold by identity). Work needs no new slot: it is `txOf(el)` + a staging, or `flushTransaction` at the head (in-flush), or `bornInto`. Mainline is the absence. Node-level `CONFIG_VERDICT` stays with its two remaining jobs (§3). The probed-node either-order service stays as today (it is node-level by construction: the probe and the plain read are of the same node in the same pass; the next pass's `CONFIG_VERDICT` carries it — exactly what `verdict-contract` L156 pins).
166170

167171
**Head decision** (`recompute`, replacing the scattered checks): compute once
168172

@@ -183,7 +187,7 @@ stored on the pass as `passWork: Transaction | null` (one — D-4 merges two) an
183187

184188
**Display-ahead mount's children becoming T's work (#4574).** Falls out of row 1 + row 6: the mount is mainline toward T, its first pass reads the in-flush staging → `passWork = T` → its `insert` effects are created with `bornTx = T`. The web `test.fails` row flips without a web change.
185189

186-
**Release at landing.** `land` (scheduler.ts:1259–1288) walks `T._reruns` (verdict readers already listed by `staleReader`) and removes `T` from each `_seats`; a node never listed never had `T`. Merges: `_seats` entries resolve through `_into`; duplicates are harmless.
190+
**Release at landing.** As built: none to perform — `probesHeld` resolves the remembered nodes to their holds at use, and a landed hold holds nothing. (Sketch: `land` (scheduler.ts:1259–1288) walks `T._reruns` and removes `T` from each `_seats`.)
187191

188192
**Byte class (estimates, not measured).** Core floor: **0 B** — `_seats`, `passWork`/`passVerdict` live behind `observeFlightHook`/`laneStageHook`; without them `frameRead` folds to today's `t === flushTransaction || bornInto`. `+ isPending/latest`: +60–120 B br (the array slot, `markVerdictReader(c, t)`, head fold, `land` release) **minus** the removed per-site checks (`frameRead`'s `!verdict`, `stagedScreen`'s arm, `enterLane`'s mask, `route`'s guard) — net plausibly +40–80 B br; the maintainer's stop line on the option-2 probe was +60 B, so this is at the line. Live page: same order (+80–150 B br). The S1 rebuild's +1061 br came from the seat _stack_ and its restores; this design has one array per probed node and two pass locals.
189193

‎packages/signals/src/boundaries.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ import {
7676
haltReactivityAt,
7777
heldUnder,
7878
joinFuture,
79+
observeFlightHook,
7980
passLane,
8081
passTx,
82+
probesBracketHook,
83+
probesHeldHook,
8184
resolveTx,
8285
schedule,
8386
setPassLane,
@@ -544,7 +547,9 @@ function arm(b: Boundary): void {
544547
if (
545548
lane === null &&
546549
globalQueue._running &&
547-
(getOwner() as Computed<any>)._config & CONFIG_VERDICT
550+
(getOwner() as Computed<any>)._config & CONFIG_VERDICT &&
551+
// (Toward a live hold only — D-25 per hold.)
552+
probesHeldHook!(getOwner() as Computed<any>, true)
548553
) {
549554
joinFuture(null);
550555
lane = GlobalQueue._verdictLane!(flushTransaction!);
@@ -894,10 +899,14 @@ function fallback<T>(b: Boundary): T {
894899
// fallback, #4337).
895900
const p = passLane;
896901
const f = out._flags;
902+
// (Its probe memory too, D-25 per hold: the fallback's probes are not
903+
// the output's. Only the verdict engine keeps one.)
904+
const m = observeFlightHook ? probesBracketHook!(out, undefined) : null;
897905
const saved = __TEST__ ? shadowSeatSave(out) : null;
898906
const v = read(b._fb) as T;
899907
setPassLane(p);
900908
if (__TEST__) shadowSeatRestore(out, saved);
909+
if (observeFlightHook) probesBracketHook!(out, m);
901910
out._flags ^= (out._flags ^ f) & (REACTIVE_PROBED | REACTIVE_LANE_READ);
902911
return v;
903912
}

‎packages/signals/src/core/core.ts‎

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,10 @@ import {
168168
laneSeamsHook,
169169
laneServedHook,
170170
holdWorkHook,
171+
inheritProbesHook,
171172
laneWriteHook,
172173
observeFlightHook,
174+
probesHeldHook,
173175
wireExternalSourceHook
174176
} from "./scheduler.js";
175177
import type { Transaction } from "./scheduler.js";
@@ -477,9 +479,14 @@ export function recompute(el: Computed<any>, create: boolean = false): void {
477479
// A verdict reader born into `tx` (`bornInto`: never committed) is the
478480
// hold's own work, whatever it asked before (D-25): it joins like any
479481
// held pass, so what it mounts is the hold's (D-13, #4467).
482+
// A verdict posture toward a live hold only (D-25 per hold): one whose
483+
// probed hold has landed holds a mere staging here, and joins.
480484
if (tx._lane || el._config & CONFIG_LAGS) {
481485
} else if (
482-
!(el._config & (CONFIG_VERDICT | (EFFECT_RENDER << 23))) ||
486+
!(
487+
el._config & (EFFECT_RENDER << 23) ||
488+
(el._config & CONFIG_VERDICT && probesHeldHook!(el, false))
489+
) ||
483490
(observeFlightHook && !(el._config & (EFFECT_RENDER << 23)) && bornInto(el, tx))
484491
)
485492
joinPassTx(tx, freshHook?.(el, el._statusFlags & STATUS_UNINITIALIZED));
@@ -1341,8 +1348,10 @@ function frameRead(c: Computed<any>, el: Signal<any> | Computed<any>): boolean {
13411348
// does: structure, not a derivation of what it shows (#4283). A mount
13421349
// under a hold still enters it: the content memo it reads is born held,
13431350
// with no committed value to serve.
1351+
// A verdict reader toward a live hold only (D-25 per hold, `probesHeld`):
1352+
// one whose probed hold has landed is whatever its reads make it.
13441353
// (Verdict readers and lanes exist only with their engines installed.)
1345-
const verdict = observeFlightHook && c._config & CONFIG_VERDICT;
1354+
const verdict = observeFlightHook && c._config & CONFIG_VERDICT && probesHeldHook!(c, false);
13461355
const lane = laneStageHook && passLane !== null;
13471356
if (
13481357
(!lane ||
@@ -2139,7 +2148,10 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
21392148
// reads the screen too.
21402149
if (
21412150
netted ||
2142-
(((observeFlightHook && c._config & CONFIG_VERDICT) || (laneStageHook && passLane?.folded)) &&
2151+
(((observeFlightHook &&
2152+
c._config & CONFIG_VERDICT &&
2153+
probesHeldHook!(c as Computed<any>, true)) ||
2154+
(laneStageHook && passLane?.folded)) &&
21432155
stagedScreen(c as Computed<any>, el))
21442156
) {
21452157
if (__TEST__) shadowActual(netted ? SLOT_P : SLOT_C);
@@ -2188,14 +2200,21 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
21882200
// verdict reader keeps the posture it is served the screen with
21892201
// (`observeFlight`). (A verdict memo exists only with the verdict
21902202
// engine installed.)
2191-
if (observeFlightHook && !(c as any)._type)
2192-
(c as Computed<any>)._flags |=
2193-
owner._config &
2203+
// Handed on with what the memo asked about (D-25 per hold,
2204+
// verdict.ts `inheritProbes`): the posture is toward those holds.
2205+
if (
2206+
observeFlightHook &&
2207+
!(c as any)._type &&
2208+
owner._config &
21942209
CONFIG_VERDICT &
21952210
(owner._statusFlags & STATUS_PENDING &&
21962211
(c._config & CONFIG_STAGED || (c as Computed<any>)._statusFlags & STATUS_UNINITIALIZED)
21972212
? c._config
2198-
: -1);
2213+
: -1)
2214+
) {
2215+
(c as Computed<any>)._flags |= REACTIVE_PROBED;
2216+
inheritProbesHook!(c as Computed<any>, owner, false);
2217+
}
21992218
}
22002219
}
22012220
if (__TEST__)
@@ -2284,7 +2303,7 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
22842303
// boundary a lane mounts shows its fallback (A29's boundary exemption).
22852304
if (passLane !== null && !((c as Computed<any> | null)?._statusFlags! & STATUS_UNINITIALIZED))
22862305
committed = true;
2287-
else if (c !== null && c._config & CONFIG_VERDICT)
2306+
else if (c !== null && c._config & CONFIG_VERDICT && probesHeldHook!(c as Computed<any>, true))
22882307
committed = observeFlightHook!(c as Computed<any>, owner);
22892308
}
22902309
if (owner._statusFlags & STATUS_PENDING && !committed) {
@@ -2428,6 +2447,7 @@ export function serve(el: Signal<any> | Computed<any>, c: Computed<any> | null):
24282447
(observeFlightHook &&
24292448
c!._config & CONFIG_VERDICT &&
24302449
!((el as Computed<any>)._statusFlags & STATUS_UNINITIALIZED) &&
2450+
probesHeldHook!(c!, true) &&
24312451
stagedScreen(c!, el) &&
24322452
!throwShown(el))
24332453
) {
@@ -2497,7 +2517,11 @@ export function stagedRead(c: Computed<any>, el?: Signal<any> | Computed<any>):
24972517
// if the flush parks (D-22; D-25: the probe decides the posture in either
24982518
// read order). A memo's is the frame's derivation either way: a memo is
24992519
// not a leaf (`frameRead`).
2500-
if (laneSeamsHook && (passLane !== null || ((c as any)._type && c._config & CONFIG_VERDICT)))
2520+
if (
2521+
laneSeamsHook &&
2522+
(passLane !== null ||
2523+
((c as any)._type && c._config & CONFIG_VERDICT && probesHeldHook!(c, true)))
2524+
)
25012525
stagedReaders.push(c);
25022526
}
25032527
}

‎packages/signals/src/core/lanes.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import {
9090
nextQuestion,
9191
ownFlights,
9292
passLane,
93+
probesHeldHook,
9394
question,
9495
queuePendingNode,
9596
releaseQueues,
@@ -310,9 +311,11 @@ export function enterLane(l: Transaction, c: Computed<any>): void {
310311
verdict &&
311312
(creatorReads(c, (c as any)._type || f) ||
312313
((hold = resolveTx(l._parent!)),
313-
(c._config &
314-
(CONFIG_HELD | CONFIG_VERDICT | CONFIG_FRAME | CONFIG_LAGS | CONFIG_OVERRIDE)) ===
315-
CONFIG_HELD && txOf(c) !== hold) ||
314+
(c._config & (CONFIG_HELD | CONFIG_FRAME | CONFIG_LAGS | CONFIG_OVERRIDE)) ===
315+
CONFIG_HELD &&
316+
// (A verdict posture toward a live hold only, D-25 per hold.)
317+
!(c._config & CONFIG_VERDICT && probesHeldHook!(c, false)) &&
318+
txOf(c) !== hold) ||
316319
(c._config & CONFIG_HELD_FRAME && bornInto(c, hold!)))
317320
)
318321
) {
@@ -777,7 +780,8 @@ export function laneRead(c: Computed<any> | null, el: Signal<any> | Computed<any
777780
}
778781
// A verdict reader reads ahead of the seam's verdict: re-derived on the
779782
// screen if the lane holds (#4284).
780-
if (c._config & CONFIG_VERDICT && l._parent!._verdict !== l) entered.push(c);
783+
if (c._config & CONFIG_VERDICT && l._parent!._verdict !== l && probesHeldHook!(c, false))
784+
entered.push(c);
781785
}
782786
}
783787
enterLane(l, c);

‎packages/signals/src/core/scheduler.ts‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,32 @@ export let observeFlightHook: ((c: Computed<any>, el: Computed<any>) => boolean)
183183
/** D-25's hold work (verdict.ts `holdWork`): on `source` going pending,
184184
* whether verdict reader `n` waits on it instead of re-deriving. */
185185
export let holdWorkHook: ((n: Computed<any>, source: Computed<any>) => unknown) | null = null;
186+
/** D-25 per hold (verdict.ts `probesHeld`): is verdict reader `c`'s posture
187+
* live — something its last asking pass asked about held now? `flush`: the
188+
* read is of the flush's own proposal, so a probe of one the flush has not
189+
* held yet counts. Consulted wherever CONFIG_VERDICT seats a pass. */
190+
export let probesHeldHook: ((c: Computed<any>, flush: boolean) => boolean) | null = null;
191+
/** (verdict.ts `inheritProbes`): `c` reads verdict memo `from` (#4050), or
192+
* — `next`, a render effect — is re-run by its lane re-staging (`laneDirty`). */
193+
export let inheritProbesHook:
194+
| ((c: Computed<any>, from: Computed<any>, next: boolean) => void)
195+
| null = null;
196+
/** (verdict.ts `probesBracket`): snapshot (`saved` undefined) and restore
197+
* a node's probe memory around a read that must not hand a posture on
198+
* (boundaries.ts `fallback`). */
199+
export let probesBracketHook: ((c: Computed<any>, saved: unknown) => unknown) | null = null;
186200
export function installVerdictHooks(
187201
observeFlight: NonNullable<typeof observeFlightHook>,
188-
holdWork: NonNullable<typeof holdWorkHook>
202+
holdWork: NonNullable<typeof holdWorkHook>,
203+
probesHeld: NonNullable<typeof probesHeldHook>,
204+
inheritProbes: NonNullable<typeof inheritProbesHook>,
205+
probesBracket: NonNullable<typeof probesBracketHook>
189206
): void {
190207
observeFlightHook = observeFlight;
191208
holdWorkHook = holdWork;
209+
probesHeldHook = probesHeld;
210+
inheritProbesHook = inheritProbes;
211+
probesBracketHook = probesBracket;
192212
}
193213
/** External-source bridge (wired by enableExternalSource(); undefined while
194214
* no config is active — including after _resetExternalSourceConfig()). */
@@ -1422,6 +1442,8 @@ export function laneDirty(node: Signal<any> | Computed<any>, l: Transaction): vo
14221442
t = c._x?._transaction;
14231443
if ((c as any)._type === EFFECT_RENDER && node._config & CONFIG_VERDICT) {
14241444
((c._config |= CONFIG_VERDICT), (c._flags &= ~REACTIVE_LANE_DIRTY));
1445+
// Toward what the memo asked about (D-25 per hold), for that pass.
1446+
inheritProbesHook!(c, node as Computed<any>, true);
14251447
if (__TEST__ && shadowLaneDirtyHook !== null) shadowLaneDirtyHook(c, node);
14261448
}
14271449
if (t?._lane ? sameLane(t, l) : (c as any)._type) c._flags |= REACTIVE_LANE_DIRTY;

0 commit comments

Comments
 (0)