Skip to content

Commit ea230ce

Browse files
committed
Merge remote-tracking branch 'origin/next' into claude/project-thread-x1ore2-4444
2 parents e0c30bc + b5077ea commit ea230ce

16 files changed

Lines changed: 326 additions & 40 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+
`createStore(fn)`: a derive that went pending on a source and was settled without re-running (a staged rejection, or a re-ask that returned to the committed question) settles its readers with it, as a memo's would: `isPending` ends and a refetch's rejection reaches them.

‎.changeset/equals-netting-4483.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+
A write that a custom `equals` calls equal to the committed value now nets to it (D-8) while another write to the signal is staged, so it pends nothing (#4483).
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+
Writes that net to a signal's committed value in the tick an action opens a hold no longer pend the signal: a render effect reading `isPending(s)` shows `false` during the hold and is not re-run when the action lands (D-8).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ An armed boundary catches a lane the same way it catches a transition (D-12, D-1
190190

191191
`isPending(x)` is `true` while any of three causes holds: (i) a write held by a live hold; (ii) the node's own async in flight for a new question; (iii) a fresh value landed but held uncommitted by a hold it is entangled with — and `false` the moment none does. Exception 1: a node with no committed value — a first load, or a memo born held over a held value (D-2) — is loading, not pending. A node answered and then re-asked in the same flush — an async first answer that lands in the tick a write re-asks it — is not a first load (amended 2026-10-30): its answer is a produced value, so `latest` of it shows the answer and `isPending` of it is `true`, the re-ask being a new question; so is a derivation of it with no value of its own, at any depth (F-9, D-22). It has no verdict: inside an owner `isPending` of it does what its read does — a first load's `NotReadyError` goes to a boundary or holds the change (F-2); a reader of a memo born held is held with it, or caught by a boundary that has not shown content — and the reader runs at the commit, where the answer is final; unowned it is `false` (D-24). A node with a committed value is judged wherever its readers are: on screen, behind a fallback, or in a branch not yet attached. A verdict on content that may have no committed value is read inside the boundary that owns it — `<Loading><p>{m()}</p><span>{isPending(m) ? "updating" : ""}</span></Loading>` — where its reader is caught with the content; read outside, it holds the change that mounted it. Either way no answer is shown before the commit: `<input disabled={isPending(data)}>` is never seen enabled over an unjudged value (`packages/web/test/ispending-guard-born-held.spec.tsx`). No verdict is the honest answer: `true` would say "updating" for something never shown, and `false` would read as settled to a guard like `if (!isPending(x)) save(x())`. Exception 2: a re-ask of the same question is quiet; an `affects()` mark is a declared new question and pends exactly the marked data and what derives from it, released when the declaring hold settles (or at flush end, ambient). `[isPending(x), x()]` read in one scope never pairs `true` with the fresh value: a verdict reader sees the screen — in either read order — unless it is a node a hold's fetch is waiting on (D-25). `isPending(() => latest(x))` follows `x`'s own non-quiet async only — on a signal or sync memo the latest form is never pending — so `[isPending(() => latest(x)), latest(x)]` never pairs `true` with the fresh value either. A spinner driven by `isPending` fires while the owner's async is still in flight (it does not wait for the hold).
192192

193-
**Collapses:** [A19](./SPEC-ASYNC-SEMANTICS.md#a19-ispendingx--the-observable-value-is-not-final-three-causes), [A24](./SPEC-ASYNC-SEMANTICS.md#a24-question-scoped-pending-pending-iff-a-value-change-is-in-flight-or-an-affects-mark-is-live), [A10](./SPEC-ASYNC-SEMANTICS.md#a10-ispendingx-x-is-atomic-within-one-scope), [A8](./SPEC-ASYNC-SEMANTICS.md#a8-ispending--latestx-follows-xs-own-async-only--verdicts-are-per-channel), [A14](./SPEC-ASYNC-SEMANTICS.md#a14-companion-nodes-get-child-lanes-that-do-not-merge-with-the-owner), [A20](./SPEC-ASYNC-SEMANTICS.md#a20-superseded-optimistic-writes-announce-a-store-wide-pending)/[A21](./SPEC-ASYNC-SEMANTICS.md#a21-superseded-the-store-wide-mask) (superseded — the mask is gone), recovery 6.3. **Status:** standing. A probe alone holds nothing; a plain read beside it holds (`optimistic-settle-verdicts.test.ts` #3409, `question-scoped-pending.test.ts` 3.4; #3977). `isPending` of a memo born held, read inside and outside the boundary: `tests/fresh-boundary-born-held-reader.test.ts` (#3977; the engine joins the reader to the hold as the read does, which is the throw's observable effect). **Known deviation (#4469, 2026-10-30):** a verdict reader is re-run at every landing of a hold it observed, even when the landing changes nothing it read; the gate that would skip it needs a deps walk. Measured 2026-10-30: two cheaper gates broke F-9/D-23 (verdict-memo-flight-no-reask) and #4189 (errored-store-probe-settled-3962) pins and failed the frozen floors by +31/+36 B. A plain reader of the same recovered hold is not in this: it shows the committed value for the whole hold and runs once, at the commit, since a recovery to a value equal to the last good one is still a change of answer (D-41, D-9). Pinned in `tests/hold-recovers-landing-reruns-4469.test.ts` (the verdict rows `it.fails`). The same seam reaches a verdict reader of a signal whose writes net to its committed value in the tick an action opens a hold (#4485): row V2 (`stagedScreen`) runs before any netted check, so the reader is listed as the hold's stale reader and re-runs at the landing, and `isPending(s)` reads `true` for the hold although the writes made no proposal (D-8). That is a bug, not this deviation; pinned `it.fails` in `tests/netted-verdict-reader-4485.test.ts`.
193+
**Collapses:** [A19](./SPEC-ASYNC-SEMANTICS.md#a19-ispendingx--the-observable-value-is-not-final-three-causes), [A24](./SPEC-ASYNC-SEMANTICS.md#a24-question-scoped-pending-pending-iff-a-value-change-is-in-flight-or-an-affects-mark-is-live), [A10](./SPEC-ASYNC-SEMANTICS.md#a10-ispendingx-x-is-atomic-within-one-scope), [A8](./SPEC-ASYNC-SEMANTICS.md#a8-ispending--latestx-follows-xs-own-async-only--verdicts-are-per-channel), [A14](./SPEC-ASYNC-SEMANTICS.md#a14-companion-nodes-get-child-lanes-that-do-not-merge-with-the-owner), [A20](./SPEC-ASYNC-SEMANTICS.md#a20-superseded-optimistic-writes-announce-a-store-wide-pending)/[A21](./SPEC-ASYNC-SEMANTICS.md#a21-superseded-the-store-wide-mask) (superseded — the mask is gone), recovery 6.3. **Status:** standing. A probe alone holds nothing; a plain read beside it holds (`optimistic-settle-verdicts.test.ts` #3409, `question-scoped-pending.test.ts` 3.4; #3977). `isPending` of a memo born held, read inside and outside the boundary: `tests/fresh-boundary-born-held-reader.test.ts` (#3977; the engine joins the reader to the hold as the read does, which is the throw's observable effect). **Known deviation (#4469, 2026-10-30):** a verdict reader is re-run at every landing of a hold it observed, even when the landing changes nothing it read; the gate that would skip it needs a deps walk. Measured 2026-10-30: two cheaper gates broke F-9/D-23 (verdict-memo-flight-no-reask) and #4189 (errored-store-probe-settled-3962) pins and failed the frozen floors by +31/+36 B. A plain reader of the same recovered hold is not in this: it shows the committed value for the whole hold and runs once, at the commit, since a recovery to a value equal to the last good one is still a change of answer (D-41, D-9). Pinned in `tests/hold-recovers-landing-reruns-4469.test.ts` (the verdict rows `it.fails`). A verdict reader of a signal whose writes net to its committed value in the tick an action opens a hold is not in this either (#4485, fixed 2026-10-30): the writes made no proposal (D-8), so the reader is not the hold's stale reader and `isPending(s)` stays `false` (`tests/netted-verdict-reader-4485.test.ts`).
194194

195195
### D-24. `isPending` never throws unowned; the probe is reads-only
196196

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
5353
| A6 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:361` | boundaries.ts×2 | derived-write-then-derivation-3733.test.ts×1 enforceLoadingBoundary.test.ts×1 | [ruled] `ASYNC_OUTSIDE_LOADING_BOUNDARY` is warn-only — `ASYNC_OUTSIDE_LOADING_BOUNDARY` is a warn-only diagnostic; an `Errored` above must not swallow it and must not show its fallback for a pending. |
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… |
56-
| A9 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:183` | 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… |
56+
| 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… |
5757
| 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. |
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… |
@@ -85,7 +85,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
8585
|---|---|---|---|---|---|
8686
| 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 |
8787
| 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 |
88-
| V3 | fixed | `docs/SPEC-ASYNC-SEMANTICS.md:496` | seat.ts×5 | spec-async-semantics.test.ts×2 | - **V3 (violated A19) — FIXED.** After a reporter-less transition completed, |
88+
| 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, |
8989
| 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 |
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

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ import {
4949
freshHook,
5050
holdWorkHook,
5151
guessing,
52-
laneStageHook
52+
laneStageHook,
53+
storeParkHook
5354
} from "./scheduler.js";
5455
import type { Computed, Link, Owner } from "./types.js";
5556

@@ -377,6 +378,11 @@ export function settlePendingSource(el: Computed<any>, source: Computed<any> = e
377378
enqueueSub(node);
378379
scheduled = true;
379380
}
381+
// A derived store's derive pending by propagation (its pass not re-run):
382+
// its readers wait on the derive itself, not on this source, so they
383+
// settle with it, as a memo's would through its dependents (F-9, A9).
384+
// Only a store build has one (`storeParkHook`).
385+
else if (storeParkHook) (node as any).fam?.st();
380386
if (node._x !== null) node._x._blocked = false;
381387
// Fully settled with nobody watching: release candidate (#2934). Checked
382388
// again at release time — deferred so unobserved() can't unlink subs

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

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,19 +2063,21 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
20632063
if (__TEST__) shadowActual(SLOT_C);
20642064
return el._value as T;
20652065
}
2066-
// (A plain signal is never uninitialized — the carve-out is `serve`'s.)
2067-
// Lane work over a folded lane (D-34), once the frame has a
2068-
// transaction, reads the screen too.
2066+
// A staging equal to the committed value is writes that netted (D-8): no
2067+
// proposal, so not a read of the frame's future — nor, for a verdict
2068+
// reader, a stale read of the tick's hold re-run at its landing (#4485):
2069+
// the committed value is the staging. (A plain signal is never
2070+
// uninitialized — the carve-out is `serve`'s.) Lane work over a folded
2071+
// lane (D-34), once the frame has a transaction, reads the screen too.
20692072
if (
2070-
((observeFlightHook && c._config & CONFIG_VERDICT) || (laneStageHook && passLane?.folded)) &&
2071-
stagedScreen(c as Computed<any>, el)
2073+
el._pendingValue === el._value ||
2074+
(((observeFlightHook && c._config & CONFIG_VERDICT) || (laneStageHook && passLane?.folded)) &&
2075+
stagedScreen(c as Computed<any>, el))
20722076
) {
2073-
if (__TEST__) shadowActual(SLOT_C);
2077+
if (__TEST__) shadowActual(el._pendingValue === el._value ? SLOT_P : SLOT_C);
20742078
return el._value as T;
20752079
}
2076-
// A staging equal to the committed value is writes that netted (D-8): no
2077-
// proposal, so not a read of the frame's future.
2078-
if (el._pendingValue !== el._value) stagedRead(c as Computed<any>);
2080+
stagedRead(c as Computed<any>);
20792081
if (__TEST__) shadowActual(SLOT_P);
20802082
return el._pendingValue as T;
20812083
}
@@ -2543,10 +2545,17 @@ export function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T
25432545
// user comparator must not run against `undefined` (matches recompute).
25442546
// D-41: a write over a shown error is a change whatever the last good
25452547
// value was — the error leaves at its commit (`commitPendingNode`).
2548+
// `custom`: with the verdict engine, whether `el` carries a comparator of
2549+
// its own — `isSame`'s fast-path test, taken once for this gate and D-8's
2550+
// netting below, so the default comparator's `===` runs inline and a
2551+
// rewrite loop pays nothing for the netting (CodSpeed `propagation:
2552+
// avoidable`). Without the engine it is `null`: the gate folds to the
2553+
// plain `isSame` call and the netting away, byte for byte as before.
2554+
const custom = observeFlightHook ? el._equals !== isEqual : null;
25462555
const valueChanged =
25472556
!!((el as Computed<T>)._statusFlags & STATUS_UNINITIALIZED) ||
25482557
!!el._x?._shownError ||
2549-
!isSame(el, currentValue, v);
2558+
(custom === false ? currentValue !== v : !isSame(el, currentValue, v));
25502559
if (!valueChanged) return v;
25512560

25522561
// Attribution hook: this committed write is where a re-run chain begins.
@@ -2568,7 +2577,22 @@ export function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T
25682577
// A28: a held node rewritten outside a flush keeps its flushed staging
25692578
// for every reader until the flush that carries the rewrite.
25702579
else if (el._config & CONFIG_HELD && !globalQueue._running) stashFlushed(el);
2571-
el._pendingValue = v;
2580+
// D-8 (#4483): a staged rewrite the comparator calls equal to the
2581+
// committed value nets to it; staging the committed value itself lets
2582+
// every netted test (`_pendingValue === _value`) see writes that made no
2583+
// proposal. (Unstaged, the gate above already compared it.)
2584+
// The netted test reads it only with the verdict engine (`isPending`,
2585+
// `latest`): a build without it stages `v` as written. Under the default
2586+
// comparator only the committed object itself is equal, and `v` is already
2587+
// it, so a rewrite loop pays one local test (`custom`, from the gate).
2588+
// (`custom` is truthy only with the engine installed.)
2589+
el._pendingValue =
2590+
custom &&
2591+
wasStaged &&
2592+
!((el as Computed<T>)._statusFlags & STATUS_UNINITIALIZED || el._x?._shownError) &&
2593+
isSame(el, el._value, v)
2594+
? el._value
2595+
: v;
25722596
// A28 arm, gated on the load the write already pays for (`context`); the
25732597
// arm itself is a cold helper so setSignal stays within every setter's
25742598
// inlining budget, ~300 B bytecode.

0 commit comments

Comments
 (0)