Skip to content

fix(signals): don't retain the transaction a latest() read opened after it lands - #4460

Merged
ryansolid merged 2 commits into
nextfrom
claude/project-thread-x1ore2-latest-joined-release
Oct 30, 2026
Merged

ryansolid merged 2 commits into
nextfrom
claude/project-thread-x1ore2-latest-joined-release

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Summary

Before: #4453 recorded the flush transaction that a latest() read of an unheld flight opened in a module-level latestJoined, and nothing ever cleared it. After that flush's seam, it kept the landed transaction, along with its node and queue arrays, alive until the next such read overwrote it. A follow-up nit from the #4453 review.

After: the mark lives on the transaction itself (latest = 1), and the probe checks flushTransaction?.latest. The flag is collected together with the transaction, so nothing is retained. The answer is the same as the old latestJoined === flushTransaction check in every case:

  • Between the join and the seam, the flush's transaction is the one that was marked.
  • A merge into it keeps that transaction, so the flag stays.
  • A transaction merged away is never the flush's transaction again.
  • A parked, marked transaction that is re-joined later still counts as marked.

How

  • verdict.ts drops latestJoined. pendingVerdict sets the flag where it used to assign, and checks it where it used to compare.
  • scheduler.ts gains a type-only latest?: 1 field on Transaction. There is no new export.
  • The field isn't _-prefixed, following the folded precedent, so the property mangler's name assignment doesn't shift. = 1 beat = true on brotli.

Size vs next @ 42924f4 (brotli / minified):

scenario brotli minified
signals: + isPending/latest −13 B −10 B
page: live server components (frozen floor) −6 B −8 B
page: compiled live server components −16 B −9 B
page: live + router −11 B −8 B
every other scenario, hello world included 0 B 0 B

How did you test this change?

  • New case in packages/signals/tests/gc.test.ts: "releases the transaction a latest() read of an unheld refetch opened once it lands". It runs a latest(m) + isPending(m) reader through a refetch, takes a WeakRef to the transaction the read opened, lets the refetch land and forces GC. It fails on next because the transaction is still reachable, and passes with the fix (5/5 runs).
  • Suites: signals 6,005 passed, hydrate 716 passed. In web, 4 tests in uncommitted-input-overwritten.spec.tsx fail in this container both on next and on this branch, and everything else passes.


Generated by Claude Code

…er it lands

`pendingVerdict` (#4453) remembered the flush's transaction a `latest`
read of an unheld flight opened in a module-level `latestJoined`, compared
only against `flushTransaction` and never cleared: after the seam it kept
the last landed transaction (its `_nodes`, `_queues`, `_reruns`) alive
until the next such read overwrote it.

The mark now lives on the transaction itself (`Transaction.latest`), so
it ends with it. Same answer for every probe: a transaction stays the
flush's from its opening to the seam, a merge keeps the flush's own, and
one merged away is no longer anyone's flush transaction, as before. The
property is not `_`-prefixed (as `folded`), so the mangler's assignment
is untouched; only bundles importing `latest`/`isPending` change, and
they shrink (isPending/latest -13 B brotli, -10 B minified).

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

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e10c1fc

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 Oct 30, 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.42 KB 0 B 0 B +13 B 7.43 KB ✅
signals: + createStore 14.93 KB 0 B 0 B 0 B 14.95 KB ✅
signals: + isPending/latest 11.08 KB −13 B (−0.1%) −10 B +3 B 11.10 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.04 KB 0 B 0 B +13 B 8.06 KB ✅
app: render + one signal (the simple-app floor) 9.78 KB 0 B 0 B +13 B 9.78 KB ✅
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.75 KB 0 B 0 B +13 B 18.74 KB ⚠️ over by 5 B, 7 B minified headroom lazy-page.js 0.04 KB
app: hydrating + every store primitive family 32.42 KB −9 B (−0.0%) +6 B +19 B 32.45 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.45 KB 0 B 0 B 0 B 13.47 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.20 KB 0 B 0 B +13 B 15.20 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 29.76 KB 0 B 0 B 0 B 29.78 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.96 KB 0 B 0 B +13 B 9.98 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.29 KB 0 B 0 B 0 B 26.31 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.51 KB 0 B 0 B 0 B 32.52 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.70 KB 0 B 0 B +13 B 33.66 KB ⚠️ over by 45 B, 7 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.03 KB, wire.js 3.47 KB
page: live server components (base + live/GET + action + isPending/latest) 38.75 KB −6 B (−0.0%) −8 B +80 B 38.76 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.03 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.63 KB 0 B 0 B +13 B 35.66 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.06 KB, sc-comments.js 0.20 KB, trace.js 8.99 KB, wire.js 3.47 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 42.67 KB −16 B (−0.0%) −9 B +4 B 42.71 KB ✅ eager (counted): web.js 22.75 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.07 KB, wire.js 3.47 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.20 KB 0 B 0 B +13 B 41.23 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, server.js 1.03 KB, serverForms.js 3.57 KB, trace.js 9.02 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 48.31 KB −11 B (−0.0%) −8 B +5 B 48.44 KB ✅ eager (counted): client.js 27.86 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.00 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.79 KB 0 B 0 B 0 B 22.80 KB ✅

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

  • app: hydrating (no stores) with Show/For/Loading/Errored/lazy: over brotli cap by 5 B; minified 53,598 B vs 53,585 B recorded with the cap (+13 B) — 7 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • page: base server components (hydrating + dynamic + frames + sf reference): over brotli cap by 45 B; minified 101,618 B vs 101,605 B recorded with the cap (+13 B) — 7 B of the 20 B minified allowance left; +0 B minified over this PR's base

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).

