Skip to content

Commit 4f9768f

Browse files
ryansolidclaude
andauthored
fix(signals): a memo reading through a linked re-based lane no longer loops at the seam (#4643) (#4658)
* fix(signals): a memo reading through a linked re-based lane no longer loops at the seam (#4643) A memo seated in one lane whose pass read through a lane linked to it, re-based over a parked frame's answer (`over`, #4525), read that frame's staging there (#4536). The seam's `stagedReaders` loop re-derived it on the committed world: the re-run re-entered the linked lane, read the staging again and parked again, every round (Potential Infinite Loop Detected). The #4536 carve-out in `laneSeams` checked only the memo's own lane; it now checks the lane's link group (one reveal unit). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE * fix(signals): lane work re-based over a hold joins nothing; a push after a removal guess composes on it (#4643) Lane work re-based over a hold's answer (`over`) read that staging and, as a computed, joined the flush into the hold (`joinPass`). D-37: lane work never makes a flush the hold's. Joined, the seam re-derived it into a loop; a plain write beside it (the inbox filter) was held while the lane showed it and retracted at the next seam (F-7, Hold); a guess beside the held answer revealed it through a linked lane, torn against the count (F-1). It now joins nothing, as the lane's render effects. The writer's view compared a length guess with the source instead of the clone, so a removal guess's `undefined` slot extended the draft and a later push wrote after a hole (#4642's hole; the same line as #4656). laneSeams' link-group carve-out compares with `==` (both sides are Transaction | null), for size. Pins every frame of the inbox shapes (the issue's, with a declined delete), a toggle beside a held poll answer, and pushes after removals. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE * perf(signals): the re-based lane's no-join decided in frameRead, not joinPass (#4643) frameRead now joins `el`'s transaction itself on every path that serves the staging, except the lane re-based over that transaction's answer (`over`, #4536), which reads the staging and joins nothing (D-37). The guard in joinPass and the callers' joinPass calls go: the core floors are 16 B minified under next instead of 10 B over. Adds an it.fails pin for the review's D-34 ¶2 gap: a user effect beside the toggle's list sees the held poll answer the screen does not show. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE --------- Co-authored-by: Claude <[email protected]>
1 parent a4a0720 commit 4f9768f

6 files changed

Lines changed: 600 additions & 37 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+
Fix an infinite flush loop when a memo over an optimistic store list (an "N left" count, a filter) read through a lane re-based over a parked refresh (#4643). Lane work re-based over a hold's answer no longer joins the flush into that hold, so a plain write beside it (a filter change) shows once instead of showing, retracting and showing again, and a guess beside the held answer no longer reveals it early. A push after a removal guess no longer leaves an `undefined` row in the list.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
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… |
6060
| A13 | ruled | `docs/SPEC-ASYNC-SEMANTICS.md:207` | — | spec-async-semantics.test.ts×7 | [ruled 2026-07-06 (promoted from B1)] Resting optimistic ≡ plain async memo at every checkpoint — (was B1) A resting optimistic node (no active override) is observationally identical to a plain async … |
6161
| A14 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:215` | — | spec-async-semantics.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from B2)] Companion nodes get child lanes that do not merge with the owner — (was B2) `isPending`/`latest` companion nodes get child lanes that do not mer… |
62-
| A15 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:251` | async.ts×2 constants.ts×1 core.ts×4 effect.ts×1 lanes.ts×6 scheduler.ts×16 seat.ts×1 verdict.ts×4 store.ts×1 | async-chain-supersession.test.ts×1 boundary-output-frame-reader.test.ts×1 create-deferred-3710.test.ts×2 first-observer-stale-reader.test.ts×1 fuzz-findings-l2.test.ts×17 held-restore.test.ts×1 hold-recovers-landing-reruns-4469.test.ts×1 l2-contract.test.ts×7 l2-fuzz-existing-rules.test.ts×2 lane-contract.test.ts×1 lane-hold-on-observation.test.ts×1 lane-outside-view.test.ts×1 lane-pass-stamped-effect-3662.test.ts×1 latest-memo-inline-parity.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×1 loading-fallback-in-flush-3540.test.ts×4 mount-over-foreign-hold-3761.test.ts×2 overlapping-flights.test.ts×3 posture-born-held-and-observation.test.ts×4 posture-store-parity.test.ts×2 reveal-carve-out.test.ts×2 shared-effect-no-entangle.test.ts×1 show-stale-child-in-action-4137.test.ts×1 spec-async-semantics.test.ts×2 stale-read-uninitialized-cross-transition.test.ts×1 superseded-source-blocks-3462.test.ts×2 tick-scoped-pass-transaction.test.ts×1 tracked-effect-staged-dep-4606-4607.test.ts×1 treeshake.test.ts×4 unread-derive-midflight-mount-4491.test.ts×1 verdict-memo-flight-no-reask.test.ts×1 verdict-memo-held-branch-4544.test.ts×1 verdict-shortcut-pending-source-liveness.test.ts×1 visibility-oracle-store.states.ts×6 visibility-oracle.states.ts×7 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from B3)] Transition entanglement is graph-driven; lanes settle as one reveal — (was B3) Transition entanglement is graph-driven: writes whose async work … |
62+
| A15 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:251` | async.ts×2 constants.ts×1 core.ts×4 effect.ts×1 lanes.ts×6 scheduler.ts×16 seat.ts×1 verdict.ts×4 store.ts×1 | async-chain-supersession.test.ts×1 boundary-output-frame-reader.test.ts×1 create-deferred-3710.test.ts×2 first-observer-stale-reader.test.ts×1 fuzz-findings-l2.test.ts×17 held-restore.test.ts×1 hold-recovers-landing-reruns-4469.test.ts×1 l2-contract.test.ts×7 l2-fuzz-existing-rules.test.ts×2 lane-contract.test.ts×1 lane-hold-on-observation.test.ts×1 lane-outside-view.test.ts×1 lane-pass-stamped-effect-3662.test.ts×1 latest-memo-inline-parity.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×1 loading-fallback-in-flush-3540.test.ts×4 mount-over-foreign-hold-3761.test.ts×2 optimistic-lane-seam-loop-4643.test.ts×1 overlapping-flights.test.ts×3 posture-born-held-and-observation.test.ts×4 posture-store-parity.test.ts×2 reveal-carve-out.test.ts×2 shared-effect-no-entangle.test.ts×1 show-stale-child-in-action-4137.test.ts×1 spec-async-semantics.test.ts×2 stale-read-uninitialized-cross-transition.test.ts×1 superseded-source-blocks-3462.test.ts×2 tick-scoped-pass-transaction.test.ts×1 tracked-effect-staged-dep-4606-4607.test.ts×1 treeshake.test.ts×4 unread-derive-midflight-mount-4491.test.ts×1 verdict-memo-flight-no-reask.test.ts×1 verdict-memo-held-branch-4544.test.ts×1 verdict-shortcut-pending-source-liveness.test.ts×1 visibility-oracle-store.states.ts×6 visibility-oracle.states.ts×7 visibility-oracle.test.ts×1 write-proposals-3494.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from B3)] Transition entanglement is graph-driven; lanes settle as one reveal — (was B3) Transition entanglement is graph-driven: writes whose async work … |
6363
| A16 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:223` | scheduler.ts×1 | caught-reactive-read-diagnostic.test.ts×1 latest-uninitialized-over-latest-4362.test.ts×2 spec-async-semantics.test.ts×1 strict-read-pending-store.test.ts×2 uninitialized-visibility.test.ts×1 visibility-oracle-store.states.ts×2 visibility-oracle.states.ts×2 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from B5)] `isPending` never throws in untracked contexts — (was B5) `isPending` never throws in untracked contexts — thunks that throw real errors or read… |
6464
| A17 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:71` | async.ts×3 constants.ts×1 lanes.ts×7 scheduler.ts×2 seat.ts×1 verdict.ts×1 map.ts×1 optimistic.ts×1 store.ts×3 | create-deferred-3710.test.ts×1 fuzz-findings-l2.test.ts×6 lane-uninitialized-landing-3648.test.ts×5 optimistic-over-held-row-3796.test.ts×1 optimistic-read-lane-not-transaction-3698.test.ts×2 optimistic-undefined-override.test.ts×1 posture-store-parity.test.ts×1 refresh-await.test.ts×1 reveal-gating-contract.test.ts×3 spec-async-semantics.test.ts×10 createOptimisticStore.test.ts×2 kanban-a17-fixture.test.ts×3 optimistic-list-mutation-matrix.test.ts×1 optimistic-maparray-index-frame-f1.test.ts×1 optimistic-untracked-reads-f3-f5.test.ts×1 signal-store-twins-qd.test.ts×1 treeshake.test.ts×1 until.test.ts×1 visibility-oracle-store.states.ts×24 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×20 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-06 (promoted from C4)] An active override is the displayed value until its transaction commits, and the graph's value until its own source answers — **Statement (curre… |
6565
| A18 | amended | `docs/SPEC-ASYNC-SEMANTICS.md:81` | action.ts×1 async.ts×2 core.ts×3 lanes.ts×8 scheduler.ts×2 types.ts×1 verdict.ts×1 map.ts×1 optimistic.ts×1 projection.ts×1 | body-end-supersession-visibility.test.ts×4 createOptimistic.test.ts×3 l2-fuzz-existing-rules.test.ts×2 lane-contract.test.ts×1 lane-frame-deferred-run-3662.test.ts×1 lane-outside-view.test.ts×1 lane-uninitialized-landing-3648.test.ts×5 optimistic-move-duplicate-3548.test.ts×2 optimistic-read-lane-not-transaction-3698.test.ts×4 posture-store-parity.test.ts×5 spec-async-semantics.test.ts×5 flight-owned-transaction.test.ts×1 lane-authority-twins.test.ts×1 optimistic-list-mutation-matrix.test.ts×1 optimistic-untracked-reads-f3-f5.test.ts×1 signal-store-twins-qd.test.ts×1 unchanged-presence-no-hold-3743.test.ts×2 superseded-before-first-commit.test.ts×4 visibility-oracle-store.states.ts×8 visibility-oracle-store.test.ts×1 visibility-oracle.states.ts×19 visibility-oracle.test.ts×1 | [ruled, amended in place 2026-07-07 (promoted from B4)] An override lives exactly as long as its own transaction; a newer truth from the source supersedes it in the graph immediately, on screen at com… |

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

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,38 +1359,45 @@ function frameRead(c: Computed<any>, el: Signal<any> | Computed<any>): boolean {
13591359
// (Verdict readers and lanes exist only with their engines installed.)
13601360
// #4544: nor a pass whose posture is only inherited, reading the hold's
13611361
// own write (verdict.ts `holdStaging`): it is the hold's work.
1362+
// Not served the screen, the pass reads the staging and joins `el`'s
1363+
// transaction (`joinPass`), but for the lane case below.
13621364
const verdict = observeFlightHook && c._config & CONFIG_VERDICT;
1363-
if (verdict && holdStagingHook!(c, el)) return false;
13641365
const lane = laneStageHook && passLane !== null;
13651366
if (
1366-
(!lane ||
1367-
(c._statusFlags & STATUS_UNINITIALIZED &&
1368-
(el as Computed<any>)._statusFlags & STATUS_PENDING)) &&
1369-
!verdict &&
1370-
// CONFIG_FRAME, spelled as at the effect's creation.
1371-
(!(c._config & (EFFECT_RENDER << 23)) || el._config & CONFIG_INPUTS_PUBLISHED)
1372-
)
1373-
return false;
1374-
const t = txOf(el);
1375-
// Lane work and verdict readers are never the transaction's pass, whichever
1376-
// flush runs it: a node T holds re-enters T when it re-runs (`recompute`'s
1377-
// head), and the pass may then read a guess and become the lane's.
1378-
// Except a lane re-based over this transaction's answer (merged since or
1379-
// not), in whichever flush: its rows are that answer's, so its work reads
1380-
// the rest of it (#4536). Served the screen outside that flush, a refresh
1381-
// or another change's flush re-derived it over the old inputs, and the
1382-
// landing committed that beside the new ones (F-1, D-34 ¶3, #4576, #4577).
1383-
if (
1384-
((lane ? passLane!.over && resolveTx(passLane!.over) === t : t === flushTransaction) &&
1385-
!verdict) ||
1386-
bornInto(c, t)
1387-
)
1388-
return false;
1389-
staleReader(c, t);
1390-
// Lane work or a verdict reader no longer waits on `el`'s flight (lanes.ts
1391-
// `laneServed`, A15).
1392-
if (lane || verdict) laneServedHook!(c, el);
1393-
return true;
1367+
!(verdict && holdStagingHook!(c, el)) &&
1368+
!(
1369+
(!lane ||
1370+
(c._statusFlags & STATUS_UNINITIALIZED &&
1371+
(el as Computed<any>)._statusFlags & STATUS_PENDING)) &&
1372+
!verdict &&
1373+
// CONFIG_FRAME, spelled as at the effect's creation.
1374+
(!(c._config & (EFFECT_RENDER << 23)) || el._config & CONFIG_INPUTS_PUBLISHED)
1375+
)
1376+
) {
1377+
const t = txOf(el);
1378+
// Lane work and verdict readers are never the transaction's pass, whichever
1379+
// flush runs it: a node T holds re-enters T when it re-runs (`recompute`'s
1380+
// head), and the pass may then read a guess and become the lane's.
1381+
// Except a lane re-based over this transaction's answer (merged since or
1382+
// not), in whichever flush: its rows are that answer's, so its work reads
1383+
// the rest of it (#4536). Served the screen outside that flush, a refresh
1384+
// or another change's flush re-derived it over the old inputs, and the
1385+
// landing committed that beside the new ones (F-1, D-34 ¶3, #4576, #4577).
1386+
// It reads that staging as the lane's render effects do, joining
1387+
// nothing — lane work never makes a flush the hold's (D-37). Joined, a
1388+
// plain write the flush carried was held into that hold while the lane
1389+
// showed it, and retracted at the next seam (F-7, #4643).
1390+
if (lane && passLane!.over && resolveTx(passLane!.over) === t && !verdict) return false;
1391+
if (!((!lane && t === flushTransaction && !verdict) || bornInto(c, t))) {
1392+
staleReader(c, t);
1393+
// Lane work or a verdict reader no longer waits on `el`'s flight
1394+
// (lanes.ts `laneServed`, A15).
1395+
if (lane || verdict) laneServedHook!(c, el);
1396+
return true;
1397+
}
1398+
}
1399+
joinPass(c, el);
1400+
return false;
13941401
}
13951402

13961403
/** A node born into transaction `t`: held by it and never committed (A29,
@@ -2159,7 +2166,6 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
21592166
if (__TEST__) shadowActual(SLOT_C);
21602167
return el._value as T;
21612168
}
2162-
joinPass(c as Computed<any>, el);
21632169
}
21642170
}
21652171
// Committed visibility for untracked and children-forbidden readers.
@@ -2277,9 +2283,8 @@ export function read<T>(el: Signal<T> | Computed<T>): T {
22772283
!(el._config & CONFIG_OVERRIDE) &&
22782284
!(c._config & CONFIG_CHILDREN_FORBIDDEN)
22792285
) {
2280-
if (owner._statusFlags & STATUS_UNINITIALIZED || !frameRead(c as Computed<any>, el))
2281-
joinPass(c as Computed<any>, el);
2282-
else committed = true;
2286+
if (owner._statusFlags & STATUS_UNINITIALIZED) joinPass(c as Computed<any>, el);
2287+
else committed = frameRead(c as Computed<any>, el);
22832288
}
22842289
} else if (__TEST__) shadowExpect(null, el, tracking, 0, spectating, false);
22852290
// Lanes: a lane's node (after the pull — the node is current). NOT_PENDING

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,15 +1111,18 @@ const laneSeams = (t: Transaction | null): void => {
11111111
// lane holds while the frame does (`laneSeam`).
11121112
// Re-derived on the committed world, it paired the new rows with the
11131113
// old inputs, and the landing revealed that beside them (F-1, D-34 ¶3,
1114-
// #4577).
1114+
// #4577). A lane linked to such a lane counts (one reveal unit): a
1115+
// memo seated in one whose pass read through the other read the
1116+
// frame's staging there, and, re-derived, it re-entered that lane,
1117+
// read it again and parked again, every round (#4643).
11151118
if (
11161119
r._flags & REACTIVE_DISPOSED ||
11171120
(l?._lane
11181121
? (l._parent?._verdict === l &&
11191122
(r._config & CONFIG_VERDICT
11201123
? !(r._flags & REACTIVE_PROBE_UNANSWERED)
11211124
: !blocked(t!) || heldBy(t!, r))) ||
1122-
(l.over && liveTx(l.over) === t)
1125+
(l._links || [l]).some(u => u.over && liveTx(u.over) == t)
11231126
: l &&
11241127
!(
11251128
r._flags & REACTIVE_PROBE_UNANSWERED ||

‎packages/signals/src/store/optimistic.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ export function optimisticView(
824824
if (node._config & CONFIG_OVERRIDE) ov = pick(node);
825825
else if (!writer || (ov = pendingGuessOf(node)) === NOT_PENDING) continue;
826826
if (key === "length" && Array.isArray(src)) {
827-
if ((src as any[]).length !== ov) (ensure() as any[]).length = ov as number;
827+
if ((out ?? src).length !== ov) (ensure() as any[]).length = ov as number;
828828
} else if (!isEqual(src[key as any], ov) || !hasOwn.call(src, key)) {
829829
ensure()[key as any] = ov;
830830
}

0 commit comments

Comments
 (0)