Skip to content

test(web): async app generator — generated async apps, liveness oracle, equivalence pairs, regression gate - #4371

Merged
ryansolid merged 7 commits into
nextfrom
claude/project-thread-bgafe5
Oct 28, 2026
Merged

ryansolid merged 7 commits into
nextfrom
claude/project-thread-bgafe5

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Summary

This adds a generative test harness for async edge cases in packages/web/test/async-gen. It is test code only, so client bytes are unchanged.

It generates small apps: 1–2 signals; 0–3 sync or async memos whose dependencies are read plainly or through latest(), each async memo settled by hand by the script; and trees up to 3 deep of Loading, Errored, Show and leaf spans. Each leaf has text holes and attributes reading x(), latest(x) or isPending(x), with grouped or split effects. Memos are created either at module level or inside the root component. Each app runs under scripts of writes, actions, settling flights in any order, and flush, microtask or task steps.

The oracles need no per-case ruling:

  • Safety, after every step: nothing throws, nothing logs console.error (a halt or the loop guard), no unhandled rejection, and no hole shows undefined or NaN.
  • Liveness, at the end: once every flight has settled, the screen equals a fresh synchronous render of the final inputs.
  • Equivalence pairs (ASYNC_GEN_PAIRS): grouped vs split effects (E1), reads through an identity memo (E2), an extra inert root Errored (E2e), reads through a derived store (E3), flush after every step (E6, final screen only), and owned vs module-level memos (E7). Screens are compared at settle points.

Modes: survey tallies failures by signature, shrink reduces a case with fast-check, and minimize applies a structural minimizer that also reduces the app.

Regression gate: regression.spec.ts runs 1,500 fixed scenarios (seed 3289, about 15 s) with the web suite and compares each case's laws to baseline.json. A case that newly breaks a law fails the suite, which catches fixes that regress a neighbouring shape (as #4280→#4305 and #4307→#4342 did). A recorded failure that stops reproducing is only reported; ASYNC_GEN_UPDATE=1 records it.

The first campaigns found and minimized #4362, #4363, #4364, #4365, #4366 and #4367. The baseline currently records 20 failing cases from those shapes.

How did you test this change?

  • npx vitest run test/async-gen passes: the smoke test plus the regression gate. The gate gives the same result on 3 repeated runs.
  • The full web default suite passes: 175 files, 1,506 tests.
  • About 30,000 campaign cases ran with ASYNC_GEN=1 across seeds 3289, 91501 and 7. Each filed issue was then reproduced by hand outside the harness.
  • tsc -p tsconfig.test.json is clean.

Generated by Claude Code

… over async memos, with safety and liveness oracles

An opt-in campaign (ASYNC_GEN=1, pnpm async-gen) that generates small apps
(signals, sync and async memos with manual flights, latest()/isPending()
reads, Loading / Errored / Show / leaves with grouped or split attribute
effects) and scripts (writes, actions, settling flights in any order,
flush / microtask / task). Oracles: nothing throws or logs, no unhandled
rejection, no hole shows undefined/NaN, and once every flight has settled
the screen equals a fresh synchronous render of the final inputs. Survey,
shrink and minimize modes; the minimizer reduces the app as well as the
script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWKJDzwaZPgaGWE181b
…t Errored, store twin, flush mode, owned memos)

