Skip to content

Commit 5119e44

Browse files
committed
Merge remote-tracking branch 'origin/next' into mq-3807
2 parents 9d1cf78 + 0c550fd commit 5119e44

11 files changed

Lines changed: 556 additions & 132 deletions

File tree

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 effect still on screen while an action holds its removal follows the lane's re-derivation of a memo it reads, as its direct `latest()` twin does (fuzzer adopted-staging case)
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 mainline mount whose child reads a lane derivation in flight shows the child as a stale reader beside its mount control, whether or not the lane is held (fuzzer F8)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"solid-js": patch
3+
---
4+
5+
Server `createMemo` over an async iterable now keeps by-slot flight memory like thenables do: a `<Loading>` retry that re-creates the node adopts the slot's settled first value (or joins its pending flight) instead of opening a fresh iterable every pass, so sources that hand back a new iterable per call (subscribers, `liveQuery()`) converge instead of reporting "did not converge".

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

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

‎packages/signals/docs/SPEC-ASYNC-SEMANTICS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ The former Tier A table is these sections. Tier B/C, the fixed violations, and t
4646

4747
**Membership in a hold is the tick's — the synchronous work one flush settles (2026-10-04, maintainer ruling; ruling 1 clarified, surfaced by #3761's review).** The frame is the tick, and a frame that derives from two futures waits on both: two mainline passes created before the same flush — no `flush()` between them — that each read a _different_ foreign hold join both, and the holds merge (`passTx` is one per tick, cleared by the flush that consumes it — `joinPassTx` merges a second transaction into it — exactly as `joinFuture` merges inside a flush). A manual `flush()` between two passes puts them in different frames: the second pass is a new tick, escapes the first's transaction, and the two holds stay independent. The tick is defined by the flush, not by a microtask, `await` or timer boundary. A29's "the entry is the pass's alone" scopes the entry away from the tick's other _writes_ (a write made after the mount is a mainline write, a render effect mounted beside it a stale reader), not from the tick's other passes. A15's "writes on fully disjoint graphs keep independent transitions" is about passes in different ticks. Pinned: `tests/tick-scoped-pass-transaction.test.ts` (`mountA(); mountB(); flush()` → the holds merge, both reveal at the second release, `isPending` true on both until then; `mountA(); flush(); mountB(); flush()` → independent, A reveals at its own release while B stays held).
4848

