Skip to content

Commit b07fed5

Browse files
ryansolidClaude via Cursorcursoragent
authored
fix(signals): five rule-decided fixes from the semantic fuzzer (F3, F4, F9, F10/F11, F13) (#3801)
* test(signals): pin F13 — born-held latest() reader loses the action's final write Brings the F13 pin from fuzz/semantic-fuzzer-l2 (f3d6342) onto next, beside #3798's flipped F7a/F7b/F12 pins: a `latest(source)` render effect whose mount is withdrawn in the action's tick and restored in the next is born held with its creation value; the body-end write re-runs it in the verdict lane, and the landing then applies the stale born-held staging over the lane's run. Pinned as `it.fails` (A29 creation-time form, A28). No engine changes. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): a memo an isPending probe pulls computes outside the probe's window (fuzzer F10, F11) `verdictValue` links and pulls like a plain read, but it pulled with the window's dispatch still installed: `pullComputed(m)` → `recompute(m)` → `m`'s own reads went through `verdictValue` under the probe's posture. For a source staged this flush and not held, the unheld-staged arm answers the probe with the committed value — right for the probe, wrong for `m`, whose result is cached for every reader. So `m` cached the committed input and never got the flushed one (F10: a gated `isPending` reader revealed beside a write to the probed memo's source left the memo's plain reader on the old value for good), and a pulled memo over an uninitialized staged input read `undefined` instead of suspending (F11). A31: "a memo computes under its own lane posture, never its puller's"; A28: a write is visible at flush to every channel; A7/A19 exc. 1: an uninitialized input suspends. The pull now drops the dispatch for the nested pass and reinstalls it after, so the probe's own read of `m` answers the verdict for what `m` produced. `latest`/`isPending` restore the dispatch they found instead of re-deriving it from their flags, so a window opened inside the pulled pass closes back to none rather than to the puller's (pinned: "F10 (nested window)"). `setWindows` goes away. F10 and F11 flip from `it.fails` to `it`; the nested-window case is a new `it` (fails on next). No other pin moved. Size: +1 B minified on the isPending/latest scenario (+5 B brotli locally). The brief's optional hardening of the unheld-staged arm for STATUS_UNINITIALIZED was not added: with the pulled pass outside the window, no reachable path served `undefined` from it in probing, so there was no failing case to pin. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): a verdict reader re-derives when its source settles silently (fuzzer F9) A verdict reader holds no pending source of its own: when the source goes pending, `propagateStatus`'s verdict arm re-derives it (CONFIG_VERDICT), and it answers `isPending` true without inheriting the status. A flight that then lands equal to the committed value notifies nobody — `setSignal` skips `insertSubs` on an equal value — and the settle walk returned at `removePendingSource` for a node without the source, so the probe read `true` forever. Shape: `setSrc(1); setSrc(0)` re-asks an async memo for the committed input; a probe-only `isPending(m)` reader stays true after the re-ask lands. A19: "a node is pending while any cause holds it and final the moment none does". The settle walk's early return now re-derives a verdict reader it reaches — the source settling is the reader's verdict changing, the third transition beside `propagateStatus`'s pending and error arms. Folded into the walk's existing early-return condition, which keeps the minifier's single `if` (a separate branch split it and cost 25 B). F9 flips from `it.fails` to `it`. No other pin moved. Size: +16 B minified (core floor and every scenario carrying the settle walk). Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): a born-held effect re-run as lane work re-stages its value (fuzzer F13) A `latest(source)` render effect whose mount is withdrawn in an action's tick and restored in the next is born held: its creation value is staged (`_pendingValue` 0) and its first run is the commit's (A29). The action's final write re-runs it as the verdict lane's work, and `recompute`'s lane arm wrote an effect's value into its private `_value` (1) — beside the born-held staging. The lane's seam then committed the node: `commitPendingNode` applied the stale staging (0) over the lane's run and queued the effect's run with it, so the committed truth never showed. A29 creation-time form ("staged into it, committed with it"); `recompute`'s own note: "an effect still carrying an uncommitted staged value re-stages: the commit applies the latest pass, not the born-held one". The lane arm now does the same for an effect carrying a staging; an effect with none keeps writing its private slot for the lane's run. F13 flips from `it.fails` to `it`. No other pin moved. Size: +13 B minified (core floor). Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): a landing re-judges the transactions parked at its seam (fuzzer F3) A reader mounted while a flight is up is born held (A29 ruling A); unmounting it in the same hold stages its removal, making it a zombie that observes another flight, and that observation blocks an unrelated write (`src=0`) in a newer transaction (A15 #3463: a zombie is live for every hold "until the commit that disposes it"). The seam judges transactions newest first: the `src=0` transaction is judged blocked, then the older hold lands (its mount control nets to committed) and its commits dispose the zombie — but nothing judges `src=0` again. The `schedule()` in `disposeChildren` cannot cover this: `land` has already nulled the zombie's `_x._transaction`, and even ungated, a `schedule()` inside `settle` is overwritten by `flush`'s own `scheduled` recompute. `settle` now restarts its landing loop after every landing, so the transactions it parked are judged against the world the landing committed. The zombie is disposed, holds nothing, and `src=0` lands at the same seam. Deviation from the hand-off brief's triage: the brief named the `disposeChildren` predicate (zombie's transaction nulled before the disposing commit) as the cause and offered "schedule() for any dying pending node" or "iterate settle to a fixpoint". The predicate is false as triaged, but dropping it does not fix F3 (the scheduled seam is lost inside `settle`); the fixpoint is the fix. +11 B minified (core floor). F3 flips from `it.fails` to `it`. No other pin moved. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(signals): an errored pass's unreached reads still hold their flights (fuzzer F4) A tuple render reader observes `m0`'s flight for `a=1` (the hold on `a=1`). A later `b=1` re-runs it and the pass throws NotReady at `m1` before reaching `m0`. `blockedBy` counts only the reader's reads of its last pass (`s._gen === r._depGen` — O3, #3494: a reader that stopped reading releases the flight), so the unreached `m0` link counted as dropped, the hold on `a=1` landed, and `A=1` showed beside a tuple still derived from `a=0` while `m0`'s flight was in the air. A15: writes whose async work is observed by a shared reader settle as one unit; A30: an errored pass (a throw, NotReady included) keeps its full list. An errored pass did not stop reading — it never got there. `blockedBy` (scheduler.ts) now counts the links past `_depsTail` as live when the reader's pass errored (`r._x._error != null`). The unchanged- pass tails kept for A30 (#3469) are untouched: their pass completed. +16 B minified (core floor). F4 flips from `it.fails` to `it`. No other pin moved. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> * chore(size): raise nine caps for fuzz Batch A (Size-Exception, #3801) Accepted by the maintainer (2026-10-05). Each cap is set at the CI-measured size + 10 B, rounded up to 0.01 KB, with a dated ledger note per raise. Fuzz Batch A (F3/F4/F9/F10-11/F13) costs +56 B minified on the core floor; brotli layout puts nine scenarios over: - core floor 7.33 -> 7.35 KB (floor-caps.json) - + createStore 14.53 -> 14.56 KB - + isPending/latest 9.47 -> 9.49 KB - simple-app floor 9.83 -> 9.86 KB (floor-caps.json) - hydrating 17.66 -> 17.71 KB (floor-caps.json) - hydrating + stores 28.80 -> 28.84 KB - CSR 12.82 -> 12.86 KB - CSR observe tier 14.39 -> 14.46 KB - live server components 48.47 -> 48.51 KB (floor-caps.json) Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 21ff8f8 commit b07fed5

13 files changed

Lines changed: 476 additions & 258 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 born-held render effect re-run as lane work (a `latest()` reader remounted during an action's hold) re-stages its value, so the commit applies the latest pass instead of the stale born-held one (fuzzer F13).
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 render reader whose pass errored (NotReady included) before reaching a flight it read last time still holds that flight's transaction: a write no longer shows beside a reader still derived from the previous value while the flight is in the air (fuzzer F4).
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 landing whose commits dispose a zombie re-judges the transactions parked at the same seam: a write held only because that zombie observed its flight now lands with the commit that disposes it instead of staying unpublished until an unrelated flush (fuzzer F3).
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 pulled by an `isPending`/`latest` probe computes as its own pass, outside the probe's window: it no longer caches the committed input in place of a flushed write (fuzzer F10), or reads an uninitialized input as `undefined` instead of suspending (F11).
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+
An `isPending` reader of an async memo settles when the memo's flight lands equal to its committed value: the settle walk re-derives the verdict reader instead of leaving it `true` (fuzzer F9).

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

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

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,22 @@ export function settlePendingSource(el: Computed<any>, source: Computed<any> = e
249249
let released: Computed<any>[] | undefined;
250250
const visited = new Set<Computed<any>>();
251251
const settle = (node: Computed<any>) => {
252-
if (visited.has(node)) return;
253-
// A conditional dropped this source, but another dependency can still
254-
// carry it. Only retire pending state inherited through the recovered
255-
// branch. Deliberately NOT marked visited on this early return: the
256-
// carrying dependency may itself be a later branch of this same walk
257-
// (two unchanged memos converging), and its visit must be free to
258-
// re-examine this node once that branch has retired the source.
259-
if (source !== el && retryReaches(node, source)) return;
260-
if (!removePendingSource(node, source)) return;
252+
if (
253+
visited.has(node) ||
254+
// A conditional dropped this source, but another dependency can still
255+
// carry it. Only retire pending state inherited through the recovered
256+
// branch. Deliberately NOT marked visited on this early return: the
257+
// carrying dependency may itself be a later branch of this same walk
258+
// (two unchanged memos converging), and its visit must be free to
259+
// re-examine this node once that branch has retired the source.
260+
(source !== el && retryReaches(node, source)) ||
261+
!removePendingSource(node, source)
262+
)
263+
// A19: a verdict reader holds no pending of its own (it was re-derived
264+
// when the source went pending, `propagateStatus`), and a landing
265+
// equal to the committed value notifies nobody — the source settling
266+
// is its verdict changing: it runs again.
267+
return node._config & CONFIG_VERDICT && enqueueSub(node);
261268
visited.add(node);
262269
node._time = clock;
263270
const remaining = node._x?._pendingSources?.values().next().value;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,10 @@ export function recompute(el: Computed<any>, create: boolean = false): void {
620620
// revealed (its reveal shows it), as its staging once it has (the
621621
// next reveal promotes it; the screen keeps the revealed value). An
622622
// effect's value slot is private: the run the lane holds is what
623-
// shows it.
624-
if (isEffect) el._value = value;
625-
else if (lane._shown) el._pendingValue = value;
623+
// shows it — unless the effect was born held, whose first run is the
624+
// commit's (A29): it re-stages, as below.
625+
if (isEffect && el._pendingValue === NOT_PENDING) el._value = value;
626+
else if (isEffect || lane._shown) el._pendingValue = value;
626627
else el._x!._lane = value;
627628
} else if (
628629
create

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ export function merge(t: Transaction, f: Transaction): void {
229229
* one hop of `_subs` is the chain. Reads of the reader's LAST pass only (the
230230
* link's generation is the pass's): a tail kept for A30 — the committed
231231
* frame's dependency, awaiting the run that retires it — is not a read of
232-
* the flight, and a reader that stopped reading releases it (O3, #3494). A
232+
* the flight, and a reader that stopped reading releases it (O3, #3494).
233+
* An errored pass (NotReady included) did not stop: it never got there, and
234+
* its full list stands (A30) — the reads it did not reach still observe. A
233235
* flight nobody renders holds nothing (A29). Only the nodes `t` still owns
234236
* count: one a lane took over since is the lane's to wait on. A guess whose
235237
* own truth is in flight blocks the lane's parent, not the lane — it stands
@@ -314,7 +316,7 @@ function blockedBy(nodes: Signal<any>[], owner: Transaction, own = false): boole
314316
// over a held window, V5/A17). A probe alone does not hold.
315317
if (
316318
((r as any)._type === EFFECT_RENDER || r._flags & REACTIVE_FRAME_READ) &&
317-
s._gen === r._depGen &&
319+
(s._gen === r._depGen || r._x?._error != null) &&
318320
!(r._flags & REACTIVE_DISPOSED) &&
319321
onScreen(r, judge ?? owner)
320322
)
@@ -834,6 +836,10 @@ export class GlobalQueue implements IQueue {
834836
transactions.splice(k, 1);
835837
GlobalQueue._endLanes?.(u);
836838
land(u);
839+
// A landing's commits can dispose a zombie a transaction judged above
840+
// was blocked on (#3463: live "until the commit that disposes it") —
841+
// judge them again.
842+
k = transactions.length;
837843
}
838844
// The store folds the pending backings whose container nodes committed
839845
// — this flush's, or a landing's (store/store.ts installs it).

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import {
3636
spectating,
3737
strictRead,
3838
tracking,
39-
unflushedValue
39+
unflushedValue,
40+
verdict
4041
} from "./core.js";
4142
import { warnStrictReadUntracked } from "./dev.js";
4243
import { NotReadyError } from "./error.js";
@@ -113,10 +114,6 @@ function observeFlight(c: Computed<any>, el: Computed<any>): void {
113114
let latestActive = false;
114115
let probing = false;
115116
let probeFound = false;
116-
/** `read` dispatches here while a window is open. */
117-
function setWindows(): void {
118-
setVerdict(latestActive || probing ? verdictValue : null);
119-
}
120117

121118
/** A verdict read of a node a transaction (or lane) holds: the reading pass
122119
* is the holder's verdict lane's and re-derives at the holder's landing
@@ -228,27 +225,31 @@ function markVerdictReader(window: number): void {
228225
}
229226
}
230227

231-
/** The windows. */
228+
/** The windows. `read` dispatches to `verdictValue` while one is open; each
229+
* restores the dispatch it found — none inside a memo's pass a window
230+
* pulled (`verdictValue`). */
232231
export function latest<T>(fn: () => T): T {
233232
markVerdictReader(2);
234-
const prev = latestActive;
233+
const prev = latestActive,
234+
prevVerdict = verdict;
235235
latestActive = true;
236-
setWindows();
236+
setVerdict(verdictValue);
237237
try {
238238
return fn();
239239
} finally {
240240
latestActive = prev;
241-
setWindows();
241+
setVerdict(prevVerdict);
242242
}
243243
}
244244

245245
export function isPending(fn: () => any): boolean {
246246
markVerdictReader(1);
247247
const prevProbing = probing;
248248
const prevFound = probeFound;
249+
const prevVerdict = verdict;
249250
probing = true;
250251
probeFound = false;
251-
setWindows();
252+
setVerdict(verdictValue);
252253
try {
253254
fn();
254255
return probeFound;
@@ -264,7 +265,7 @@ export function isPending(fn: () => any): boolean {
264265
} finally {
265266
probing = prevProbing;
266267
probeFound = prevFound;
267-
setWindows();
268+
setVerdict(prevVerdict);
268269
}
269270
}
270271

@@ -303,7 +304,14 @@ function verdictValue(el: Signal<any> | Computed<any>, c: Computed<any> | null):
303304
const tracked = c !== null && tracking && !(c._config & CONFIG_CHILDREN_FORBIDDEN);
304305
if (c !== null && tracking) {
305306
link(el, c);
306-
if (owner._fn !== undefined) pullComputed(owner, c);
307+
if (owner._fn !== undefined) {
308+
// A31: the pulled memo's pass is its own, not the probe's — it reads
309+
// outside the window, and the probe's read below answers for what
310+
// the pass produced.
311+
setVerdict(null);
312+
pullComputed(owner, c);
313+
setVerdict(verdictValue);
314+
}
307315
}
308316
// A live `affects()` mark on the node or a dependency (affects.ts): not
309317
// final by declaration — the value itself is read as below. The verdict is

0 commit comments

Comments
 (0)