Skip to content

Commit 25c5064

Browse files
ryansolidClaude via Cursorcursoragent
authored
fix(signals): optimistic lanes release when nothing authoritative remains; shared render effects don't entangle unrelated writes (#3426, #3427, #3407) (#3434)
Three of gabbev's optimistic/transaction reports, one theme: the pure graph does not wait where it is not forced to, and a hold is a fact about what a pass observed — never about which reader happened to exist. - #3426: the last async reader of an optimistic value unmounting mid-action releases the frame. `reporterBlocksSource` is now `sourceObserved`, shared by the settle verdict, the lane hold (`waitingTransition`) and the landing: the hold check prunes dead reporters itself. A live action parks its transaction without a verdict, so this is the only prune such a frame ever gets — the lane used to wait for a flight nobody observed. - #3427: the action body ending starts the correction (`endOptimism`, called from `flush` after the heap and before the verdict). With the bodies over (`_acted`, no live `_actions`) and nothing authoritative up — no override node's own source in flight, no held plain load the action asked for — each override's truth supersedes it as an arriving differing truth does (A18): the graph re-derives now and the transaction settles when THAT lands. Before: wait for the obsolete lane-derived flight, flash the obsolete optimistic frame, revert, re-ask — a waterfall. Display is unchanged (override on screen until commit). A co-written pending flag stays through the action's own load (attribution-holds pin); optimistic store edits keep settle-then-revert; companions snap at settlement. - #3407: a render effect's pass belongs to whatever dirtied it. `recompute` re-entered a stamped effect's transaction whenever another was active, so a sync `action` write to a signal that merely shared a hole with a held async merged into the async's transaction and waited (0:0 → 2:1) while the same plain write passed through. The stamp re-entry is memo-only now; the re-entry's one legitimate job — completing every reveal that discovered a flight — moves to the landing (`settleTransition` → `enterWaiting`). A15 amended in place: a shared reader entangles nothing by itself; only a pass that observes a flight pending joins it. Two independent flights read in one hole now land at their own times. Docs: SPEC A15 shared-hole corollary, A18 body-end corollary; INTERNALS §2/§3 mechanism notes; RULES-INDEX regenerated. Floor 23,058 → 23,195 (+78 B #3426/#3427, +59 B #3407); size-limit caps ratcheted with notes. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 7623ce1 commit 25c5064

13 files changed