49+
**A lane's readers are placed by the screen, not by the lane's state (2026-10-05, maintainer ruling — reading A for all three; the semantic fuzzer's F8, F6 and adopted-staging cases).** A render effect off a lane that reads a lane node directly is a stale reader of the lane whether or not the lane is held at that moment, and a leaf reading the lane through a boundary that shows content is the lane's frame reader through it — and a leaf whose removal an adopted write stages (O1) still follows the lane's work while it is on screen (reading A, ruled), rather than waiting with the tick that staged its removal (reading B, rejected). **F8:** a mainline mount over a lane derivation whose re-ask nobody had observed (the lane not held) publishes its control, and a child reading the derivation directly shows the screen — the lane's revealed derivation — and re-derives at the reveal (A15 lanes corollary, #3460). Before, the child entered the lane and the control published without it, so control and content disagreed. Pre-L2 held the whole mount, which entangles more than the rule names. A derivation between the lane node and the leaf (a memo, a boundary's tree memo) is not a leaf: the mount is born held under A29's creation-time form and reveals control and content together at the landing, as #3761 rules for a mount over a foreign hold. Derivations carry the future, and that variant stays held. **F6:** a `Loading` showing content is transparent (A33, B5 — "the root holds the frame as for any reader"), so the leaf reading its output holds the lane on the derivation under it, as the same leaf reading the derivation directly does (A17; `createMemo.test.ts` A10 lane pins). The lane does not reveal `latest = 1` beside the boundary's `0`, and both show at the landing. A boundary on its fallback still holds nothing (A33). An `on`-reset boundary's one-checkpoint `[1, 0]` is a separate, older question and is not decided here. **Adopted staging:** a render effect under a mount whose withdrawal the action adopted (O1) reads a memo the lane recomputes. Its removal is staged, so it is still on screen (a zombie, live for every hold but the staging one's, #3463). Ruled (reading A): it follows the lane's work and shows `[1]`, as the same effect reading `latest()` directly already does (#3444), because wrapping a `latest` read in a memo does not change what it answers (A28 (1)). Rejected (reading B): the tick is one frame and the adopted hide makes the subtree the action's work, so it would keep the committed `[0]` until the hide commits or nets out while `latest()` read directly peers through by #3444's exception — and a sibling reader of the same memo off the withdrawn subtree shows `[1]` beside it, two on-screen readers of one memo disagreeing. Pre-L2 showed `[1]`. Pinned: `tests/fuzz-findings-l2.test.ts` "F8: …", "F8 (memo between): …", "adopted staging: …". F6 is ruled but not yet implemented: the boundary's output counting as the lane's frame reader also holds a lane the transaction dissolves before it is shown, which A18 (c)'s pins (`spec-async-semantics.test.ts` "differing arrival…", "sync wrapper…"; `store/lane-authority-twins.test.ts` #3331) expect to reveal — its pin stays `it.fails` until A18 (c) is read for that case.
50+
4951
## Reads and visibility — what a read serves
5052

5153
### A17. An active override is the displayed value until its transaction commits, and the graph's value until its own source answers

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,9 @@ function dissolveLane(l: Transaction, into: Transaction | null, except?: Signal<
487487
* — and is no lane's; an untracked read sees the lane's latest value (A17:
488488
* "direct read shows optimistic"; A28); a children-forbidden reader sees
489489
* the frame (A32). A render effect in the frame's seat reading a lane the
490-
* seam found blocked and that has not shown sees the screen — the committed
491-
* value, re-derived at the reveal (#3460's stale reader) — or, the node a
490+
* seam found blocked, or a member whose own flight is up (held or not — the
491+
* lane-membership ruling, 2026-10-05), sees the screen, re-derived at the
492+
* reveal (#3460's stale reader) — or, the node a
492493
* flight that has never shown (nothing to show), waits on it: its own frame
493494
* holds (A15, #3334), not the lane's parent. Any other tracked reader is
494495
* the lane's work from this read — a derivation; a leaf reading a lane that
@@ -531,7 +532,7 @@ export function laneRead(c: Computed<any> | null, el: Signal<any> | Computed<any
531532
)
532533
return el._pendingValue;
533534
}
534-
if (l._held) {
535+
if (l._held || (!guess && status & STATUS_PENDING)) {
535536
if (!guess && !l._shown && status & STATUS_UNINITIALIZED) throw new NotReadyError(null);
536537
// Re-derived at the reveal; once per pass (the pass may also be a stale
537538
// reader of a transaction, REACTIVE_FRAME_READ — both reruns apply).

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,11 +1084,15 @@ export function insertSubs(node: Signal<any> | Computed<any>): void {
10841084
/** Lane work re-staged (lanes.ts; `recompute`): the lane's members among
10851085
* its subscribers re-derive as the lane's work (REACTIVE_LANE_DIRTY), their
10861086
* runs held with it — not as stale readers republishing the committed view
1087-
* (#3460). After `insertSubs`. */
1087+
* (#3460). After `insertSubs`. A render effect on no lane is marked too:
1088+
* inert for its pass (`recompute` seats a lane only from its own `_x`), it
1089+
* is a live write if the effect becomes a zombie later this flush — an
1090+
* on-screen reader whose removal an adopted write stages follows the lane
1091+
* (the lane-membership ruling, 2026-10-05; `_update`). */
10881092
export function laneDirty(node: Signal<any> | Computed<any>, l: Transaction): void {
10891093
for (let s = node._subs; s !== null; s = s._nextSub) {
10901094
const t = s._sub._x?._transaction;
1091-
if (t != null && sameLane(t, l)) s._sub._flags |= REACTIVE_LANE_DIRTY;
1095+
if (t?._lane ? sameLane(t, l) : (s._sub as any)._type) s._sub._flags |= REACTIVE_LANE_DIRTY;
10921096
}
10931097
}
10941098
/** One lane, or two of one link group (#3335): one reveal unit. */

‎packages/signals/tests/fuzz-findings-l2.test.ts‎

Lines changed: 213 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -445,79 +445,224 @@ describe("fuzz findings on L2 — lanes", () => {
445445

446446
// F8. A15 lanes corollary (#3460): "a render effect OFF the lane that reads
447447
// what the lane is revealing … shows the committed value, publishes now,
448-
// entangles nothing — and re-derives at the release"; ruling 1: a flush
449-
// parks as a whole. A mainline mount whose child reads a lane-held pending
450-
// derivation publishes the mount control (`mounted=true`) while the child
451-
// never attaches until the action ends — neither the committed value now
452-
// nor a held frame: a torn mount (fuzzer S2 "mount control").
453-
it.fails(
454-
"F8: a mainline mount reading a lane-held pending derivation shows with its mount control (A15 lanes corollary)",
455-
async () => {
456-
const [source, setSource] = createSignal(0);
457-
const [mounted, setMounted] = createSignal(false);
458-
const gates = new Map<string, () => void>();
459-
let resume!: () => void;
460-
let run!: () => Promise<void>;
461-
let shownMounted: unknown;
462-
let child: unknown = "absent";
463-
let dispose!: () => void;
464-
createRoot(d => {
465-
dispose = d;
466-
const derived = createMemo(() => {
467-
const v = latest(source);
468-
return gated(gates, `d:${v}`, v);
448+
// entangles nothing — and re-derives at the release"; the lane-membership
449+
// ruling (2026-10-05, reading A): a stale reader of the lane "whether or
450+
// not the lane is held at that moment". A mainline mount whose child reads
451+
// a lane derivation whose re-ask nobody had observed (the seam left the
452+
// lane unheld) published the mount control while the child entered the
453+
// lane and waited on the flight — a torn mount (fuzzer S2 "mount
454+
// control"). `laneRead`'s stale-reader arm was gated on `_held`; it now
455+
// also takes a leaf reading a lane member whose own flight is up: the
456+
// child shows the screen (the lane's revealed derivation) beside its
457+
// control, and re-derives at the reveal. Through a memo the mount is born
458+
// held instead (A29, #3761): the next pin.
459+
it("F8: a mainline mount over a lane derivation in flight shows its child as a stale reader beside its mount control (A15 lanes corollary)", async () => {
460+
const [source, setSource] = createSignal(0);
461+
const [mounted, setMounted] = createSignal(false);
462+
const gates = new Map<string, () => void>();
463+
let resume!: () => void;
464+
let run!: () => Promise<void>;
465+
let shownMounted: unknown;
466+
let child: unknown = "absent";
467+
let dispose!: () => void;
468+
createRoot(d => {
469+
dispose = d;
470+
const derived = createMemo(() => {
471+
const v = latest(source);
472+
return gated(gates, `d:${v}`, v);
473+
});
474+
createRenderEffect(mounted, v => {
475+
shownMounted = v;
476+
});
477+
createRenderEffect(
478+
() =>
479+
mounted()
480+
? createRoot(dd => {
481+
createRenderEffect(derived, v => {
482+
child = v;
483+
});
484+
onCleanup(() => {
485+
child = "absent";
486+
});
487+
return dd;
488+
})
489+
: undefined,
490+
dd => {
491+
if (dd) onCleanup(dd);
492+
}
493+
);
494+
run = action(function* () {
495+
setSource(1);
496+
yield new Promise<void>(r => {
497+
resume = r;
469498
});
470-
createRenderEffect(mounted, v => {
471-
shownMounted = v;
499+
setSource(2);
500+
yield new Promise<void>(r => {
501+
resume = r;
472502
});
473-
createRenderEffect(
474-
() =>
475-
mounted()
476-
? createRoot(dd => {
477-
createRenderEffect(derived, v => {
503+
});
504+
});
505+
flush();
506+
gates.get("d:0")!();
507+
await drain();
508+
const p = run();
509+
await drain();
510+
gates.get("d:1")!(); // the lane's first derivation lands
511+
await drain();
512+
resume(); // source=2: the derivation re-asks, the lane is held again
513+
await drain();
514+
setMounted(true); // a mainline mount over the held derivation
515+
await drain();
516+
// The control publishes; the child shows the lane's screen beside it.
517+
expect([shownMounted, child]).toEqual([true, 1]);
518+
gates.get("d:2")!();
519+
await drain();
520+
expect([shownMounted, child]).toEqual([true, 2]); // re-derived at the reveal
521+
resume();
522+
await p;
523+
await drain();
524+
dispose();
525+
});
526+
527+
it("F8 (memo between): a mainline mount deriving from a lane derivation in flight is born held, control and child together (A29, #3761)", async () => {
528+
const [source, setSource] = createSignal(0);
529+
const [mounted, setMounted] = createSignal(false);
530+
const gates = new Map<string, () => void>();
531+
let resume!: () => void;
532+
let run!: () => Promise<void>;
533+
let shownMounted: unknown;
534+
let child: unknown = "absent";
535+
let dispose!: () => void;
536+
createRoot(d => {
537+
dispose = d;
538+
const derived = createMemo(() => {
539+
const v = latest(source);
540+
return gated(gates, `d:${v}`, v);
541+
});
542+
createRenderEffect(mounted, v => {
543+
shownMounted = v;
544+
});
545+
createRenderEffect(
546+
() =>
547+
mounted()
548+
? createRoot(dd => {
549+
createRenderEffect(
550+
createMemo(() => derived()),
551+
v => {
478552
child = v;
479-
});
480-
onCleanup(() => {
481-
child = "absent";
482-
});
483-
return dd;
484-
})
485-
: undefined,
486-
dd => {
487-
if (dd) onCleanup(dd);
488-
}
489-
);
490-
run = action(function* () {
491-
setSource(1);
492-
yield new Promise<void>(r => {
493-
resume = r;
494-
});
495-
setSource(2);
496-
yield new Promise<void>(r => {
497-
resume = r;
498-
});
553+
}
554+
);
555+
onCleanup(() => {
556+
child = "absent";
557+
});
558+
return dd;
559+
})
560+
: undefined,
561+
dd => {
562+
if (dd) onCleanup(dd);
563+
}
564+
);
565+
run = action(function* () {
566+
setSource(1);
567+
yield new Promise<void>(r => {
568+
resume = r;
569+
});
570+
setSource(2);
571+
yield new Promise<void>(r => {
572+
resume = r;
499573
});
500574
});
501-
flush();
502-
gates.get("d:0")!();
503-
await drain();
504-
const p = run();
505-
await drain();
506-
gates.get("d:1")!(); // the lane's first derivation lands
507-
await drain();
508-
resume(); // source=2: the derivation re-asks, the lane is held again
509-
await drain();
510-
setMounted(true); // a mainline mount over the held derivation
511-
await drain();
512-
// The mount control and its child are one frame: both show, or neither.
513-
expect(shownMounted === true).toBe(child !== "absent");
514-
gates.get("d:2")!();
515-
resume();
516-
await p;
517-
await drain();
518-
dispose();
519-
}
520-
);
575+
});
576+
flush();
577+
gates.get("d:0")!();
578+
await drain();
579+
const p = run();
580+
await drain();
581+
gates.get("d:1")!(); // the lane's first derivation lands
582+
await drain();
583+
resume(); // source=2: the derivation re-asks, the lane is held again
584+
await drain();
585+
setMounted(true); // a mainline mount over the held derivation
586+
await drain();
587+
// A derivation carries the future: the whole mount waits for it.
588+
expect([shownMounted, child]).toEqual([false, "absent"]);
589+
gates.get("d:2")!();
590+
await drain();
591+
expect([shownMounted, child]).toEqual([true, 2]); // revealed together
592+
resume();
593+
await p;
594+
await drain();
595+
dispose();
596+
});
597+
598+
// Adopted staging (ex-"R-oracle", latest cohort). The lane-membership
599+
// ruling (2026-10-05, reading A): an on-screen render effect whose removal
600+
// an adopted write has staged follows the lane's re-derivation of a memo
601+
// it reads; A15 #3463: a zombie is live for every hold until the commit
602+
// that disposes it; A28 (1): wrapping a `latest` read in a memo does not
603+
// change what it answers. An action writes `source = 1`; the same tick
604+
// withdraws the mount around `E` (adopted, O1), so `E` is a zombie of the
605+
// action's frame. The lane recomputes `m = [latest(source)]`; `E`'s pass
606+
// was deferred as a zombie's and the park cancelled it — `E` kept `[0]`
607+
// while a sibling reader of `m` showed `[1]` (the direct `latest()` twin
608+
// already re-ran, #3444). The lane's re-staging of `m` marks `E` too
609+
// (`laneDirty`: a render effect on no lane), so its zombie pass is a live
610+
// write and runs now, as the lane's dirty members do.
611+
it("adopted staging: a reader whose removal an action adopted follows the lane's re-derivation of a memo it reads (A15 #3463, A28 (1))", async () => {
612+
const [source, setSource] = createSignal(0);
613+
const [mounted, setMounted] = createSignal(true);
614+
let resume!: () => void;
615+
let run!: () => Promise<void>;
616+
let E: unknown = "absent",
617+
S: unknown,
618+
M: unknown;
619+
let dispose!: () => void;
620+
createRoot(d => {
621+
dispose = d;
622+
const m = createMemo(() => [latest(source)]);
623+
createRenderEffect(m, v => {
624+
S = JSON.stringify(v);
625+
});
626+
createRenderEffect(mounted, v => {
627+
M = v;
628+
});
629+
createRenderEffect(
630+
() =>
631+
mounted()
632+
? createRoot(dd => {
633+
createRenderEffect(m, v => {
634+
E = JSON.stringify(v);
635+
});
636+
onCleanup(() => {
637+
E = "absent";
638+
});
639+
return dd;
640+
})
641+
: undefined,
642+
dd => {
643+
if (dd) onCleanup(dd);
644+
}
645+
);
646+
run = action(function* () {
647+
setSource(1);
648+
yield new Promise<void>(r => {
649+
resume = r;
650+
});
651+
});
652+
});
653+
flush();
654+
expect([M, E, S]).toEqual([true, "[0]", "[0]"]);
655+
const p = run();
656+
setMounted(false); // the action's tick: the withdrawal rides with it (O1)
657+
await drain();
658+
// The withdrawal is held: E is still on screen, and shows the lane's frame.
659+
expect([M, E, S]).toEqual([true, "[1]", "[1]"]);
660+
resume();
661+
await p;
662+
await drain();
663+
expect([M, E, S]).toEqual([false, "absent", "[1]"]);
664+
dispose();
665+
});
521666

522667
// F13. A29 (creation-time form): a reader born held is "staged into [the
523668
// transaction], committed with it" — `recompute`'s own note: "An effect

0 commit comments

Comments
 (0)