The #4400 case writes s, waits 3 ms, and writes again while a 10 ms ask is
in flight. On CI's coverage run the real gap outlived the ask, which landed
before the second write and asked `m1:23` (seen on #4455 and #4460). The
gaps are part of each scenario, so the file now advances fake timers
instead of sleeping.

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

Copy link
Copy Markdown
Member Author

The job failure was the #4400 case in latest-two-readers-one-ask-4393.test.ts, which asked m1:23 once too often. The test is timing-dependent, not something this PR changed. It writes s, sleeps a real 3 ms, and writes again while a 10 ms ask is in flight. Under CI's coverage run that gap outlived the ask, so the ask landed before the second write. The same case failed on #4455, which doesn't touch this path, and it passes locally 6/6 on this branch.

The gaps are part of each scenario, so e10c1fc moves that file to fake timers (vi.advanceTimersByTimeAsync) rather than real sleeps. All 24 cases pass, and the it.fails pin still fails.


Generated by Claude Code

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 41052495050

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.1%

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: 1362
Covered Lines: 1125
Line Coverage: 82.6%
Relevant Branches: 1090
Covered Branches: 790
Branch Coverage: 72.48%
Branches in Coverage %: Yes
Coverage Strength: 29.75 hits per line

💛 - Coveralls

@codspeed

codspeed Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 10.46%

2 warnings

⚠️ 4 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 improved benchmark
✅ 199 untouched benchmarks
⏩ 5 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ arrow in template 11.9 ms 10.8 ms +10.46%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/project-thread-x1ore2-latest-joined-release (e10c1fc) with next (5f07d04)

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. ↩

@ryansolid
ryansolid merged commit 9c4e4a8 into next Oct 30, 2026
9 checks passed
ryansolid added a commit that referenced this pull request Oct 30, 2026
…ad; seat rows D1''/L1''/V3'' (#4472)

* fix(signals): a netted write read in a strict untrack is no staged read; seat rows D1''/L1''/V3''

#4452 made a signal's staging equal to its committed value (writes that
netted, D-8) a read of the screen in `read`'s fast block. The reader-seat
table still raised Fl on that read (rows D1 / L1 / D7, and V3 for a
verdict reader), so the shadow's seat parted from the flags and every
later read of the pass reported too ("world after the read", "verdict
seat after the read", B2 "born held"): 8 INV-seat-3 classes (x59) in the
signals suite, 7 in web, and 60 in the generator (37 / 35 / 43 at 2,000
cases x seeds 3289 / 91501 / 7, every pair). Bisected over every merge
7135a77..131ceb8: 0 before #4452 (66c6f56), 60 at it, none added by
#4453, #4458, #4460, #4454, #4457 or #4455. The runtime follows the rule
(D-8: a tick whose writes net to the committed value made no proposal),
so the table was stale: rows D1''/L1'' (D7'' in a lane) and V3'' serve P
and raise nothing. Shadow: 0 classes in signals, web and the generator.

With the rows in, the shadow found the path #4452 missed: in dev a
labelled `untrack` read (`strictRead`) takes the slow path, where `serve`
still called `stagedRead`, so dev held the errored re-run that prod (fast
block) does not. `serve` now skips it for a netted signal in dev; prod
folds the test away (0 B on every scenario).

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

* fix(signals): gate serve's netted skip on the strict read, not on dev

Only the strict untrack read skips the fast block in dev; a hydration
snapshot or a promoted write reaches serve in dev and prod alike and keeps
the staged-read mark. 0 B in prod.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants