Skip to content

Commit 2907127

Browse files
docs(signals): #4474 cause corrected and #4417 rulings reaffirmed; both recorded, #4417 parked
D-22: the #4474 memo is unowned, not lazy — at its source's landing the settle walk queues the blocked memo's retry and then releases the subscriber-less node, deleting the retry (async.ts). D-22 already rules the screen; the fix belongs at the release (fix/release-after-retry-4474, in progress). One sentence of history on the parked wake attempt (fix/core-batch-4474-4417 @ ed85ca2: over budget, #15992 regression). D-27 / S-46: rulings reaffirmed 2026-10-31 after a rules review (S-46 reading A, [1,2,2] mount count); no in-budget mechanism known for either half; parked, no D-37 dependency. Adds the web mirror pin for #4474 (verdict-only row test.fails at the ruled screen). No runtime change. Refs #4474, #4417 Co-authored-by: Cursor <[email protected]>
1 parent ab3e844 commit 2907127

3 files changed

Lines changed: 137 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ An armed boundary catches a lane the same way it catches a transition (D-12, D-1
180180

181181
**From:** F-6, F-10, F-9. **Scenarios:** S-25, S-45.
182182

183-
`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).
183+
`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 memo on the observation lifecycle (unowned, or `lazy: true`) 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. **Deviation today:** a memo on the observation lifecycle (unowned, or `lazy: true`) 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 release, 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.
186+
187+
**Open (2026-10-31, #4474; fix in progress).** The memo is not lazy: `createMemo(() => m())` with no `lazy` option computes eagerly at creation and is blocked on the uninitialized `m` (`_blocked`). It is _unowned_ — `CONFIG_AUTO_DISPOSE` is `!context || options?.lazy` (core.ts) — and the cause is release ordering at `m`'s landing: the settle walk (async.ts `settlePendingSource`) queues the blocked memo's retry (`enqueueSub`) and then, the node having no subscribers, releases it (`releaseIfSettledUnobserved` → `unobserved` → `deleteFromHeap`), destroying the retry it just queued; the commit sweep then clears `STATUS_UNINITIALIZED` on a node that never computed, and `latest` of it is `undefined`. The owned twin and the unowned twin with a subscriber both run the retry and already show the ruled screen (the "in a root" and prior-reader rows of `tests/latest-unread-identity-memo-4474.test.ts`). D-22 already rules the screen; no new ruling. The fix belongs at the release — run the queued retry, then release (#2934's requirement, a release with no perpetual recompute, is met) — not at the wake: branch `fix/release-after-retry-4474`, in progress. History: a wake-side fix (branch `fix/core-batch-4474-4417`, `ed85ca2a3` — a dormant memo's pass served the committed value and marked pending, a catch-up on the screen re-deriving after) was built on 2026-10-30 and parked: +186 B brotli on the core floor, +149 B on hello world, and a remount regression (generator seed 91501 #15992, `[ROOT-E]` for a program that never errors).
186188

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

@@ -230,6 +232,8 @@ A `<Show when={latest(x) > 0}>` opens at once (display-ahead). The `<Loading>` i
230232

231233
**Collapses:** #3851/#3869 (2026-10-07), [A29](./SPEC-ASYNC-SEMANTICS.md#a29-a-tracked-read-served-a-live-transactions-staged-value-enters-that-transaction)'s 2026-10-07 amendment, L2 statement 3 as amended, #3835. **Status:** standing (`tests/verdict-mount-first-pass-3851.test.ts`, `tests/optimistic-mount-binding-3835.test.ts`).
232234

235+
**Parked (2026-10-31, #4417; issue open).** The ruling stands: the branch a display-ahead `Show` opens under a plain write's hold is born held and attaches once, at the landing, with its content (S-46 — today it attaches with its text hole empty, F-2's empty slot; and the `[1,2,2]` mount-count pins of `tests/boundary-not-born-held-3540.test.ts` / `web/test/loading-on-keyed-boundary-3540.spec.tsx` see a third mount). A fix was attempted on 2026-10-30 beside #4474's ("a pass whose mount is the hold's is the hold's": a render effect born held under a verdict-lane mount marks its creator pass joined, and `laneStage` leaves the verdict lane for the hold; reference branch `fix/4417-display-ahead-attach-parked`, commit `04c218537`) and dropped before #4474's reference branch was cut: it looped forever on the generator's seed 91501 #32043 (`boundarySeam` → `redraw` re-enqueueing a held boundary's output every round) and opened four new findings (seed 7 #1691 E6, #17379 E1, #38770 E6, #46918 E1). Rulings reaffirmed 2026-10-31 after a rules review: S-46 reading A (born held, attaches at the landing — entailed by D-27 and D-2's in-flush carve-out; attaching with the committed value instead would re-rule S-31's `[fallback]` row) and the `[1,2,2]` mount count. No mechanism inside the size budget is known for either half: adoption's frame half measures ≥100 B minified on the live-page floor; the display-ahead attach attempt looped. Parked; issue open; pins stay `test.fails` at the ruled screens: the S-46 plain row in `web/test/display-ahead-plain-write-content-s46.spec.tsx`, the four `[1,2,2]` rows.
236+
233237
### D-28. A read throws on its own; an earlier read does not disarm a later throw
234238

235239
**From:** F-1, F-2, F-4. **Scenarios:** S-39.

‎packages/signals/docs/SCENARIOS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ const save = action(function* () { setX(1); yield gate; });
636636
| 2 | `gate`, body returns | `1 \| content 1` | |
637637
| ✗ | | after 1: `0 \| content 1` (the torn frame #3869 fixed) | |
638638

639-
### S-46. The content a display-ahead `Show` opens reads the screen, whoever opened the hold — D-27, D-37
639+
### S-46. The content a display-ahead `Show` opens reads the screen, whoever opened the hold — D-27
640640

641-
_Ruled 2026-10-30 ("actions aren't special — they are a way to extend the hold"). Pinned: `tests/display-ahead-plain-write-content.test.ts` (signals, passes) and `web/test/display-ahead-plain-write-content-s46.spec.tsx` (through `Show` + `insert`; the plain row is `test.fails` — today the branch attaches with its text hole empty, `selected: ` and nothing, F-2's empty slot and #4417's mechanism). S-31's rule in the plain-write, no-boundary form: a write to `id` is held because an async memo over it is on screen; no action, no `Loading`._
641+
_Ruled 2026-10-30 ("actions aren't special — they are a way to extend the hold"), reaffirmed 2026-10-31 (A over C: C would re-rule S-31). Pinned: `tests/display-ahead-plain-write-content.test.ts` (signals, passes) and `web/test/display-ahead-plain-write-content-s46.spec.tsx` (through `Show` + `insert`; the plain row is `test.fails` — today the branch attaches with its text hole empty, `selected: ` and nothing, F-2's empty slot and #4417's mechanism). S-31's rule in the plain-write, no-boundary form: a write to `id` is held because an async memo over it is on screen; no action, no `Loading`. Parked 2026-10-31: a fix was attempted and dropped (infinite loop on a generated case, four new findings — D-27 Status); no in-budget mechanism known, #4417 open._
642642

643643
```tsx
644644
const [id, setId] = createSignal(0);
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/**
2+
* @jsxImportSource @solidjs/web
3+
* @vitest-environment jsdom
4+
*
5+
* #4474 through `Loading` + `insert` (the signals pin is
6+
* `signals/tests/latest-unread-identity-memo-4474.test.ts`): laziness is
7+
* never observable (D-22, ruled 2026-10-30).
8+
*
9+
* `m` is an async memo over `s`; `id = createMemo(() => m())` is an identity
10+
* memo created at module level that nothing reads. `m`'s first answer (2)
11+
* lands in its own flush — the unread `id` is released without running
12+
* (#2934). A write re-asks `m`, and in that same flush a `Loading` boundary
13+
* mounts content reading `latest(id)` and `isPending(id)`: `l:2 p:true`, then
14+
* `l:3 p:false` at the landing — the same screen as with a prior reader of
15+
* `id`, in either read order with a plain `{id()}` beside it.
16+
*
17+
* Deviation today (D-22 Status; the memo is unowned, not lazy, and the
18+
* settle walk's release at `m`'s landing deletes the retry it just queued —
19+
* fix in progress at the release): the mount reads `l:undefined p:true` —
20+
* the verdict-only row is pinned `test.fails` at the ruled screen. The two
21+
* rows with a plain `id()` beside the verdict reads
22+
* already show the ruled screen (the born-held reader keeps the mount on
23+
* `off` until the landing, F-5) and are the control.
24+
*/
25+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
26+
import {
27+
Loading,
28+
Show,
29+
createEffect,
30+
createMemo,
31+
createRoot,
32+
createSignal,
33+
flush,
34+
isPending,
35+
latest
36+
} from "solid-js";
37+
import { render } from "../src/index.js";
38+
39+
beforeEach(() => vi.useFakeTimers());
40+
afterEach(() => vi.useRealTimers());
41+
42+
const tick = async () => {
43+
await vi.advanceTimersByTimeAsync(0);
44+
flush();
45+
};
46+
47+
type Plain = "none" | "before" | "after";
48+
49+
async function run(plain: Plain, prior: boolean) {
50+
const asks: { v: number; resolve: (v: number) => void }[] = [];
51+
const [s, setS] = createSignal(1);
52+
const m = createMemo(() => {
53+
const v = 1 + s();
54+
return new Promise<number>(resolve => asks.push({ v, resolve }));
55+
});
56+
const id = createMemo(() => m());
57+
let disposePrior = () => {};
58+
if (prior)
59+
disposePrior = createRoot(dispose => {
60+
createEffect(
61+
() => id(),
62+
() => {}
63+
);
64+
return dispose;
65+
});
66+
const div = document.createElement("div");
67+
const dispose = render(
68+
() => (
69+
<Loading fallback={<u>fallback</u>}>
70+
<Show when={s() > 1} fallback={<u>off</u>}>
71+
{plain === "before" && <b>p:{id()}</b>}
72+
<i>
73+
l:{latest(id)} p:{String(isPending(id))}
74+
</i>
75+
{plain === "after" && <b>p:{id()}</b>}
76+
</Show>
77+
</Loading>
78+
),
79+
div
80+
);
81+
const screen = () => div.textContent;
82+
flush();
83+
await tick();
84+
const screens = [screen()];
85+
const first = asks.shift()!;
86+
first.resolve(first.v);
87+
await tick();
88+
await tick(); // m's answer (2) lands on its own
89+
screens.push(screen());
90+
setS(2);
91+
await tick();
92+
await tick(); // re-ask m and mount the content
93+
screens.push(screen());
94+
const second = asks.shift()!;
95+
second.resolve(second.v);
96+
await tick();
97+
await tick();
98+
screens.push(screen());
99+
dispose();
100+
disposePrior();
101+
return screens;
102+
}
103+
104+
describe("#4474 (web): latest() of an unread identity memo first read in the flush that re-asks its source", () => {
105+
// primed (off) | m's 2 landed | re-asked + mounted | landed
106+
test.fails(
107+
"verdict reads only: l:2 p:true at the mount, l:3 p:false at the landing (#4474, ruled; today l:undefined p:true)",
108+
async () => {
109+
const lazy = await run("none", false);
110+
expect(lazy).toEqual(["off", "off", "l:2 p:true", "l:3 p:false"]);
111+
expect(lazy).toEqual(await run("none", true));
112+
}
113+
);
114+
115+
// A plain `id()` in the same mount is not display-ahead (D-27): its reader
116+
// is born held (D-2) and the mount — the boundary is disarmed, it showed
117+
// `off` — stays on `off` until the landing (F-5), in either read order.
118+
for (const plain of ["before", "after"] as const)
119+
test(`a plain id() ${plain} the verdict reads: the mount waits for the landing, as with a prior reader`, async () => {
120+
const lazy = await run(plain, false);
121+
expect(lazy).toEqual([
122+
"off",
123+
"off",
124+
"off",
125+
plain === "before" ? "p:3l:3 p:false" : "l:3 p:falsep:3"
126+
]);
127+
expect(lazy).toEqual(await run(plain, true));
128+
});
129+
});

0 commit comments

Comments
 (0)