Skip to content

Commit ed85ca2

Browse files
fix(signals): a lazy memo woken after a missed landing catches up on the committed world (#4474)
Ruling (2026-10-30): laziness is never observable (D-22). A memo released unread at its source's landing (#2934) and woken in a flush that re-asks the source reads as a memo a prior reader kept alive would: `latest()` of it is the landed value and `isPending()` of it `true`, in either read order within the mount. The fix is at the wake (`wake`, core.ts) and distinguishes two dormant memos. One with a committed value re-runs on this flush's world; its plain read of a flight with a committed value is served that value (`read`) instead of throwing — the landing it missed — and after the pass it is marked pending on each such flight, as `propagateStatus` would have. One with no committed value (`commitPendingNode` keeps a released node uninitialized) catches up on the committed world: a staging of this flush is read as its committed value (`read`, `serve`, `verdictValue`) and the memo re-derives over the staging or verdict lane after. A first landing's staging and the memo's own staged landing are not a screen's. Verdict readers and boundary outputs are re-derived rather than marked (A19); a catch-up that errored re-derives at the landing (`_blocked`, D-41). Also: a pass thrown on a flight clears `_pendingSources` beside setting `_blocked`, so the retry at the landing is not skipped as already waited (the generator's seed 7 #6390 regressed without it). Co-authored-by: Cursor <[email protected]>
1 parent 25b94f0 commit ed85ca2

11 files changed

Lines changed: 864 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 memo released unread at its source's landing (#2934) and woken in a flush that re-asks the source now reads as a memo a prior reader kept alive would: `latest()` of it is the landed value and `isPending()` of it is `true`, in either read order — laziness is never observable (D-22, #4474). A dormant memo's wake pass is served the committed value of a flight it reads and is then marked pending on that flight; one with no committed value catches up on the committed world (the screen) and re-derives over this flush's staging or verdict lane after; a released node stays uninitialized through the commit sweep so its wake does compute.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ An armed boundary catches a lane the same way it catches a transition (D-12, D-1
182182

183183
`latest(x)` answers the held write (the newest value a flush has processed, held or not — for a memo nobody has read, the value the flushes it missed would have given it), the optimistic value where one displays, the arrived truth under a superseded override, and the committed value of a node whose own flight is up (below the async nothing newer exists). A sync derivation of a held source is visible through it (the held recompute is a write path like any other). It throws `NotReadyError` only when no value has been produced — before a first landing, including an async memo with no resolution — in every scope. It returns `T`, never `undefined`. A lane held on async downstream of the read does not paint, and does not hide a value `latest` can already return. A memo behind a fallback, or in a branch not yet attached, has still produced its value, so `latest` returns it — a memo born held included: its plain read throws, and `latest` returns its pending value (F-9). Resolved async never pairs `[false, undefined]`. **A first landing a hold carries is a produced value (clarified 2026-10-28, amended 2026-10-30):** an async memo's first answer that lands in the same tick as a write to its input that a hold carries — an action's, or a plain write re-asking it — is held with it (D-4), and `latest` of it returns that answer while the plain read still throws (F-9); a `Loading` whose only read is `latest` of it shows the answer now (S-40). The frame is whole: the screen's committed input beside the answer to it. **A memo nobody has read has still produced what the flushes it missed would have given it (ruled 2026-10-30, #4474):** `latest` of a lazy memo whose sources have committed values is that value, computed on the committed world (laziness is never observable — #3078, #4366, #4474). An identity memo over an async memo, read for the first time in the flush that re-asks the async memo, shows the async memo's landed answer and is pending on the re-ask, the same screen as with a prior reader of it; a plain read of it in that mount is not display-ahead (D-27): its reader is born held (D-2) and shows the re-ask's answer. **Inside a flush, `latest()` of a staging not yet held is the frame's read like any other (clarified 2026-10-28):** it serves the staging, opens no hold, and leaves a plain read beside it in the same pass reading the staging too (F-10: one frame for every channel); if the flush parks, the pass re-derives once as a verdict reader (D-2, A10). A `latest()` read that manufactured a hold for the frame so its pass could run once made the plain reads after it see the screen in a flush that then committed (#4365).
184184

185-
**Collapses:** [A28](./SPEC-ASYNC-SEMANTICS.md#a28-a-write-becomes-visible-at-flush--to-every-channel) (`latest` reads the flushed staged world), [A11](./SPEC-ASYNC-SEMANTICS.md#a11-sync-derivations-of-held-sources-are-visible-through-latestispending), [A7](./SPEC-ASYNC-SEMANTICS.md#a7-resolved-async-never-reads-false-undefined), [A17](./SPEC-ASYNC-SEMANTICS.md#a17-an-active-override-is-the-displayed-value-until-its-transaction-commits-and-the-graphs-value-until-its-own-source-answers) (`latest` returns the arrived value). **Status:** standing. **Deviation today:** a lazy memo released unread at its source's landing (#2934) and woken in a flush that re-asks the source has no value; latest of it returns undefined, a plain read of it is born held. Ruled 2026-10-30: it has the value the missed flush would have given it (laziness is never observable). Fix belongs at the wake, both read orders (#4474). Pinned `it.fails` at the ruled screen in `tests/latest-unread-identity-memo-4474.test.ts`; a memo in a root is never released and already reads as ruled.
185+
**Collapses:** [A28](./SPEC-ASYNC-SEMANTICS.md#a28-a-write-becomes-visible-at-flush--to-every-channel) (`latest` reads the flushed staged world), [A11](./SPEC-ASYNC-SEMANTICS.md#a11-sync-derivations-of-held-sources-are-visible-through-latestispending), [A7](./SPEC-ASYNC-SEMANTICS.md#a7-resolved-async-never-reads-false-undefined), [A17](./SPEC-ASYNC-SEMANTICS.md#a17-an-active-override-is-the-displayed-value-until-its-transaction-commits-and-the-graphs-value-until-its-own-source-answers) (`latest` returns the arrived value). **Status:** standing.
186+
187+
**Status (2026-10-30, #4474): laziness is never observable (#3078, #4366, #4474).** A memo released unread at its source's landing (#2934: the settle walk queues its retry, then releases it as nothing reads it, and the release takes the retry with it) has missed that landing; woken in a flush that re-asks the source, it reads as the memo a prior reader would have kept alive — `latest` of it is the landed value (`2`), `isPending` of it `true`, and a plain read of it born held on the re-ask (D-2) — in every read order within the mount. The fix is at the wake, in core (`wake`, `core.ts`), and distinguishes two dormant memos. One with a committed value re-runs on this flush's world as any pass does; its plain read of a flight whose first answer has landed is served that value (`read`) instead of throwing — the landing it missed — and after the pass the memo is marked pending on each such flight, as `propagateStatus` would have marked it. One with no committed value (`commitPendingNode` keeps a released node uninitialized, so its wake does compute) runs a catch-up on the committed world: it reads the screen — a staging of this flush is read as its committed value, a held node's too (`read`, `serve`, `verdictValue`), a verdict window of its own answers for the screen and routes the pass nowhere — commits that as the memo's value, and then re-derives in this flush, as the memo a prior reader kept alive was re-derived by the write's fan-out (a staging) or by its source going pending (a window, A19): that pass stages, or is the verdict lane's, over the catch-up. Two stagings are not a screen's: a first landing's (the source is uninitialized; its staging is its only value, served, and the pass that read it is the landing's own — no re-derive, as an async catch-up would ask twice), and the memo's own (a memo released in flight whose answer is queued for this commit is not a catch-up: `wake` only catches up a memo with nothing pending). A verdict reader or a boundary's output (CONFIG_VERDICT, CONFIG_REDERIVE) is re-derived rather than marked, as `propagateStatus` treats it. A held flight is not served: the pass joins its hold as before (D-27). A catch-up that errored has no value to carry through a flight: it re-derives at the landing (`_blocked`, D-41). An async memo's catch-up asks the flight the missed landing would have asked; its landing is superseded by the re-ask's (`asyncWrite`, `_inFlight`) — no guard, as a guard would be the one observable difference. A `lazy: true` memo's first computation is not a wake (on demand by its option's contract, a first pass of this flush's world). Pins: `tests/latest-unread-identity-memo-4474.test.ts` (both read orders, `isPending`, a prior-reader control, a memo in a root), `tests/latest-unread-async-memo-4474.test.ts` (the lazy memo itself async, against its eager twin), `tests/latest-unread-errored-memo-4474.test.ts` (a catch-up that throws), `web/test/latest-unread-identity-memo-4474.spec.tsx` (the issue's `<Loading>` shape, with and without a plain read beside the verdict), `web/test/async-gen/e7-lazy-catch-up-4474.spec.ts` (the generator's forms against the eager twin: a verdict reader's wake, a catch-up under a write reading the screen, a nested `Show` on `latest` of a woken memo). Open beside it: the store form (E3) of seed 7 #21333 shows the leaf empty where the signal form now shows the eager value — the same screen as before the fix, a store-path discrepancy this fix does not touch; and seed 91501 #15992 (E8, pinned `test.fails` in the same file): a catch-up whose sources have no committed value has no screen to read — one flush carrying a first landing, a lane's write and the remount that wakes the memo, the eager twin computes once in the lane while the catch-up pairs the committed signal with the landing and its re-derive, pulled under the leaf's lane pass, errors into a reader with no value. The seed 7 #39283 E3/E7 difference is the eager twin's (#4417's empty slot where the lazy memo shows S-46's `[F]`).
186188

187189
### D-23. `isPending(x)`: three causes, two exceptions, question-scoped, atomic with the value
188190

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
6363
| A16 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:223` | scheduler.ts×1 | latest-uninitialized-over-latest-4362.test.ts×2 spec-async-semantics.test.ts×1 strict-read-pending-store.test.ts×2 uninitialized-visibility.test.ts×1 visibility-oracle-store.states.ts×2 visibility-oracle.states.ts×2 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from B5)] `isPending` never throws in untracked contexts — (was B5) `isPending` never throws in untracked contexts — thunks that throw real errors or read… |
6464
| A17 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:71` | async.ts×3 constants.ts×1 lanes.ts×7 scheduler.ts×2 seat.ts×1 verdict.ts×1 map.ts×1 optimistic.ts×1 store.ts×3 | create-deferred-3710.test.ts×1 fuzz-findings-l2.test.ts×6 lane-uninitialized-landing-3648.test.ts×5 optimistic-over-held-row-3796.test.ts×1 optimistic-read-lane-not-transaction-3698.test.ts×2 optimistic-undefined-override.test.ts×1 posture-store-parity.test.ts×1 refresh-await.test.ts×1 reveal-gating-contract.test.ts×3 spec-async-semantics.test.ts×10 createOptimisticStore.test.ts×2 kanban-a17-fixture.test.ts×3 optimistic-list-mutation-matrix.test.ts×1 optimistic-maparray-index-frame-f1.test.ts×1 optimistic-untracked-reads-f3-f5.test.ts×1 signal-store-twins-qd.test.ts×1 treeshake.test.ts×1 until.test.ts×1 visibility-oracle-store.states.ts×24 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×20 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from C4)] An active override is the displayed value until its transaction commits, and the graph's value until its own source answers — **Statement (curre… |
6565
| A18 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:81` | action.ts×1 async.ts×2 core.ts×3 lanes.ts×8 scheduler.ts×2 types.ts×1 verdict.ts×1 map.ts×1 optimistic.ts×1 projection.ts×1 | body-end-supersession-visibility.test.ts×4 createOptimistic.test.ts×3 l2-fuzz-existing-rules.test.ts×2 lane-contract.test.ts×1 lane-frame-deferred-run-3662.test.ts×1 lane-outside-view.test.ts×1 lane-uninitialized-landing-3648.test.ts×5 optimistic-move-duplicate-3548.test.ts×2 optimistic-read-lane-not-transaction-3698.test.ts×4 posture-store-parity.test.ts×5 spec-async-semantics.test.ts×5 flight-owned-transaction.test.ts×1 lane-authority-twins.test.ts×1 optimistic-list-mutation-matrix.test.ts×1 optimistic-untracked-reads-f3-f5.test.ts×1 signal-store-twins-qd.test.ts×1 unchanged-presence-no-hold-3743.test.ts×2 superseded-before-first-commit.test.ts×4 visibility-oracle-store.states.ts×8 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×19 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-07 (promoted from B4)] An override lives exactly as long as its own transaction; a newer truth from the source supersedes it in the graph immediately, on screen at com… |
66-
| A19 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:151` | async.ts×1 constants.ts×1 core.ts×6 lanes.ts×1 scheduler.ts×2 seat.ts×1 types.ts×1 verdict.ts×6 store.ts×2 | create-deferred-3710.test.ts×2 derived-store-first-landing-verdict.test.ts×1 fuzz-findings-l2.test.ts×4 lane-uninitialized-landing-3648.test.ts×2 latest-memo-inline-parity.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×2 mount-over-foreign-hold-3761.test.ts×2 spec-async-semantics.test.ts×3 derived-presence-async-3726.test.ts×2 superseded-before-first-commit.test.ts×3 uninitialized-visibility.test.ts×1 verdict-memo-flight-no-reask.test.ts×2 visibility-oracle-store.states.ts×8 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×14 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-07-07 (promoted from C1)] `isPending(x)` ≡ the observable value is not final (three causes) — (was C1 — **partially reverses an earlier decision**) **Definition: `isPendi… |
66+
| A19 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:151` | async.ts×1 constants.ts×1 core.ts×10 lanes.ts×1 scheduler.ts×2 seat.ts×1 types.ts×1 verdict.ts×6 store.ts×2 | create-deferred-3710.test.ts×2 derived-store-first-landing-verdict.test.ts×1 fuzz-findings-l2.test.ts×4 lane-uninitialized-landing-3648.test.ts×2 latest-memo-inline-parity.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×2 mount-over-foreign-hold-3761.test.ts×2 spec-async-semantics.test.ts×3 derived-presence-async-3726.test.ts×2 superseded-before-first-commit.test.ts×3 uninitialized-visibility.test.ts×1 verdict-memo-flight-no-reask.test.ts×2 visibility-oracle-store.states.ts×8 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×14 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-07-07 (promoted from C1)] `isPending(x)` ≡ the observable value is not final (three causes) — (was C1 — **partially reverses an earlier decision**) **Definition: `isPendi… |
6767
| A20 | superseded | `docs/SPEC-ASYNC-SEMANTICS.md:410` | — | question-scoped-pending.test.ts×2 spec-async-semantics.test.ts×3 createOptimisticStore.test.ts×1 | [superseded 2026-07-13 by A24] (superseded) Optimistic writes announce a store-wide pending — (**SUPERSEDED 2026-07-13 by A24** — the mask is deleted; optimistic writes are verdict-inert. Kept for the… |
6868
| A21 | superseded | `docs/SPEC-ASYNC-SEMANTICS.md:417` | — | question-scoped-pending.test.ts×3 spec-async-semantics.test.ts×3 | [superseded 2026-07-13 by A24] (superseded) The store-wide mask — (**SUPERSEDED 2026-07-13 by A24** — the store-wide mask is deleted with the mask model; nothing silences a new question. The effective… |
6969
| A22 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:231` | store.ts×1 | createProjection.draft-lifetime-3585.test.ts×1 spec-async-semantics.test.ts×1 visibility-oracle-store.states.ts×1 | [ruled, amended in place 2026-07-08] Pending is per-node; store-wide only for the firewall's own work — **Pending is per-node: store-wide verdicts exist only as the firewall's own in-flight work (A9) … |

0 commit comments

Comments
 (0)