Lines changed: 608 additions & 50 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
Optimistic frames release when nothing authoritative is left to wait on, and a shared render effect no longer entangles unrelated updates (#3426, #3427, #3407).
6+
7+
- The last async reader of an optimistic value unmounting mid-action releases the frame (#3426): the lane's hold check prunes dead reporters itself (`sourceObserved`, shared with the settle verdict), instead of waiting for a flight nobody observes to land.
8+
- The action body ending starts the correction (#3427): with the bodies over and no authoritative work in flight — no override node's own source, no held plain load the action asked for — each override's truth supersedes it now and the graph re-derives from it as the transaction's held work, settling when that lands. Before, the settle waited for the obsolete lane-derived flight, flashed the obsolete optimistic frame, then reverted and re-asked. A co-written flag stays through a plain load; optimistic store edits keep the settle-then-revert order.
9+
- A render effect's pass belongs to whatever dirtied it (#3407): a sync `action` write to a signal that shared a hole with a held async (`{b()}:{detailsA()}`) merged into the async's transaction and waited (`0:0 → 2:1`) while the same plain write passed through. `recompute` re-enters a stamped node's transaction for memos only; the landing of a flight enters every transaction waiting on it (`enterWaiting`), which is where the effect re-entry's one legitimate job — completing the reveals that discovered the flight — now lives. Two independent flights read in one hole land at their own times.

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

Lines changed: 7 additions & 6 deletions
Large diffs are not rendered by default.

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
5959
| A12 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:117` | — | 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:125` | async.ts×1 | 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 … |
6161
| A14 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:133` | — | spec-async-semantics.test.ts×2 | [ruled, amended in place 2026-07-06 (promoted from B2)] Companion nodes get child lanes that do not merge with the owner — (was B2) `isPending`/`latest` companion nodes get child lanes that do not mer… |
62-
| A15 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:167` | core.ts×2 lanes.ts×1 scheduler.ts×1 | lane-hold-on-observation.test.ts×1 reveal-carve-out.test.ts×2 spec-async-semantics.test.ts×2 stale-read-uninitialized-cross-transition.test.ts×1 treeshake.test.ts×3 | [ruled 2026-07-06 (promoted from B3)] Transition entanglement is graph-driven; lanes settle as one reveal — (was B3) Transition entanglement is graph-driven: writes whose async work is observed by a s… |
62+
| A15 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:167` | async.ts×1 core.ts×3 lanes.ts×1 scheduler.ts×2 | lane-hold-on-observation.test.ts×1 reveal-carve-out.test.ts×2 shared-effect-no-entangle.test.ts×1 spec-async-semantics.test.ts×2 stale-read-uninitialized-cross-transition.test.ts×1 treeshake.test.ts×3 | [ruled, amended in place 2026-07-06 (promoted from B3)] Transition entanglement is graph-driven; lanes settle as one reveal — (was B3) Transition entanglement is graph-driven: writes whose async work … |
6363
| A16 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:141` | verdict.ts×1 | spec-async-semantics.test.ts×1 strict-read-pending-store.test.ts×2 uninitialized-visibility.test.ts×1 | [ruled 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 uninitialized asy… |
64-
| A17 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:31` | async.ts×3 constants.ts×2 core.ts×7 invariants.ts×3 optimistic.ts×3 scheduler.ts×2 verdict.ts×1 signals.ts×2 optimistic.ts×1 store.ts×3 | optimistic-undefined-override.test.ts×1 refresh-await.test.ts×1 reveal-gating-contract.test.ts×3 spec-async-semantics.test.ts×10 createOptimisticStore.test.ts×1 treeshake.test.ts×1 until.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… |
65-
| A18 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:41` | async.ts×2 constants.ts×1 core.ts×4 optimistic.ts×3 scheduler.ts×2 types.ts×2 optimistic.ts×1 | createOptimistic.test.ts×1 spec-async-semantics.test.ts×3 flight-owned-transaction.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… |
64+
| A17 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:31` | async.ts×3 constants.ts×2 core.ts×7 invariants.ts×3 optimistic.ts×5 scheduler.ts×2 verdict.ts×1 signals.ts×2 optimistic.ts×1 store.ts×3 | optimistic-undefined-override.test.ts×1 refresh-await.test.ts×1 reveal-gating-contract.test.ts×3 spec-async-semantics.test.ts×10 createOptimisticStore.test.ts×1 treeshake.test.ts×1 until.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… |
65+
| A18 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:41` | async.ts×2 constants.ts×1 core.ts×4 optimistic.ts×4 scheduler.ts×2 types.ts×2 optimistic.ts×1 | createOptimistic.test.ts×1 spec-async-semantics.test.ts×3 flight-owned-transaction.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… |
6666
| A19 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:69` | async.ts×1 optimistic.ts×1 | spec-async-semantics.test.ts×3 uninitialized-visibility.test.ts×1 | [ruled 2026-07-07 (promoted from C1)] `isPending(x)` ≡ the observable value is not final (three causes) — (was C1 — **partially reverses an earlier decision**) **Definition: `isPending(x)` ≡ the value… |
6767
| A20 | superseded | `docs/SPEC-ASYNC-SEMANTICS.md:247` | invariants.ts×1 | 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:254` | — | 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… |
@@ -102,17 +102,17 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
102102

103103
| id | status | defined | cited in src | cited in tests | statement (at definition) |
104104
|---|---|---|---|---|---|
105-
| INV-1 | live | `docs/INTERNALS-ASYNC-STATE.md:140` | invariants.ts×2 | — | - **INV-1 (high)** `pendingProbe` is non-null only inside an `isPending()` call |
106-
| INV-2 | live | `docs/INTERNALS-ASYNC-STATE.md:142` | invariants.ts×2 | — | - **INV-2 (high)** A node with an _active_ override (`hasActiveOverride`) is |
107-
| INV-3 | live | `docs/INTERNALS-ASYNC-STATE.md:146` | core.ts×1 invariants.ts×2 lanes.ts×1 scheduler.ts×2 | lane-hold-on-observation.test.ts×1 | - **INV-3 (high)** `_asyncReporters` gains entries only inside |
108-
| INV-4 | live | `docs/INTERNALS-ASYNC-STATE.md:153` | invariants.ts×3 | — | - **INV-4 (medium)** After any of the three write paths completes for node `el` |
109-
| INV-5 | live | `docs/INTERNALS-ASYNC-STATE.md:157` | invariants.ts×2 lanes.ts×1 | — | - **INV-5 (medium)** A lane in `activeLanes` has `_mergedInto === null` |
110-
| INV-6 | live | `docs/INTERNALS-ASYNC-STATE.md:163` | invariants.ts×2 | — | - **INV-6 (medium)** At the end of a completing-transition flush: every node in |
111-
| INV-7 | live | `docs/INTERNALS-ASYNC-STATE.md:166` | core.ts×1 invariants.ts×2 | action-completion-race.test.ts×2 | - **INV-7 (medium)** `_pendingValue !== NOT_PENDING` on a non-optimistic node |
112-
| INV-8 | retired | `docs/INTERNALS-ASYNC-STATE.md:169` | invariants.ts×1 | rules-index.test.ts×1 | - **INV-8 (RETIRED 2026-07-07b, §5e)** Hold-provenance: a `_pendingValue` on an |
113-
| INV-9 | live | `docs/INTERNALS-ASYNC-STATE.md:180` | invariants.ts×1 owner.ts×1 | — | - **INV-9 (high)** An `isPending` companion of a DISPOSED owner reads `false` |
114-
| INV-10 | live | `docs/INTERNALS-ASYNC-STATE.md:185` | invariants.ts×2 | action-done-window.test.ts×1 | - **INV-10 (high)** Affects-count balance (question-scoped model, 2026-07-13; |
115-
| INV-11 | live | `docs/INTERNALS-ASYNC-STATE.md:190` | core.ts×1 optimistic.ts×1 | spec-async-semantics.test.ts×1 treeshake.test.ts×1 | - **INV-11 (high, structural — pinned, not asserted)** A recompute's equality |
105+
| INV-1 | live | `docs/INTERNALS-ASYNC-STATE.md:142` | invariants.ts×2 | — | - **INV-1 (high)** `pendingProbe` is non-null only inside an `isPending()` call |
106+
| INV-2 | live | `docs/INTERNALS-ASYNC-STATE.md:144` | invariants.ts×2 | — | - **INV-2 (high)** A node with an _active_ override (`hasActiveOverride`) is |
107+
| INV-3 | live | `docs/INTERNALS-ASYNC-STATE.md:148` | core.ts×1 invariants.ts×2 lanes.ts×1 scheduler.ts×2 | lane-hold-on-observation.test.ts×1 | - **INV-3 (high)** `_asyncReporters` gains entries only inside |
108+
| INV-4 | live | `docs/INTERNALS-ASYNC-STATE.md:155` | invariants.ts×3 | — | - **INV-4 (medium)** After any of the three write paths completes for node `el` |
109+
| INV-5 | live | `docs/INTERNALS-ASYNC-STATE.md:159` | invariants.ts×2 lanes.ts×1 | — | - **INV-5 (medium)** A lane in `activeLanes` has `_mergedInto === null` |
110+
| INV-6 | live | `docs/INTERNALS-ASYNC-STATE.md:165` | invariants.ts×2 | — | - **INV-6 (medium)** At the end of a completing-transition flush: every node in |
111+
| INV-7 | live | `docs/INTERNALS-ASYNC-STATE.md:168` | core.ts×1 invariants.ts×2 | action-completion-race.test.ts×2 | - **INV-7 (medium)** `_pendingValue !== NOT_PENDING` on a non-optimistic node |
112+
| INV-8 | retired | `docs/INTERNALS-ASYNC-STATE.md:171` | invariants.ts×1 | rules-index.test.ts×1 | - **INV-8 (RETIRED 2026-07-07b, §5e)** Hold-provenance: a `_pendingValue` on an |
113+
| INV-9 | live | `docs/INTERNALS-ASYNC-STATE.md:182` | invariants.ts×1 owner.ts×1 | — | - **INV-9 (high)** An `isPending` companion of a DISPOSED owner reads `false` |
114+
| INV-10 | live | `docs/INTERNALS-ASYNC-STATE.md:187` | invariants.ts×2 | action-done-window.test.ts×1 | - **INV-10 (high)** Affects-count balance (question-scoped model, 2026-07-13; |
115+
| INV-11 | live | `docs/INTERNALS-ASYNC-STATE.md:192` | core.ts×1 optimistic.ts×1 | spec-async-semantics.test.ts×1 treeshake.test.ts×1 | - **INV-11 (high, structural — pinned, not asserted)** A recompute's equality |
116116
## RUL — store rulings
117117

118118
| id | status | defined | cited in src | cited in tests | statement (at definition) |

0 commit comments

Comments
 (0)