Skip to content

fix(signals): a guess over a question in flight keeps the frame whole with a memo between the list and its binding (#4561) - #4572

Merged
ryansolid merged 8 commits into
nextfrom
claude/project-thread-x1ore2-4561
Nov 1, 2026
Merged

ryansolid merged 8 commits into
nextfrom
claude/project-thread-x1ore2-4561

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #4561.

Before: when a memo sits between a keyed list and its split binding, an optimistic guess made while a new question is in flight tore the frame. The filter binding showed closed while the rows still showed the guessed open list (closed: [#3][#4]). This happened with and without on, and under on the fallback was dropped too. That breaks F-1 (whole frame) and D-34 ¶3 (a guess over a question in flight doesn't answer it).

After: the frame stays whole. At the guess the screen shows open: [#3][#4] (the old input plus the guess), or loading under on (D-14). After the answer it shows closed: [#2]. No frame ever pairs closed with the guessed rows.

The memo was held by the transaction that commits the new question, but its guess re-run ran on mainline inside that transaction's flush. It was served the guess and stopped waiting on the pending derive, so nothing blocked the commit. 5bcd2cb's derivation gate (075bcaf in #4558's history) covered this case, but later commits in #4558 narrowed it to render effects only, so a memo hop slipped through.

How: the stands hook in store/optimistic.ts brings that gate back as held(c), which matches a render effect or a derivation read by a pending render effect (the readers in scheduler.ts blockedBy's hold). A held render effect, or any held reader when no transaction owns the flight, still does a plain read of the derive (the Loading on path). A held derivation under a transaction is linked to the derive and registered as a stale reader of that transaction (staleReader), so it keeps blocking the commit, still gets the guess like lane work (the <For> behaviour from #4525 / D-35 is unchanged), and re-derives when the transaction lands. Everything sits behind the optimistic engine hook, so core, hello world and plain createStore are unchanged (0 B). The new test optimistic-guess-memo-binding-4561.test.ts covers memo, mapArray and <For>-style shapes, with and without on.

One residue: with a flat memo over every row and no on, the guess frame keeps the old answer (open: [#1][#3][#4]) instead of showing the guess. The frame is still whole (F-2, and the existing #4536 shared-effect test already allows it), but D-34 ¶3's "old input plus the guess" isn't met for that one shape. The test accepts either at that frame.

Changeset: patch.


Generated by Claude Code

… with a memo between the list and its binding (#4561)

#4558 kept a render effect in the frame's hold observing the flight a list
guess was written over, but a derivation between the list and its binding
(a memo, a mapArray) was served the guess as standing in for the flight,
stopped waiting on it, and the binding followed it out of the hold: the
frame committed `closed` beside the open answer's rows (F-1, D-34 ¶3).

The optimistic `stands` hook now treats a derivation a pending render
effect reads as part of the hold (scheduler `blockedBy`), as 075bcaf's
gate did: over a held flight it stays linked as a stale reader of the hold
and is still served the guess, so a <For> keeps showing it (#4525) while
the hold keeps its frame; over a flight no transaction holds (a `Loading
on` fallback) it reads the derive plainly. A flat memo over every row may
keep waiting with the old answer instead of showing the guess (F-2), as
#4536's shared-binding test allows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
@changeset-bot

changeset-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dce0383

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@solidjs/signals Patch
test-integration Patch
@solidjs/web Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
solid-js Patch
@solidjs/universal Patch
board-example Patch
canvas-example Patch
server-dbmon-example Patch
todos-server-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Size (brotli, eager entry chunk)

scenario head vs base minified vs base minified vs recorded cap lazy chunks (not counted)
signals: core floor (createSignal/Memo/Effect/Root/flush) 7.43 KB 0 B 0 B −108 B 7.43 KB ✅
signals: + createStore 15.00 KB 0 B 0 B 0 B 15.01 KB ✅
signals: + isPending/latest 11.44 KB 0 B 0 B +31 B 11.44 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.05 KB 0 B 0 B −101 B 8.06 KB ✅
app: render + one signal (the simple-app floor) 9.80 KB 0 B 0 B −167 B 9.80 KB ✅
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.80 KB +35 B (+0.2%) −65 B −203 B 18.80 KB ⚠️ over by 2 B, 223 B minified headroom lazy-page.js 0.04 KB
app: hydrating + every store primitive family 32.73 KB +61 B (+0.2%) +196 B +196 B 32.68 KB ❌ over by 45 B lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.50 KB 0 B 0 B 0 B 13.52 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.25 KB 0 B 0 B 0 B 15.26 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 29.84 KB 0 B 0 B −157 B 29.88 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.97 KB 0 B 0 B −204 B 9.98 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.28 KB 0 B 0 B −215 B 26.36 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.56 KB +5 B (+0.0%) −63 B −244 B 32.61 KB ✅ stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.75 KB 0 B 0 B 0 B 11.77 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.84 KB +32 B (+0.1%) −66 B −211 B 33.81 KB ⚠️ over by 25 B, 231 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.21 KB, wire.js 3.47 KB
page: live server components (base + live/GET + action + isPending/latest) 39.23 KB −23 B (−0.1%) −56 B −63 B 39.10 KB ⚠️ over by 132 B, 83 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.18 KB, wire.js 3.47 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 35.74 KB +18 B (+0.1%) −59 B −240 B 35.74 KB ⚠️ over by 3 B, 260 B minified headroom assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.06 KB, sc-comments.js 0.20 KB, trace.js 9.18 KB, wire.js 3.47 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 43.20 KB +23 B (+0.1%) −63 B −1 B 43.19 KB ⚠️ over by 6 B, 21 B minified headroom eager (counted): web.js 23.06 KB; assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.07 KB, sc-comments.js 0.19 KB, trace.js 9.24 KB, wire.js 3.47 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.16 KB −115 B (−0.3%) −11 B −11 B 41.33 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.07 KB, server.js 1.03 KB, serverForms.js 3.58 KB, trace.js 9.14 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 48.76 KB +36 B (+0.1%) −11 B +53 B 48.82 KB ✅ eager (counted): client.js 28.17 KB; assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.07 KB, server.js 1.03 KB, serverForms.js 3.30 KB, trace.js 9.14 KB, wire.js 3.49 KB
server: floor (getRequestEvent + isServer) 1.27 KB 0 B 0 B 0 B 1.29 KB ✅
server: renderToString (the server-render floor) 22.85 KB 0 B 0 B 0 B 22.87 KB ✅

⚠️ Over the brotli cap within the minified allowance (passes)

  • app: hydrating (no stores) with Show/For/Loading/Errored/lazy: over brotli cap by 2 B; minified 53,414 B vs 53,617 B recorded with the cap (−203 B) — 223 B of the 20 B minified allowance left; −65 B minified over this PR's base
  • page: base server components (hydrating + dynamic + frames + sf reference): over brotli cap by 25 B; minified 101,537 B vs 101,748 B recorded with the cap (−211 B) — 231 B of the 20 B minified allowance left; −66 B minified over this PR's base
  • page: live server components (base + live/GET + action + isPending/latest): over brotli cap by 132 B; minified 118,077 B vs 118,140 B recorded with the cap (−63 B) — 83 B of the 20 B minified allowance left; −56 B minified over this PR's base
  • page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread): over brotli cap by 3 B; minified 107,876 B vs 108,116 B recorded with the cap (−240 B) — 260 B of the 20 B minified allowance left; −59 B minified over this PR's base
  • page: compiled live server components (the compiled base page + live/GET + action + isPending/latest): over brotli cap by 6 B; minified 126,240 B vs 126,241 B recorded with the cap (−1 B) — 21 B of the 20 B minified allowance left; −63 B minified over this PR's base

❌ Fails the gate

  • app: hydrating + every store primitive family: over brotli cap by 45 B; minified 98,925 B vs 98,729 B recorded with the cap (+196 B) — 176 B past the 20 B minified allowance; +196 B minified over this PR's base. real growth: reduce it, or raise the cap and its recorded minified in this PR with a reason (frozen floors need Size-Exception:)

Bundled with Rolldown (what Vite ships), brotli q11, decimal KB. A scenario fails only when it is over its brotli cap and its minified size is more than 20 B over the minified recorded with the cap; over the cap within that allowance is brotli layout noise and passes with a warning. Caps and their recorded minified in scripts/size/scenarios.js; the floor and page caps in floor-caps.json are frozen (lower only, or Size-Exception: in the PR body). npm run ratchet lowers caps per RC; it never raises one (scripts/size/README.md).

@coveralls

coveralls commented Nov 1, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 41293404856

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 78.134%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1367
Covered Lines: 1129
Line Coverage: 82.59%
Relevant Branches: 1098
Covered Branches: 797
Branch Coverage: 72.59%
Branches in Coverage %: Yes
Coverage Strength: 29.89 hits per line

💛 - Coveralls
@codspeed

codspeed Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 6.96%

2 warnings

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 1 regressed benchmark
✅ 199 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ memo + sync render effect only (reference) 32 ms 34.4 ms -6.96%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/project-thread-x1ore2-4561 (dce0383) with next (9034647)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

… minified)

A render effect is read before the gate, so `held` only walks a
derivation's subscribers for a pending render effect. Same behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
…r pass

- `held` walks pending derivations transitively (memo -> memo -> binding,
  mapArray -> memo -> binding) to a pending render effect, as scheduler
  `blockedBy` judges the frame's hold (F-1).
- A reader this pass linked as a stale reader of the hold keeps the guess
  on its other reads of the family instead of falling to the ordinary
  pending read: a flat memo over every row now shows `open: [#3][#4]`
  (D-34 ¶3: however the reads are grouped). The "either outcome" assertion
  is gone.
- The judgment is cached per reader per pass (stamped with `clock`), so a
  reader's key reads no longer re-walk its subscribers each time (4000 keys
  x 400 subs guess flush back to ~next).
- Pins: two-hop, three-hop and mapArray->memo chains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE
Drop the per-pass Map cache for a single-slot one (last reader, the pass's
`clock`, its verdict; 2 once this pass linked it): a reader's key reads come
in one run, so one slot keeps them from re-walking its subscribers. `held` is
a plain early-return recursive walk again; the freshness check is computed
once and shared by the linked and unlinked branches. Behaviour, tests and the
4000 keys x 400 subs guess flush unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE

Copy link
Copy Markdown
Member Author

CodSpeed's flagged arrow in template (server renderToString, non-ascii-template) isn't from this change. CodSpeed says it ran on different hardware for base and head. The same bench flagged #4582, #4584 and #4585 this morning at −6 to −13%, and none of them touch SSR. This diff only changes the optimistic store hooks, which a renderToString bench never installs.

The relevant perf check is the guess flush at 4000 keys × 400 subscribers (local vitest on source): next 63–65 ms, this head 56–58 ms with user-effect subscribers, and 67–83 ms vs 67–77 ms with render effects.


Generated by Claude Code

…#4561)

A diamond graph of pending memos made held() exponential when no pending
render effect was reachable. Each derivation is now visited once per walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE
@ryansolid
ryansolid marked this pull request as ready for review November 1, 2026 14:44
@ryansolid
ryansolid merged commit 6ec1613 into next Nov 1, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants