Skip to content

Commit b296640

Browse files
refactor: structural version chain — closes the sweep/watermark finding class
Five findings at a4c439b, four in the accreted sweep machinery. Per the standing decision, redesigned rather than patched a fifth time: Emissions stamp svAt (per-kind: sv rows, svs slots); the channel tracks the VISIBLE version (svv/svvs — live-queue entry, releaseBatch for stashed items, emission for lane items); entries init av to it and apply an item only when av === svAt-1 (the item's baseline IS their last-seen state). Gaps take ONE flush-end resync after every queue. Deleted: emission-snapshot membership, PcSweep/noteSweep/sweepList/runLateSweeps, maxRq/winEnd watermarks, drainGen/dg, rq/sq stamps. Findings 1/2/4 are unaskable under the chain. Finding 3: settle loop skips staged-fold targets (single reveal notification, pinned). Finding 5: repairAncestorSlots at registration, gated to stale aliases of the SAME child resolved through the family map — the ungated first cut injected tentative rows into committed truth (all four optimistic equivalence failures, one root cause). Revert-form resyncs (cm items) resolve committed raw only — never a lingering draft, never the composing proxy. Held-window registrants improve: chain connects, real baseline-sound ops at release instead of a rebuild (pin updated). Signals 1,511 (+2 expected-fail) | web 719 | parity 153 — all green. Three ratchets (17.15/19.6/27.4): flat redesign cost, accretion stops. Co-authored-by: Cursor <[email protected]>
1 parent a4c439b commit b296640

8 files changed

Lines changed: 285 additions & 172 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+
Replace the structural channels' snapshot/watermark/sweep machinery with per-entry applied-version chains: emissions stamp a per-kind structural version, entries apply an item only on an unbroken chain from what their registration read (baseline soundness by arithmetic), and any gap takes exactly one resync at the end of the flush, after every queue. This closes the audited class wholesale — cross-window coverage errors, lane-resync-before-stale-ops ordering, and duplicate sweep deliveries have no mechanism left to be wrong in — and held-window registrants improve to receiving real baseline-sound ops. Reveals dedup to one notification (the settle loop skips staged-fold targets), revert-form resyncs resolve committed truth only, and late-mounted bindings repair their ancestor raw chain at registration (gated to stale aliases of the same child — never tentative rows).

‎packages/signals/AUDIT-BRIEF-R6.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Audit brief — rounds 6–9 + patch-mode default flip + node delivery
22

3+
## Round 10.19 (2026-09-01) — STRUCTURAL VERSION CHAIN (redesign, closes the finding class)
4+
5+
Five findings at a4c439b7 (maxRq cross-window coverage, lane-sweep-before-
6+
regular-ops, reveal emission overlap, duplicate slot sweeps, eager-repair
7+
late-mount cliff) — four of them in the sweep/watermark machinery the last
8+
three rounds accreted. Per the standing decision: the class is closed by
9+
REDESIGN, not a fifth round of point fixes.
10+
11+
- **The chain**: every structural emission stamps `svAt = ++pc.sv` (rows)
12+
or `++pc.svs` (slots — separate consumer lists, separate chains). The
13+
channel tracks the VISIBLE version (`svv`/`svvs`): bumped when items
14+
enter the live queue (commit-coincident emissions immediately, stashed
15+
ones at releaseBatch, lane emissions at emission). Entries initialize
16+
`av` to the visible version — exactly what their registration read
17+
covered — and apply an item's payload only on an unbroken chain
18+
(`av === svAt-1`, the item's baseline IS the entry's last-seen state).
19+
At-or-below `av` skips; any gap marks the entry for ONE resync at the
20+
END of the flush, after every queue. Deleted: emission snapshots as the
21+
membership authority, PcSweep/noteSweep/sweepList/runLateSweeps, the
22+
maxRq/winEnd watermarks, drainGen/dg dedup, rq/sq stamps.
23+
- Findings 1/2/4 become unaskable: no watermark to be wrong, no per-queue
24+
sweep to order, no per-item repetition to dedup. Held-window
25+
registrants IMPROVE: their chain connects, so they receive real
26+
baseline-sound ops at release instead of a rebuild (pin updated).
27+
- **Reveal overlap (finding 3)**: the settle loop skips staged-fold
28+
targets (`t.sf`) — the fold's own emission carries the reveal; pinned
29+
by a single-rebuild assertion on the reveal test.
30+
- **Late-mount cliff (finding 5)**: `repairAncestorSlots` at registration
31+
(channelTarget) fixes the registered target's ancestor chain — gated to
32+
STALE ALIASES OF THE SAME CHILD only (map-resolved): the first cut
33+
wrote tentative rows' backings into committed truth (all four
34+
optimistic equivalence failures, one root cause) — a tentative row
35+
registering mid-flight has no committed slot, and absent/different
36+
slots must never be written.
37+
- Revert-form resyncs (settle loop, cm-stamped items) resolve COMMITTED
38+
raw only — never `pb` (a draft lingering at the drain via row escape is
39+
exactly the state that died), never the composing proxy.
40+
- Size: +230/+110/+20 B (three ratchets: 17.15/19.6/27.4) — flat cost;
41+
the ~150 B/round accretion this class caused stops here.
42+
343
## Round 10.18 (2026-09-01) — fold audit (4 P1s: slots under holds, sweep ordering, reveal coverage)
444

545
Audit at b31e9929 confirmed the consecutive-landing divergence resolved by

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ function installNextBlockedHalf(): void {
113113
// Row-ops resync (family increment 2): reverts flip node values
114114
// back engine-natively; a driven list must rebuild retention by
115115
// row identity against the post-revert view (resolved from the
116-
// target at drain — overrides are gone by then).
117-
if (ot.pc !== null && ot.pc.ro !== null) rowHooks!.emitRowOpsOptimistic(ot, null, null);
116+
// target at drain — overrides are gone by then). NOT for
117+
// targets with a pending STAGED fold (fold audit P1): the
118+
// fold's own emission carries the reveal — a second rebuild
119+
// here rebuilt the same rows again and lost DOM identity/focus.
120+
if (ot.pc !== null && ot.pc.ro !== null && ot.sf !== true)
121+
rowHooks!.emitRowOpsOptimistic(ot, null, null);
118122
// Keyset resync (classic channel twin): the keyset node's own
119123
// revert can compare EQUAL (a landing's bump matched the
120124
// tentative bump) while the arrangement underneath changed —

0 commit comments

Comments
 (0)