Skip to content

Commit e21c2ae

Browse files
ryansolidclaude
andauthored
test(signals): pin #4469's plain reader at the commit; D-23 known deviation (#4487)
The `value` row of the #4469 pin becomes a positive pin: a plain reader of a hold that recovers to the committed value runs once, at the commit (D-41: a recovery equal to the last good value is still a change of answer; D-9). The verdict rows stay it.fails, and D-23's Status records the landing re-run as a known deviation with the 2026-10-30 gate measurements. Adds an it.fails pin for #4485: writes that net to a signal's committed value in the tick an action opens a hold still pend it for a verdict reader (D-8), through the same `stagedScreen` seam. Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2 Co-authored-by: Claude <[email protected]>
1 parent b773146 commit e21c2ae

3 files changed

Lines changed: 94 additions & 8 deletions

File tree

‎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. 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).
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`.
194194

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

‎packages/signals/tests/hold-recovers-landing-reruns-4469.test.ts‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
// #4469 (it.fails pin): a hold whose staged error recovers to the committed
2-
// value re-runs its readers at the landing with unchanged values. An action
1+
// #4469: a hold whose staged error recovers to the committed value. An action
32
// makes `m0` throw (staged with the hold, D-41), then writes it back to its
4-
// committed value; the reader runs while the error is staged and again at
5-
// the recovery — both right — and a third time when the hold commits, though
6-
// nothing it read changed. The landing's re-derivation (`reruns`) re-runs
7-
// every stale and verdict reader of the hold (A15).
3+
// committed value, and the hold commits later.
4+
//
5+
// A plain reader (`value`) shows the committed value for the whole hold and
6+
// runs once, at the commit. That is the ruled screen: "a recovery to a value
7+
// equal to the last good one is still a change of answer" (D-41), and the
8+
// reader settles with the hold it shares (D-9).
9+
//
10+
// A verdict reader (`pending`, `both`) runs while the error is staged and
11+
// again at the recovery, both right, then a third time when the hold
12+
// commits, though nothing it read changed. The landing's re-derivation
13+
// (`reruns`) re-runs every stale and verdict reader of the hold (A15). That
14+
// is a known deviation under D-23's Status, pinned it.fails here.
815
import { describe, expect, it } from "vitest";
916
import {
1017
action,
@@ -58,7 +65,14 @@ describe("#4469: a hold that recovers to the committed value", () => {
5865
return { held, recovered, committed: runs.length, runs };
5966
};
6067

61-
it.fails.each(["value", "pending", "both"] as const)(
68+
it("runs a plain reader once, at the commit (value; D-41, D-9)", async () => {
69+
const { held, recovered, runs } = await recover("value");
70+
expect(held).toBe(0);
71+
expect(recovered).toBe(0);
72+
expect(runs).toEqual([[30]]);
73+
});
74+
75+
it.fails.each(["pending", "both"] as const)(
6276
"re-runs no reader at the landing (%s)",
6377
async read => {
6478
const { recovered, committed } = await recover(read);
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// #4485 (it.fails pin): writes that net to a signal's committed value in the
2+
// tick an action opens a hold made no proposal (D-8), so a verdict reader of
3+
// the signal shows `isPending(s)` false and is not re-run at the landing.
4+
// Today it shows `true` for the whole hold and re-runs at the landing: the
5+
// reader takes the seat table's `stagedScreen` row before any netted check,
6+
// which lists it as a stale reader of the flush's hold (D-23 Status, #4469's
7+
// family).
8+
import { describe, expect, it } from "vitest";
9+
import {
10+
action,
11+
createRenderEffect,
12+
createRoot,
13+
createSignal,
14+
flush,
15+
isPending
16+
} from "../src/index.js";
17+
18+
const tick = async () => {
19+
await new Promise(r => setTimeout(r, 0));
20+
flush();
21+
};
22+
23+
describe("#4485: a verdict reader of a signal whose writes net", () => {
24+
const net = async (where: "in-action" | "before-action" | "later-tick") => {
25+
const [s, setS] = createSignal(1);
26+
const [x, setX] = createSignal(0);
27+
const runs: unknown[] = [];
28+
const dispose = createRoot(d => {
29+
createRenderEffect(x, () => {});
30+
createRenderEffect(
31+
() => [s(), isPending(s)],
32+
v => void runs.push(v)
33+
);
34+
return d;
35+
});
36+
flush();
37+
runs.length = 0;
38+
if (where === "before-action") (setS(2), setS(1));
39+
let release!: () => void;
40+
action(function* () {
41+
setX(1);
42+
if (where === "in-action") (setS(2), setS(1));
43+
yield new Promise<void>(r => (release = r));
44+
})();
45+
if (where === "later-tick") {
46+
await tick();
47+
setS(2);
48+
setS(1);
49+
}
50+
await tick();
51+
const held = runs.slice();
52+
release();
53+
await tick();
54+
await tick();
55+
dispose();
56+
return { held, runs };
57+
};
58+
59+
it.fails.each(["in-action", "before-action"] as const)(
60+
"pends nothing and is not re-run at the landing (%s)",
61+
async where => {
62+
const { held, runs } = await net(where);
63+
expect(held).toEqual([[1, false]]);
64+
expect(runs).toEqual([[1, false]]);
65+
}
66+
);
67+
68+
it("pends nothing in a later tick of the hold", async () => {
69+
const { runs } = await net("later-tick");
70+
expect(runs).toEqual([[1, false]]);
71+
});
72+
});

0 commit comments

Comments
 (0)