ASYNC_GEN_PAIRS=E1,E2,E2e,E3,E6,E7 runs each scenario a second time
rewritten without changing its meaning and compares the screens at every
settle point (after the first render, each task step and the end);
differences are grouped by what each side shows. Scenarios also choose
whether memos are created at module level or inside the root component.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWKJDzwaZPgaGWE181b
1,500 generated scenarios (seed 3289, ~15 s) run with the web suite; each
case's safety and liveness laws are compared to baseline.json. A case that
newly breaks a law fails the suite (a change broke a neighbouring shape);
a recorded failure that no longer reproduces is reported, and
ASYNC_GEN_UPDATE=1 records it. The baseline holds today's 20 failing cases
(#4362-#4367 shapes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWKJDzwaZPgaGWE181b
@ryansolid ryansolid self-assigned this Oct 28, 2026
@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c2a2118

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions

github-actions Bot commented Oct 28, 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.41 KB 0 B 0 B −166 B 7.44 KB ✅
signals: + createStore 14.92 KB 0 B 0 B −1433 B 15.04 KB ✅
signals: + isPending/latest 10.38 KB 0 B 0 B −141 B 10.38 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.04 KB 0 B 0 B −170 B 8.05 KB ✅
app: render + one signal (the simple-app floor) 9.77 KB 0 B 0 B −226 B 9.75 KB ⚠️ over by 19 B, 246 B minified headroom
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.64 KB 0 B 0 B −246 B 18.49 KB ⚠️ over by 149 B, 266 B minified headroom lazy-page.js 0.04 KB
app: hydrating + every store primitive family 31.72 KB 0 B 0 B 0 B 31.80 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.41 KB 0 B 0 B −258 B 13.40 KB ⚠️ over by 14 B, 278 B minified headroom lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.13 KB 0 B 0 B −266 B 15.14 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 29.68 KB 0 B 0 B −265 B 29.70 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.93 KB 0 B 0 B −225 B 9.93 KB ⚠️ over by 3 B, 245 B minified headroom
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.22 KB 0 B 0 B −613 B 26.27 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.31 KB 0 B 0 B −543 B 32.25 KB ⚠️ over by 63 B, 563 B minified headroom stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.75 KB 0 B 0 B 0 B 11.76 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.57 KB 0 B 0 B −184 B 33.37 KB ⚠️ over by 199 B, 204 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 8.98 KB, wire.js 3.47 KB
page: live server components (base + live/GET + action + isPending/latest) 37.98 KB 0 B 0 B −84 B 37.75 KB ⚠️ over by 228 B, 104 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.01 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.55 KB 0 B 0 B −173 B 35.43 KB ⚠️ over by 122 B, 193 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 8.96 KB, wire.js 3.47 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 41.87 KB 0 B 0 B −40 B 41.56 KB ⚠️ over by 310 B, 60 B minified headroom eager (counted): web.js 22.37 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.03 KB, wire.js 3.47 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.00 KB 0 B 0 B −184 B 40.81 KB ⚠️ over by 188 B, 204 B minified headroom 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.59 KB, trace.js 8.98 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 47.40 KB 0 B 0 B −62 B 47.16 KB ⚠️ over by 238 B, 82 B minified headroom eager (counted): client.js 27.45 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 −69 B 1.34 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: render + one signal (the simple-app floor): over brotli cap by 19 B; minified 26,803 B vs 27,029 B recorded with the cap (−226 B) — 246 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: hydrating (no stores) with Show/For/Loading/Errored/lazy: over brotli cap by 149 B; minified 53,374 B vs 53,620 B recorded with the cap (−246 B) — 266 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: CSR with Show/For/Loading/Errored/lazy: over brotli cap by 14 B; minified 36,949 B vs 37,207 B recorded with the cap (−258 B) — 278 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: compiled floor (one template, one text hole, one delegated click): over brotli cap by 3 B; minified 27,335 B vs 27,560 B recorded with the cap (−225 B) — 245 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable): over brotli cap by 63 B; minified 100,501 B vs 101,044 B recorded with the cap (−543 B) — 563 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 199 B; minified 101,375 B vs 101,559 B recorded with the cap (−184 B) — 204 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • page: live server components (base + live/GET + action + isPending/latest): over brotli cap by 228 B; minified 115,133 B vs 115,217 B recorded with the cap (−84 B) — 104 B of the 20 B minified allowance left; +0 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 122 B; minified 107,745 B vs 107,918 B recorded with the cap (−173 B) — 193 B of the 20 B minified allowance left; +0 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 310 B; minified 123,176 B vs 123,216 B recorded with the cap (−40 B) — 60 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate): over brotli cap by 188 B; minified 125,203 B vs 125,387 B recorded with the cap (−184 B) — 204 B of the 20 B minified allowance left; +0 B minified over this PR's base
  • page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate): over brotli cap by 238 B; minified 140,418 B vs 140,480 B recorded with the cap (−62 B) — 82 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).

@coveralls

coveralls commented Oct 28, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 40734544338

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

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: 1352
Covered Lines: 1122
Line Coverage: 82.99%
Relevant Branches: 1079
Covered Branches: 790
Branch Coverage: 73.22%
Branches in Coverage %: Yes
Coverage Strength: 28.94 hits per line

💛 - Coveralls

Each generated scenario is emitted as a TSX module, rendered through
renderToStream (server half), then hydrated chunk by chunk (client half).
Oracles: no refetch of a read memo before the first write, no
console.error or hydration warning, hydrated screen equals a fresh CSR
render, then the scenario's steps and final liveness. Opt-in via
ASYNC_GEN_HY=1 (pnpm async-gen:hydrate); minimize-hydration.mts reduces a
failing case through both halves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWKJDzwaZPgaGWE181b
ASYNC_GEN_RECORD on a reference build writes every case's screens, final
screen and broken laws; ASYNC_GEN_DIFF on a candidate build replays the
same seed and fails on any difference. Both the client campaign and the
hydration campaign take it: the gate for the reader-seat carve. Same-build
record/diff is clean (client 500 cases, hydration 300).

minimize-hydration.mts loads minimize.ts through a computed specifier so
tsc (no allowImportingTsExtensions) accepts it; runCase's return type
names screens/final.

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

codspeed Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 8.72%

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

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 197 untouched benchmarks
⏩ 5 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ memo + sync render effect only (reference) 31.1 ms 28.6 ms +8.72%

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-bgafe5 (c2a2118) with next (5f60713)

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

E8 re-creates the tree's readers in the flush that applies each write and
compares screens where nothing is in flight; E9 reads each latest(x) the
tree makes through a memo of it. Both from the carve audit's seat pairs.
First run (1,000 cases): #4377, #4378.

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

ryansolid commented Oct 28, 2026 •

Copy link
Copy Markdown
Member Author

CodSpeed Performance Analysis is red on two commits, with a different benchmark each time:

  • 615f51f: props chain depth 1 › build (packages/signals/tests/store/props-chain.bench.ts) is 5.5% slower.
  • ba6b4cc: mount 4000 rows › memo + sync render effect only (reference) (packages/signals/tests/mount-rows.bench.ts) is 10% slower.

These failures are not caused by this PR. It only adds files under packages/web/test/ and one package.json script, so none of the benchmarked signals code changes, and the client bundle sizes are unchanged (0 B). On both runs, CodSpeed's own warning says base and head ran on different runner types. Benchmarks in this repo have swung like this for that reason before, and here a different benchmark moves on each commit. No fix is needed here. I don't have the means to re-run the check, so I'll keep watching the PR.


Generated by Claude Code

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