Skip to content

Commit c9b6380

Browse files
ryansolidClaude via Cursor
andcommitted
test(signals): shadow the per-hold seat table against the engine
Step 2 of seat-per-hold.md §8. The `__TEST__` shadow in `seat.ts` now predicts every read's slot from the pass's seat toward the hold of the node it reads (§3): work when born into it, when its node holds the hold's staging, or when the hold's flush dirtied it; verdict reader when the pass probed (or inherited a probe of) a node that hold holds; mainline else. Mechanism: probed nodes are remembered per reader (`probeMemory`) and resolved to holds at use (`holdOf`), since a hold created in the same flush after a nothing-found probe (verdict-contract L156) is not a transaction at probe time. Render effects inherit probes only through `laneDirty` (mirrored with `shadowLaneDirtyHook`, D-26 #4284); a pending or held-async memo drops its memory at the head (#3884); store leaf probes count as their family derive's (D-30, `_fam`). The gate (§8 step 2) does not pass: the D-25 either-order family shows slot differences in 4393/4491/4504/verdict-memo-flight-no-reask, all one shape — a verdict posture inherited through the #4050 arm toward a hold that has since landed. Reported to the maintainer before any engine change; `probedToward` keeps today's order (a probe of T beats T's held staging) and the comment there says why. Also regenerates docs/RULES-INDEX.md for the spec commit's rule text. Co-authored-by: Claude via Cursor <[email protected]>
1 parent 435b088 commit c9b6380

5 files changed

Lines changed: 341 additions & 40 deletions

File tree

‎.changeset/seat-shadow-per-hold.md‎

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+
Shadow seat (`__TEST__` only): assert the per-hold seat table (seat-per-hold.md §3) against the engine — the seat of a pass toward each hold from the probes it made or inherited, the staging its node holds, and the flush that dirtied it — instead of the node's single verdict-lane membership.

‎packages/signals/docs/RULES-INDEX.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
5454
| A7 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:167` | seat.ts×1 truth.ts×1 verdict.ts×1 | fuzz-findings-l2.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×2 spec-async-semantics.test.ts×2 visibility-oracle-store.states.ts×1 visibility-oracle.states.ts×1 visibility-oracle.test.ts×1 | [ruled, amended in place] Resolved async never reads `[false, undefined]` — After an async memo resolves, `[isPending(x), latest(x)]` is `[false, resolvedValue]` — never `[false, undefined]`. **Amende… |
5555
| A8 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:175` | — | create-deferred-3710.test.ts×1 createMemo.test.ts×1 visibility-oracle-store.states.ts×1 visibility-oracle.states.ts×2 | [ruled, amended in place 2026-07-07] `isPending(() => latest(x))` follows `x`'s own async only — verdicts are per-channel — (**re-ruled 2026-07-07c** — was "tracks the transition the same as `isPendin… |
5656
| A9 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:183` | async.ts×1 projection.ts×1 target.ts×1 | spec-async-semantics.test.ts×3 visibility-oracle-store.states.ts×4 visibility-oracle-store.test.ts×1 | [ruled, amended in place 2026-07-07] Store leaves behind a firewall report the firewall's new-question refetch — `isPending` on a store leaf behind a firewall reports the firewall's refetch like any a… |
57-
| A10 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:191` | async.ts×1 core.ts×3 lanes.ts×1 scheduler.ts×1 seat.ts×1 verdict.ts×3 | boundary-not-born-held-3540.test.ts×1 createMemo.test.ts×1 error-staged-recovery.test.ts×1 fuzz-findings-l2.test.ts×1 ispending-memo-unstamped-hold-3457.test.ts×2 latest-isPending-consistency.test.ts×3 latest-uninitialized-over-latest-4362.test.ts×1 verdict-contract.test.ts×2 verdict-memo-flight-no-reask.test.ts×1 | [ruled] `[isPending(x), x()]` is atomic within one scope — `[isPending(x), x()]` read in one scope is atomic: a reader that observed the fresh value must not see `pending === true` for it. |
57+
| A10 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:191` | async.ts×1 core.ts×3 lanes.ts×1 scheduler.ts×1 seat.ts×2 verdict.ts×3 | boundary-not-born-held-3540.test.ts×1 createMemo.test.ts×1 error-staged-recovery.test.ts×1 fuzz-findings-l2.test.ts×1 ispending-memo-unstamped-hold-3457.test.ts×2 latest-isPending-consistency.test.ts×3 latest-uninitialized-over-latest-4362.test.ts×1 verdict-contract.test.ts×2 verdict-memo-flight-no-reask.test.ts×1 | [ruled] `[isPending(x), x()]` is atomic within one scope — `[isPending(x), x()]` read in one scope is atomic: a reader that observed the fresh value must not see `pending === true` for it. |
5858
| A11 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:103` | — | latest-isPending-consistency.test.ts×1 loading-fallback-in-flush-3540.test.ts×2 visibility-oracle-store.states.ts×2 visibility-oracle.states.ts×1 | [ruled] Sync derivations of held sources are visible through `latest()`/`isPending()` — Sync derivations of transition-held sources are visible through `latest()`/`isPending()` (held sync recompute is… |
5959
| A12 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:199` | — | createOptimistic.test.ts×2 spec-async-semantics.test.ts×1 | [ruled, amended in place] Resting optimistic nodes report pending like a plain memo — A resting optimistic node reports pending via exactly the causes a plain async memo does (A19) — a reverting optim… |
6060
| A13 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:207` | — | spec-async-semantics.test.ts×7 | [ruled 2026-07-06 (promoted from B1)] Resting optimistic ≡ plain async memo at every checkpoint — (was B1) A resting optimistic node (no active override) is observationally identical to a plain async … |
@@ -83,10 +83,10 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
8383

8484
| id | status | defined | cited in src | cited in tests | statement (at definition) |
8585
|---|---|---|---|---|---|
86-
| V1 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:480` | seat.ts×5 | spec-async-semantics.test.ts×7 | - **V1 (violated A13) — FIXED.** A _resting_ optimistic node reported |
87-
| V2 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:490` | seat.ts×2 | spec-async-semantics.test.ts×2 | - **V2 (violated A7/A13) — FIXED.** `latest()`'s verdict in the window was |
86+
| V1 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:480` | seat.ts×7 | spec-async-semantics.test.ts×7 | - **V1 (violated A13) — FIXED.** A _resting_ optimistic node reported |
87+
| V2 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:490` | seat.ts×3 | spec-async-semantics.test.ts×2 | - **V2 (violated A7/A13) — FIXED.** `latest()`'s verdict in the window was |
8888
| V3 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:496` | seat.ts×4 | spec-async-semantics.test.ts×2 | - **V3 (violated A19) — FIXED.** After a reporter-less transition completed, |
89-
| V4 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:503` | seat.ts×3 | spec-async-semantics.test.ts×5 | - **V4 (violated the old A20's three-form algebra) — FIXED, then the rule it |
89+
| V4 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:503` | seat.ts×4 | spec-async-semantics.test.ts×5 | - **V4 (violated the old A20's three-form algebra) — FIXED, then the rule it |
9090
| V5 | live | `docs/SPEC-ASYNC-SEMANTICS.md:515` | scheduler.ts×1 | spec-async-semantics.test.ts×3 | - **V5 (A17 corollary — found and fixed with the revert-target elimination, |
9191
## B — tier B
9292

@@ -380,12 +380,12 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
380380
|---|---|---|---|---|---|
381381
| §1 | live | `docs/INTERNALS-STORE-STATE.md:27` | seat.ts×1 target.ts×1 | reveal-gating-contract.test.ts×1 | Storage model (the single-home rule) |
382382
| §2 | live | `docs/INTERNALS-STORE-STATE.md:81` | — | — | Read paths |
383-
| §3 | live | `docs/INTERNALS-STORE-STATE.md:116` | core.ts×2 optimistic.ts×1 reconcile.ts×1 store.ts×2 | seat-shadow-report.ts×1 | Write paths (all must stay equivalent) |
383+
| §3 | live | `docs/INTERNALS-STORE-STATE.md:116` | core.ts×2 seat.ts×5 optimistic.ts×1 reconcile.ts×1 store.ts×2 | seat-shadow-report.ts×1 | Write paths (all must stay equivalent) |
384384
| §4 | live | `docs/INTERNALS-STORE-STATE.md:200` | seat.ts×2 | seat-shadow-report.ts×1 | Identity rules |
385385
| §5 | live | `docs/INTERNALS-STORE-STATE.md:221` | store.ts×1 target.ts×1 | — | Laziness invariants (candidates for `__TEST__` assertions) |
386386
| §5b | live | `docs/INTERNALS-STORE-STATE.md:239` | target.ts×2 | — | Creation budget (phase-1 fitness) |
387387
| §5c | live | `docs/INTERNALS-STORE-STATE.md:258` | — | — | Comparison method (shipped vs rewrite) |
388-
| §6 | live | `docs/INTERNALS-STORE-STATE.md:309` | seat.ts×3 target.ts×1 | — | Structural edits — the key-set node (resolves O2, RUL-8) |
388+
| §6 | live | `docs/INTERNALS-STORE-STATE.md:309` | core.ts×1 seat.ts×4 target.ts×1 | — | Structural edits — the key-set node (resolves O2, RUL-8) |
389389
| §6b | live | `docs/INTERNALS-STORE-STATE.md:337` | — | adoption-lane-rollback.test.ts×1 | Lane-aware adoption (RUL-5) |
390390
| §6c | live | `docs/INTERNALS-STORE-STATE.md:356` | — | createProjection.async.test.ts×1 flight-owned-transaction.test.ts×1 | Store-wide status gating (RUL-7) |
391391
| §6d | live | `docs/INTERNALS-STORE-STATE.md:369` | reconcile.ts×2 target.ts×2 | — | Diff reachability (RUL-11) |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ import {
127127
shadowEnter,
128128
shadowExpect,
129129
shadowLeave,
130+
shadowHeadState,
130131
shadowSeatClose,
131132
shadowSeatOpen,
132133
shadowThrown
@@ -360,6 +361,9 @@ export function recompute(el: Computed<any>, create: boolean = false): void {
360361
bumpNotifyEpoch();
361362
const isEffect = (el as any)._type;
362363
let released: Computed<any>[] | undefined;
364+
// Shadow seat, per hold: the node's own hold before the held re-pass arm
365+
// below drops a verdict reader's staging (seat-per-hold.md §6).
366+
if (__TEST__) shadowHeadState(el);
363367
// Lanes (plan sec. 28): the seat of a pass is its node's. A node carrying a lane's
364368
// derived value runs as the lane's whoever dirtied it — a sync write, a
365369
// boundary reset, a frame rerun — so its children and its result are the

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,17 @@ export function insertSubs(node: Signal<any> | Computed<any>): void {
13841384
if (__OBSERVE__ && fanOut >= GRAPH_SIZE_WARN_AT) noteFanOut(node, fanOut);
13851385
}
13861386

1387+
/** Shadow seat (seat.ts, `__TEST__`): told of the render effects
1388+
* `laneDirty` makes verdict readers. Set by seat.ts at load (no import
1389+
* here: seat.ts imports this module). */
1390+
export let shadowLaneDirtyHook:
1391+
| ((c: Computed<any>, node: Signal<any> | Computed<any>) => void)
1392+
| null = null;
1393+
export function setShadowLaneDirtyHook(
1394+
f: (c: Computed<any>, node: Signal<any> | Computed<any>) => void
1395+
): void {
1396+
shadowLaneDirtyHook = f;
1397+
}
13871398
/** Lane work re-staged (lanes.ts; `recompute`): the lane's members among
13881399
* its subscribers re-derive as the lane's work (REACTIVE_LANE_DIRTY), their
13891400
* runs held with it — not as stale readers republishing the committed view
@@ -1404,8 +1415,10 @@ export function laneDirty(node: Signal<any> | Computed<any>, l: Transaction): vo
14041415
for (let s = node._subs; s !== null; s = s._nextSub) {
14051416
const c = s._sub,
14061417
t = c._x?._transaction;
1407-
if ((c as any)._type === EFFECT_RENDER && node._config & CONFIG_VERDICT)
1418+
if ((c as any)._type === EFFECT_RENDER && node._config & CONFIG_VERDICT) {
14081419
((c._config |= CONFIG_VERDICT), (c._flags &= ~REACTIVE_LANE_DIRTY));
1420+
if (__TEST__ && shadowLaneDirtyHook !== null) shadowLaneDirtyHook(c, node);
1421+
}
14091422
if (t?._lane ? sameLane(t, l) : (c as any)._type) c._flags |= REACTIVE_LANE_DIRTY;
14101423
}
14111424
}

0 commit comments

Comments
 (0)