Skip to content

refactor(signals): tier-2 state consolidations from the architecture audit - #2905

Merged
ryansolid merged 3 commits into
nextfrom
arch/tier2
Jul 18, 2026
Merged

refactor(signals): tier-2 state consolidations from the architecture audit#2905
ryansolid merged 3 commits into
nextfrom
arch/tier2

Conversation

@ryansolid

Copy link
Copy Markdown
Member

First landing from the architecture audit (the growth-forensics follow-up to #2883): three behavior-preserving state consolidations, each chosen because it makes a past bug class unrepresentable rather than just smaller.

Consolidation Δ full (min/gz) Bug class retired
Single pending-source container — _pendingSource/_pendingSources dual representation collapses to one lazily-created Set −267 / −110 the promotion invariant #2893's first bug broke ("a third overlapping source used to land beside the Set") no longer exists
Optimistic brand as CONFIG_OPTIMISTIC bit — deletes OVERRIDE_UNDEFINED and its 19 wrap/unwrap sites −123 / −26 the undefined-as-value vs undefined-as-brand collision (#2898) cannot be expressed
Ambient work is a transaction — globalQueue's parallel batch fields + initTransition's adoption/aliasing blocks collapse into one always-present batch shape −270 / −96 the alias-drift family (batch fields diverging from the adopted transaction's)

Combined: full 57,073 → 56,413 min / 21,229 → 21,008 gz; floor 18,551 → 18,013 / 7,527 → 7,357 — roughly six weeks of fix-growth reversed.

Verification

Each patch was built against a pristine copy, measured, and independently verified: byte-exact re-measurement, the full 1,052-test suite re-run through an alias config whose liveness was proven by poison-probe (inject a throw into the variant, observe 27 failures, revert), and a hunk-by-hunk review hunting for observable-behavior drift (error identity, notify ordering, companion snap timing). The pending-container change preserves NotReadyError identity by construction — the verifier proved the old dual representation was oldest-first in every reachable state, so the Set-only pick selects the same node in every scenario. The integrated branch re-runs everything green and the combined delta equals the sum of the parts.

Perf notes for review: the pending-container change allocates a Set on first pending source where the old code stored a bare reference (async-path only, never the sync hot loop); the ambient-batch change was reviewed for flush fast-path equivalence (canUseSimpleSyncFlush becomes an equivalent emptiness check on the batch object). CodSpeed on this PR is the arbiter — if it flags the flush path, the batch-object field access pattern is the first suspect.

Three further audit items (STATUS_PENDING derivation, stageValue chokepoint, re-ask single-encoding) were built and verified but measured size-neutral (+48/−1/±0 min vs audit estimates of −500/−120/−180) and are deliberately not included — they're parked as patches for opportunistic folding when those files are next touched.

🤖 Generated with Claude Code

…audit

Three behavior-preserving consolidations, each retiring a bug class:

- single pending-source container: the _pendingSource/_pendingSources
  dual representation (singular slot + lazily-promoted Set) collapses to
  one lazily-created Set; the promotion invariant #2893's first bug
  broke no longer exists. -267 min / -110 gz.
- optimistic brand as CONFIG_OPTIMISTIC bit: deletes OVERRIDE_UNDEFINED
  and 19 wrap/unwrap sites; the undefined-as-value / undefined-as-brand
  collision (#2898) is unrepresentable. -123 / -26.
- ambient work is a transaction: the globalQueue's parallel batch fields
  and initTransition's four adoption/aliasing blocks collapse into one
  always-present batch shape; flush fast-path emptiness check preserved.
  -270 / -96.

Combined: full 57,073->56,413 min / 21,229->21,008 gz; floor
18,551->18,013 / 7,527->7,357. 1,052 tests pass on the integrated
branch; each patch was independently verified (byte-exact re-measurement,
suite re-run via poison-probed alias configs, hunk-by-hunk behavior
review) before integration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1111969

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

This PR includes changesets to release 9 packages
Name Type
@solidjs/signals Patch
test-integration Patch
solid-js Patch
babel-preset-solid Patch
@solidjs/web Patch
@solidjs/html Patch
@solidjs/h Patch
@solidjs/universal Patch
@solidjs/element 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 Jul 17, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
signals: core floor (createSignal/Memo/Effect/Root/flush) 6.57 KB (-1.66% 🔽)
signals: + createStore 11.16 KB (-1.07% 🔽)
signals: + isPending/latest 8.09 KB (-1.62% 🔽)
app: render + one signal (the simple-app floor) 9.07 KB (-1.42% 🔽)
app: CSR with Show/For/Loading/Errored/lazy 11.09 KB (-1.21% 🔽)

@coveralls

coveralls commented Jul 17, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29618128245

Warning

No base build found for commit 66a6c13 on next.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 74.74%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 596
Covered Lines: 477
Line Coverage: 80.03%
Relevant Branches: 461
Covered Branches: 313
Branch Coverage: 67.9%
Branches in Coverage %: Yes
Coverage Strength: 14.28 hits per line

💛 - Coveralls

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 121 untouched benchmarks


Comparing arch/tier2 (1111969) with next (66a6c13)

Open in CodSpeed

…h mirror

CodSpeed flagged updateSignals:update1to1 at -6.8% on #2905 (reproduced
on rerun): queuePendingNode gained a property hop when the batch fields
moved behind globalQueue._batch, and it runs once per staged write.
A module-local mirror updated at the three _batch assignment sites
restores the pristine load count on the write path and commit loop; the
field stays authoritative for cross-module readers.

The merge bench regression is not yet attributed — this push doubles as
the bisection probe: if it persists, it belongs to the pending-container
or config-brand change, not the batch consolidation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodSpeed attribution (zero-diff control #2906 clean; single-patch probes
#2907/#2908/#2909): the config-brand change alone carries merge -7%
plus sub-threshold -3..4% across update1to1/propagation — it drove both
flagged regressions on this PR. The diff is load-neutral by inspection
and byte-flat in an isolated merge harness; the diffuse cross-bench
pattern indicates shared-process JIT/IC state redistribution from the
hasOverride shape change. Pulled pending a shape-stable redesign
(dedicated boolean in the node literal rather than a _config RMW).

Remaining: pending-container + ambient-txn, both CodSpeed-clean in
isolation. Full 57,073->56,550 min / 21,229->21,050 gz; floor
18,551->18,111 / 7,527->7,376. 1,052 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ryansolid
ryansolid merged commit aa39752 into next Jul 18, 2026
5 checks passed
@ryansolid
ryansolid deleted the arch/tier2 branch July 20, 2026 20:17
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.

2 participants