Skip to content

Commit b26f40e

Browse files
committed
fix(signals): a Show branch mounted by a held write reads the value that mounted it (#4010)
A binding in a branch a held pass mounted is a member of that pass's held frame (ruling A): the branch exists only in the transaction. Only a member that had never run (STATUS_UNINITIALIZED) was treated as born into it; one whose first pass published before the seam held it was served the committed screen whenever it ran again before the landing — `frameRead` made it a stale reader, `recompute` published it mainline, and `stagedScreen` served a verdict reader the committed value in the transaction's own flush. A non-keyed Show's narrowed accessor then read the committed `null` and threw into <Errored>; since #3977 an unchanged landing left the error up. The park seam now flags every member of a held pass's frame (CONFIG_HELD_FRAME, cleared by its commit), and `bornInto(c, t)` — held by t and uninitialized or flagged — replaces the uninitialized-only test in `recompute`, `frameRead` and `stagedScreen`. `observeFlight` likewise no longer serves such a verdict reader the committed value of its own transaction's flight: it waits with its frame. Without that, a member that probes and reads the flight let the transaction land under it and was re-derived into a fresh observation every round (an infinite flush loop). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NcUAu8BQ6Xsf8XRBhr9V1w
1 parent d8ba741 commit b26f40e

10 files changed

Lines changed: 317 additions & 30 deletions
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 branch a held write mounts reads the value that mounted it on every pass. A binding in the new branch of a non-keyed `<Show>` that ran again before the landing — because it probes `isPending` on data the same write started loading, or because a live write reached it — was served the committed screen, where the condition is still `null`, and threw into `<Errored>` (where an unchanged landing then left the error up). Members of the frame a held pass built are now flagged at the park seam and read their transaction's world whichever flush runs them; a verdict reader among them waits on the transaction's flight with its frame instead of being served the committed value (#4010).

‎packages/signals/docs/INTERNALS-ASYNC-STATE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ ruling. Anything marked `[ruled]` cites the decision.
1717

1818
**State.** A node is `_value` (committed) or `_pendingValue` (staged for this flush). Cold state lives on the node's extension `_x`: `_transaction` (the `Transaction` holding it, `CONFIG_HELD`), `_lane` (a lane's value for it, `CONFIG_OVERRIDE`; `CONFIG_GUESS` for a written guess), `_q` (the question a flight answers — A18 provenance), `_reask` (a quiet re-ask's classification, A19 exc. 2), `_marks` (`affects()` count), `_pendingSources`/`_inFlight`/`_error` (the async core, unchanged). Per-pass flags on `_flags`: `REACTIVE_JOINED` (the pass read the future), `REACTIVE_FRAME_READ` (a stale reader, re-derived at the landing), `REACTIVE_STAGED_READ` (the pass read this flush's staging as the screen), `REACTIVE_LANE_READ`/`REACTIVE_SCREEN_READ` (lane work), `REACTIVE_PROBE_UNANSWERED` (a verdict probe answered before the flush had a transaction), `REACTIVE_REASK`, `REACTIVE_ZOMBIE` (a parked frame's child).
1919

20-
**Transaction** (`core/scheduler.ts`): `_nodes` (what it holds), `_reruns` (stale readers to re-derive at its landing), `_queues` (stashed effect runs), `_open` (actions running in it), `_lane`/`_parent`/`_verdict`/`_shown`/`_held` (lanes), `_into` (merged — `resolveTx`), `_marks`. The flush's seam (`settle`): run the heap; the lane corrections; `joinFuture` decided the flush's transaction (a pass went pending, a read of a held node joined); every staged node of the flush is held (`holdNode`) with its pass's frame (`holdFrame`) — a loading source is nobody's frame, a tick that nets to the committed value is no proposal (A34 (2)) — and the store holds the node-less stagings (`_storePark`); the lane seams; every transaction no frame waits on lands (`land`: `commitPendingNode` over `_nodes`, `reruns`, `releaseQueues`); the store folds (`_storeCommit`). `blocked(t)`: an open action, or a pending node it holds that a frame reader observes (`blockedBy`/`onScreen`), or a lane under it blocked. Membership is one relation (`merge`), so the direction rule (SPEC "The hold model — L2", 2026-10-06: a hold never waits on work that has never committed) is implemented where a node's commit status is checked — the loading-source skip, the boundary scope, the born-held enqueue and landing — not by the transaction.
20+
**Transaction** (`core/scheduler.ts`): `_nodes` (what it holds), `_reruns` (stale readers to re-derive at its landing), `_queues` (stashed effect runs), `_open` (actions running in it), `_lane`/`_parent`/`_verdict`/`_shown`/`_held` (lanes), `_into` (merged — `resolveTx`), `_marks`. The flush's seam (`settle`): run the heap; the lane corrections; `joinFuture` decided the flush's transaction (a pass went pending, a read of a held node joined); every staged node of the flush is held (`holdNode`) with its pass's frame (`holdFrame`; its members are flagged `CONFIG_HELD_FRAME` until their commit — born into the transaction, `bornInto`: they read its world whichever flush runs them, #4010) — a loading source is nobody's frame, a tick that nets to the committed value is no proposal (A34 (2)) — and the store holds the node-less stagings (`_storePark`); the lane seams; every transaction no frame waits on lands (`land`: `commitPendingNode` over `_nodes`, `reruns`, `releaseQueues`); the store folds (`_storeCommit`). `blocked(t)`: an open action, or a pending node it holds that a frame reader observes (`blockedBy`/`onScreen`), or a lane under it blocked. Membership is one relation (`merge`), so the direction rule (SPEC "The hold model — L2", 2026-10-06: a hold never waits on work that has never committed) is implemented where a node's commit status is checked — the loading-source skip, the boundary scope, the born-held enqueue and landing — not by the transaction.
2121

22-
**Read** (`core/core.ts`): the fast block for a plain signal; `frameRead` (a render effect, a verdict reader, lane work — the screen, `staleReader`); `joinPass` (a held node's staging — the pass is the transaction's); `stagedRead` (this flush's staging as the screen); a pending node served committed to a frame reader (`_observeFlight` — the verdict module's hook). `recompute` decides the pass's frame after the pass (`CONFIG_STAGED`, held children, zombies).
22+
**Read** (`core/core.ts`): the fast block for a plain signal; `frameRead` (a render effect, a verdict reader, lane work — the screen, `staleReader`; not a reader born into the node's transaction, `bornInto`: it has no screen); `joinPass` (a held node's staging — the pass is the transaction's); `stagedRead` (this flush's staging as the screen); a pending node served committed to a frame reader (`_observeFlight` — the verdict module's hook). `recompute` decides the pass's frame after the pass (`CONFIG_STAGED`, held children, zombies).
2323

2424
**Lanes** (`core/lanes.ts`): `optimisticWrite` → `pendingGuesses` → `applyGuesses` at the seam opens the lane under the frame's transaction; `laneValueOf`/`display`/`guessedValueOf`; `enterLane`/`laneRead` (lane work; untracked reads enter); `laneWrite` (a landing on a lane's node — `stale(el, question)` holds an older answer beneath the guess, `supersede` resolves a differing truth); `laneOutcome`; `dissolveLane`/`endLanes`; `laneSeam` (blocked parks, unblocked shows); `_laneSeams` (passes that read a parked staging re-derive); `linkBlocked`; `_laneRebase` is the store's (keyed re-base of an older truth beneath an arrangement guess).
2525

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
7373
| A26 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:111` | — | action-await-contract.test.ts×2 fuzz-findings-l2.test.ts×1 posture-store-parity.test.ts×2 visibility-oracle-store.states.ts×2 visibility-oracle.states.ts×1 visibility-oracle.test.ts×1 | [ruled 2026-07-17] An ambient transaction window is one flush; parking is flush-driven — (**ruled 2026-07-17**, #2913; **enforcement hardened 2026-08-31**, #3141 — parking is flush-driven, and a trans… |
7474
| A27 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:301` | — | loading-value.test.ts×2 visibility-oracle.states.ts×18 visibility-oracle.test.ts×1 | [ruled 2026-08-10] The commit-#0 loading window is loading-class and verdict-quiet — (**ruled 2026-08-10**) **The commit-#0 loading window is loading-class and verdict-quiet.** A node born committed v… |
7575
| A28 | ruled, mechanism landed | `docs/SPEC-ASYNC-SEMANTICS.md:95` | constants.ts×1 core.ts×12 lanes.ts×2 scheduler.ts×3 types.ts×1 verdict.ts×2 store.ts×4 | createOptimistic.test.ts×5 fuzz-findings-l2.test.ts×6 held-derivation-not-a-proposal-3612.test.ts×1 issue-3800-repro.test.ts×1 latest-held-till-flush.test.ts×1 posture-store-parity.test.ts×5 question-scoped-pending.test.ts×3 snapshot-derived-store-rows.test.ts×1 createOptimisticStore.test.ts×10 optimistic-draft-visibility-3665.test.ts×5 optimistic-list-mutation-matrix.harness.ts×1 optimistic-list-mutation-matrix.test.ts×2 shallow.test.ts×1 woken-transaction-adopts-staged-bump.test.ts×1 treeshake.test.ts×2 verdict-contract.test.ts×1 visibility-oracle-store.states.ts×8 visibility-oracle.states.ts×8 | [ruled, mechanism landed 2026-09-15] A write becomes visible at flush — to every channel — (**ruled 2026-09-08**; supersedes the #2922 mid-tick pull) **A write becomes visible at flush — to every chan… |
76-
| A29 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:119` | boundaries.ts×1 action.ts×1 constants.ts×1 core.ts×13 effect.ts×1 lanes.ts×1 scheduler.ts×4 signals.ts×1 store.ts×1 | adoption-unchanged-key-read-3706.test.ts×9 body-end-supersession-visibility.test.ts×1 born-held.test.ts×3 boundary-not-born-held-3540.test.ts×4 createProjection.draft-lifetime-3585.test.ts×1 direct-commit-readers-posture.test.ts×1 fuzz-findings-l2.test.ts×6 held-conditional-memo.test.ts×1 held-frame-dependencies.test.ts×2 held-truth-lane-only.test.ts×3 l2-contract.test.ts×1 latest-held-till-flush.test.ts×2 loading-fallback-in-flush-3540.test.ts×6 loading-on-frame-following-3540.test.ts×1 mount-over-foreign-hold-3761.test.ts×1 optimistic-mount-nested-memo-3835.test.ts×1 optimistic-read-lane-not-transaction-3698.test.ts×3 posture-born-held-and-observation.test.ts×1 posture-store-parity.test.ts×6 derived-presence-async-3726.test.ts×3 optimistic-untracked-reads-f3-f5.test.ts×1 store-unchanged-read-independent-write-3688.test.ts×1 tick-scoped-pass-transaction.test.ts×2 treeshake.test.ts×3 verdict-mount-first-pass-3851.test.ts×2 verdict-mount-loading-flush-loop.test.ts×2 visibility-oracle-store.states.ts×5 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×9 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-09-13 (#3408)] A tracked read served a live transaction's staged value enters that transaction — A tracked computation served a node's staged `_pendingValue` — a value a … |
76+
| A29 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:119` | boundaries.ts×1 action.ts×1 constants.ts×1 core.ts×14 effect.ts×1 lanes.ts×1 scheduler.ts×4 signals.ts×1 store.ts×1 | adoption-unchanged-key-read-3706.test.ts×9 body-end-supersession-visibility.test.ts×1 born-held.test.ts×3 boundary-not-born-held-3540.test.ts×4 createProjection.draft-lifetime-3585.test.ts×1 direct-commit-readers-posture.test.ts×1 fuzz-findings-l2.test.ts×6 held-branch-verdict-reader-4010.test.ts×1 held-conditional-memo.test.ts×1 held-frame-dependencies.test.ts×2 held-truth-lane-only.test.ts×3 l2-contract.test.ts×1 latest-held-till-flush.test.ts×2 loading-fallback-in-flush-3540.test.ts×6 loading-on-frame-following-3540.test.ts×1 mount-over-foreign-hold-3761.test.ts×1 optimistic-mount-nested-memo-3835.test.ts×1 optimistic-read-lane-not-transaction-3698.test.ts×3 posture-born-held-and-observation.test.ts×1 posture-store-parity.test.ts×6 derived-presence-async-3726.test.ts×3 optimistic-untracked-reads-f3-f5.test.ts×1 store-unchanged-read-independent-write-3688.test.ts×1 tick-scoped-pass-transaction.test.ts×2 treeshake.test.ts×3 verdict-mount-first-pass-3851.test.ts×2 verdict-mount-loading-flush-loop.test.ts×2 visibility-oracle-store.states.ts×5 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×9 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-09-13 (#3408)] A tracked read served a live transaction's staged value enters that transaction — A tracked computation served a node's staged `_pendingValue` — a value a … |
7777
| A30 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:257` | async.ts×3 attribution.ts×1 constants.ts×1 core.ts×1 effect.ts×1 lanes.ts×1 scheduler.ts×5 | async-landing-deps-3461.test.ts×3 fuzz-findings-l2.test.ts×3 held-conditional-effect.test.ts×1 held-conditional-memo.test.ts×1 held-frame-dependencies.test.ts×2 ispending-in-boundary-on-3528.test.ts×1 lane-frame-deferred-run-3662.test.ts×1 lane-frame-held-lane-3662.test.ts×1 posture-born-held-and-observation.test.ts×1 treeshake.test.ts×2 write-proposals-3494.test.ts×2 zombie-rerun-after-commit-3546.test.ts×2 | [ruled 2026-09-13 (#3410)] A memo's dependencies are the committed frame's until the frame is replaced — A pass that _staged_ its value has not replaced the committed frame, so the committed value sti… |
7878
| A31 | live | `docs/SPEC-ASYNC-SEMANTICS.md:131` | boundaries.ts×1 core.ts×1 lanes.ts×1 verdict.ts×2 | fuzz-findings-l2.test.ts×6 ispending-combined-atomic-3442.test.ts×1 | [live 2026-09-14 (#3442)] A memo computes under its own lane posture, never its puller's — A memo's value is one shared slot every reader sees, so its pass runs under the lane posture the memo itself … |
7979
| A32 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:139` | core.ts×4 lanes.ts×1 store.ts×1 | visibility-oracle-store.states.ts×8 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×9 visibility-oracle.test.ts×1 | [ruled 2026-09-14] Children-forbidden readers see the frame, not the graph — `createTrackedEffect` and `onSettled` callbacks are effect-phase code that runs after the frame is decided. They read the f… |

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const CONFIG_SYNC = 1 << 6;
8181
// CONFIG_HELD_CHILDREN, CONFIG_INPUTS_PUBLISHED and CONFIG_ADOPTED_UNFLUSHED
8282
// (transaction holds, zombies, until()'s authoritative view) went with the
8383
// transactions.
84-
// L2 (step 2): three bits, all maintained by the node's commit.
84+
// L2 (step 2): four bits, all maintained by the node's commit.
8585
/** The node has a pass awaiting commit: its live children (and `_disposal`)
8686
* are that pass's and were never shown — a re-pass tears them down on the
8787
* spot, while the frame parked on `_x._pendingFirstChild` keeps waiting for
@@ -94,6 +94,11 @@ export const CONFIG_STAGED = 1 << 7;
9494
* parking flush they see the committed value and hold nothing, and are
9595
* re-derived at the landing. Set at the park seam on every staged node. */
9696
export const CONFIG_HELD = 1 << 8;
97+
/** A member of the uncommitted frame a held pass built (ruling A): set at
98+
* the park seam on every computed under a staged node (`holdFrame`). Never
99+
* shown, it has no screen: its reads are its transaction's, whichever flush
100+
* runs it (`bornInto`, #4010). Cleared by its commit. */
101+
export const CONFIG_HELD_FRAME = 1 << 20;
97102
/** A15's reveal corollary (#3305): a commit published this flight's inputs
98103
* beneath it — the node was pending, nothing staged, when it committed — so
99104
* its committed value is torn against the visible frame. A render effect

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

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
CONFIG_OWNED_WRITE,
2828
CONFIG_PROMOTED,
2929
CONFIG_STAGED,
30+
CONFIG_HELD_FRAME,
3031
CONFIG_SYNC,
3132
CONFIG_TRANSPARENT,
3233
defaultContext,
@@ -111,6 +112,7 @@ import {
111112
staleReader,
112113
laneDirty
113114
} from "./scheduler.js";
115+
import type { Transaction } from "./scheduler.js";
114116
import type {
115117
Computed,
116118
Link,
@@ -306,9 +308,10 @@ export function recompute(el: Computed<any>, create: boolean = false): void {
306308
// joins all the same. Not a render effect (rule 3): it is the frame.
307309
// Re-run outside its transaction's flush it publishes mainline — the
308310
// value it staged there is superseded (`frameRead` remembers it for the
309-
// landing). A frame born into the transaction (uninitialized: never run,
310-
// A29) keeps staging: live writes keep it current, it effects at the
311-
// swap (ruling A).
311+
// landing). A frame born into the transaction (`bornInto`: never run,
312+
// A29, or mounted by a pass of it still awaiting its commit, #4010) keeps
313+
// staging: live writes keep it current, it effects at the swap (ruling
314+
// A).
312315
// A pending flight is the transition's own work (#3884). A probe on an
313316
// earlier pass left CONFIG_VERDICT, and a frame read here would serve the
314317
// committed screen, settle the flight and drop the hold — a superseding
@@ -322,7 +325,10 @@ export function recompute(el: Computed<any>, create: boolean = false): void {
322325
// world (`read`), and has left it otherwise.
323326
if (tx._lane) {
324327
} else if (isEffect !== EFFECT_RENDER && !(el._config & CONFIG_VERDICT)) joinPassTx(tx);
325-
else if (tx !== flushTransaction && !(el._statusFlags & STATUS_UNINITIALIZED)) {
328+
else if (
329+
tx !== flushTransaction &&
330+
!(el._statusFlags & STATUS_UNINITIALIZED || el._config & CONFIG_HELD_FRAME)
331+
) {
326332
// Published mainline, it is not held: the frame this pass builds is
327333
// replaced on the spot (#3404) — this flush's commit retires the
328334
// committed frame the held pass had parked (`commitPendingNode`),
@@ -1011,11 +1017,11 @@ export function joinPass(c: Computed<any>, el: Signal<any> | Computed<any>): voi
10111017
* re-derived after that transaction's landing (`_reruns`,
10121018
* REACTIVE_FRAME_READ) so the frame catches up with it once it is the
10131019
* committed world. Not a frame born into that transaction (held and never
1014-
* committed — created by one of its held passes, A29): that one reads its
1015-
* transaction's values and keeps staging. Not of a flight whose inputs are
1016-
* already visible (CONFIG_INPUTS_PUBLISHED, #3305): its committed value
1017-
* would tear against them, so the reveal observes the flight instead. Once
1018-
* per pass.
1020+
* committed — created by one of its held passes, A29; `bornInto`): that
1021+
* one reads its transaction's values and keeps staging. Not of a flight
1022+
* whose inputs are already visible (CONFIG_INPUTS_PUBLISHED, #3305): its
1023+
* committed value would tear against them, so the reveal observes the
1024+
* flight instead. Once per pass.
10191025
*
10201026
* Lane work is a stale reader too (maintainer, 2026-10-01: a lane sees the
10211027
* screen plus its own guesses). A held write is held because showing it
@@ -1053,15 +1059,24 @@ function frameRead(c: Computed<any>, el: Signal<any> | Computed<any>): boolean {
10531059
// Lane work and verdict readers are never the transaction's pass, whichever
10541060
// flush runs it: a node T holds re-enters T when it re-runs (`recompute`'s
10551061
// head), and the pass may then read a guess and become the lane's.
1056-
if (
1057-
(t === flushTransaction && passLane === null && !verdict) ||
1058-
(c._statusFlags & STATUS_UNINITIALIZED && c._config & CONFIG_HELD && txOf(c) === t)
1059-
)
1060-
return false;
1062+
if ((t === flushTransaction && passLane === null && !verdict) || bornInto(c, t)) return false;
10611063
staleReader(c, t);
10621064
return true;
10631065
}
10641066

1067+
/** A node born into transaction `t`: held by it and never committed (A29,
1068+
* ruling A) — uninitialized (born held), or a member of the frame one of its
1069+
* held passes built (CONFIG_HELD_FRAME). Its branch exists only in `t`: it
1070+
* has no screen to read, so it reads `t`'s values, whichever flush runs it,
1071+
* and keeps staging (#4010). */
1072+
export function bornInto(c: Computed<any>, t: Transaction): unknown {
1073+
return (
1074+
(c._statusFlags & STATUS_UNINITIALIZED || c._config & CONFIG_HELD_FRAME) &&
1075+
c._config & CONFIG_HELD &&
1076+
txOf(c) === t
1077+
);
1078+
}
1079+
10651080
/** The computed whose pass a creation under `owner` belongs to (a root's is
10661081
* its nearest computed ancestor's), or null outside every pass. */
10671082
function creatorPass(owner: Owner | null): Computed<any> | null {
@@ -1740,7 +1755,8 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
17401755
// effect keeps its DOM by throwing, a memo has no DOM and is handed the
17411756
// value. `[isPending(x), x()]` reads `[true, stale]` in either order (A10)
17421757
// — unless the flight committed beneath inputs already on screen
1743-
// (`observeFlight`).
1758+
// (`observeFlight`), or the reader was born into the flight's transaction
1759+
// (#4010): it has no screen, and waits on the flight with its frame.
17441760
if (
17451761
owner._statusFlags & STATUS_PENDING &&
17461762
!committed &&
@@ -1907,9 +1923,10 @@ export function stagedRead(c: Computed<any>, el?: Signal<any> | Computed<any>):
19071923
* #3322 — one run, on the committed world), or with the hold. Before any
19081924
* transaction the answer is the seam's and the reader watches it
19091925
* (verdict.ts). A node born into the future has no screen: its staging is
1910-
* its only value (A29). */
1926+
* its only value (A29). Nor has a reader born into the flush's transaction
1927+
* (`bornInto`, #4010): its branch exists only there. */
19111928
export function stagedScreen(c: Computed<any>): boolean {
1912-
if (flushTransaction === null) return false;
1929+
if (flushTransaction === null || bornInto(c, flushTransaction)) return false;
19131930
staleReader(c, flushTransaction);
19141931
return true;
19151932
}

0 commit comments

Comments
 (0)