@zakkster/lite-signal 1.6.0-preview.1 → 1.7.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,430 @@ All notable changes to `@zakkster/lite-signal` are documented here.
4
4
  Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
  This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [Unreleased]
8
+
9
+ ### Fixed -- dangling re-tracking cursor on source disposal (crash)
10
+
11
+ Disposing a signal/computed from inside an observer that had linked it on the
12
+ previous run, but had not yet re-read it on the current run, crashed with
13
+ `TypeError: Cannot set properties of null (setting 'headSub')`. `disposeNode`'s
14
+ sub-list teardown freed the link while the observer's re-tracking cursor
15
+ (`activeObserverCurrentDep`) was still parked on it; `severTail` then walked from
16
+ a freed link, wiped the observer's `headDep`, and double-freed the link. Reachable
17
+ from the plain public API (see `COVERAGE-NOTES.md` for the repro). Fixed with a
18
+ one-line cursor repair in `disposeNode` (advance the cursor to the next surviving
19
+ dep before the free); O(1), disposal path only, no steady-state cost. Pinned by a
20
+ regression test in `test/12-coverage.test.mjs`.
21
+
22
+ This also corrects the record on `freeLink`: the `link.source !== null ? … : -1`
23
+ fallbacks were documented as "unreachable defensive code," but they were in fact
24
+ reachable -- and *only* reachable -- through this crash path. With the cursor
25
+ repaired they are genuinely dead, so they were removed (replaced by the passed
26
+ `source.id` / `target.id`, which are always live). Branch coverage on `Signal.js`
27
+ is now 100%: the two remaining unreachable arms (link-ledger clamp, `batchEpoch`
28
+ 2^32 wraparound) carry `/* c8 ignore */` with proofs. See `COVERAGE-NOTES.md`.
29
+
30
+ **Hot-path parity note:** this touches `disposeNode` and `freeLink`; re-baseline the
31
+ VersionMatrix engine sha256 on the next publish. Steady-state read/propagation
32
+ bodies are unchanged.
33
+
34
+ ### Changed -- test file numbering
35
+
36
+ `test/28-scope.test.mjs` renamed to `test/29-scope.test.mjs` to resolve the
37
+ duplicate `28-` prefix it shared with `28-run-with-owner.test.mjs`
38
+ (`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`).
39
+
40
+ ## [1.7.0-alpha.0] -- 2026-07-14
41
+
42
+ The **flush-strategy minor**, promoted from `preview` to the `alpha` dist-tag.
43
+ Two additions on top of 1.6.0-preview:
44
+
45
+ - **`flushStrategy` registry option + `r.flush()`** -- the primary 1.7 lever, a
46
+ per-registry choice of when effects auto-deliver (`"eager"` default | `"sab"` |
47
+ `"manual"`) plus an explicit `flush()` method on every registry. Resolved once at
48
+ registry init by binding to a pre-built closure reference; the "eager" inlined
49
+ body is byte-identical to 1.6's `if (batchDepth === 0) flushEffects()` so
50
+ existing users see zero behavioral or performance regression.
51
+ - **`getOwner` / `runWithOwner` port** -- carried forward from 1.5.0-beta.2 into
52
+ this line. The 1.7.0-preview `Signal.js` was branched from a pre-1.5.0-beta.2
53
+ base and the two async-gap primitives (`getOwner()` capture, `runWithOwner()`
54
+ restore) were missing. Ported unchanged: the same safe `describeNode` +
55
+ `liveNode` gen-guard machinery that landed in 1.5.0-beta.2 and carried into 1.6
56
+ is now present here too, so any consumer using the ownership escape hatch (e.g.
57
+ `lite-query`'s query-watcher across an `await`) gets the same guarantees on the
58
+ 1.7 line.
59
+
60
+ The two hot-path changes 1.6 -> 1.7 are localised to `signal` / `computed` /
61
+ `effect` / `signalBox` / `computedBox` (their `.set` sites) and `batch` (its
62
+ exit site) -- specifically the resolved-once `FLUSH_ON_IDLE_WRITE` /
63
+ `FLUSH_ON_BATCH_EXIT` booleans. **Every other hot-path body is byte-identical to 1.6.0**
64
+ (sha256-verified over `pullComputed`, `markDownstream`, `executeEffect`,
65
+ `flushEffects`, `allocateLink`, `severTail`, `createNode`, `runCleanup`,
66
+ `disposeNode`, `createRoot`, `createScope`). The two ownership primitives added
67
+ by this port only add new user-API functions -- they do not touch any of the
68
+ above; the sha256 check confirms it.
69
+
70
+ Drop-in over 1.6.0-preview. The default is unchanged.
71
+
72
+ ### Added -- `flushStrategy` registry option
73
+
74
+ Selects when effects auto-deliver, chosen once at `createRegistry` time:
75
+
76
+ - **`"eager"`** (default, byte-identical to 1.6.0): `.set` outside batch
77
+ auto-flushes; batch exit auto-flushes.
78
+ - **`"sab"`** (**stable-after-batch**, matches Reflex semantics): `.set` outside
79
+ batch enqueues effects via the existing `FLAG_SCHEDULED` dedup but does NOT
80
+ auto-flush; batch exit DOES auto-flush. This is the apples-to-apples mode for
81
+ the `js-reactivity-benchmark` `update*` group -- on shapes with observers but
82
+ no effects, the eager `flushEffects` empty-path `try/finally` was the dominant
83
+ per-write overhead.
84
+ - **`"manual"`**: neither `.set` nor batch exit auto-flush; only explicit
85
+ `r.flush()` drains the queue. For hard-real-time loops that need frame-aligned
86
+ settle points (Hueforge, Gradient Studio).
87
+
88
+ ### Added -- `r.flush()` explicit flush API
89
+
90
+ Explicit flush method on every registry. Re-entrant safe (the existing
91
+ `isFlushing` guard applies unchanged); empty queue exits immediately. The three
92
+ strategies use it as follows: `"eager"` never needs it (auto-flushes cover
93
+ everything); `"sab"` needs it if you `.set` outside batch and want the effects
94
+ to run without waiting for the next batch exit; `"manual"` needs it to run any
95
+ effects at all.
96
+
97
+ ### Added -- `getOwner` / `runWithOwner` (carried forward from 1.5.0-beta.2)
98
+
99
+ The capture-and-restore companion to `createRoot`. `getOwner()` returns the
100
+ current lifecycle owner as an opaque, gen-stamped handle (`undefined` outside
101
+ any effect/computed body); `runWithOwner(handle, fn)` runs `fn` with that owner
102
+ reinstated so effects/computeds created directly in `fn` are adopted by it (and
103
+ cascade-dispose when the owner re-runs). Nulls the tracking observer for `fn`'s
104
+ direct body -- same pairing as `createRoot`, so accidental cross-async
105
+ dependency edges cannot form.
106
+
107
+ **Handles are gen-stamped.** They use the `describeNode` + `liveNode` ABA-guard
108
+ machinery (`NODE_GEN` stamp checked against the pool slot's current gen), same as
109
+ `describe` / `nodeId` / `forEachOwned` / `ownerOf` since 1.2.1. Safe to hold
110
+ across async boundaries: if the captured owner is disposed and the pool slot is
111
+ recycled by an unrelated effect via the LIFO free list, the handle's gen no
112
+ longer matches and `runWithOwner` degrades to **rooted execution** rather than
113
+ adopting the continuation into the recycled slot's new resident. Two hazards on
114
+ the raw-pointer alternative pinned in `test/28-run-with-owner.test.mjs` and
115
+ empirically reproduced against a patched engine via
116
+ `harness/owner-hazard-repro.mjs`:
117
+
118
+ - **Recycled-slot cascade death** -- capture, dispose owner, allocate a stranger
119
+ effect that reuses the slot; a raw-pointer `runWithOwner(captured)` silently
120
+ adopts the continuation into the stranger; the stranger's next re-run
121
+ cascade-disposes it.
122
+ - **Corpse adoption = engine crash** -- capture, dispose owner but not-yet-
123
+ recycled; a raw-pointer `runWithOwner(captured, () => effect(...))` splices a
124
+ child into a disposed owner's `firstOwned`; the next disposal walk recurses
125
+ without termination (`RangeError: Maximum call stack size exceeded`). Not a
126
+ leak; a crash.
127
+
128
+ Both fail on the raw-pointer sketch; both pass on the shipped `describeNode` /
129
+ `liveNode` implementation. Verified against 1.7.0-preview's engine directly --
130
+ `harness/owner-hazard-repro.mjs ./Signal.js` reports `VERDICT: SAFE` on the
131
+ recycled-slot case (continuation runs 2 times before stranger disposal, 3
132
+ times after) and completes the corpse case without stack overflow.
133
+
134
+ Exported as registry methods AND top-level helpers bound to `defaultRegistry`,
135
+ mirroring `createRoot` and `createScope`. Top-level exports added right before
136
+ the top-level `createScope` binding for stable ordering.
137
+
138
+ ### Hot-path safety -- and the design that was tried, measured, and rejected
139
+
140
+ **The shipped mechanism is a pair of closure-captured `const` booleans**, not a
141
+ function reference:
142
+
143
+ ```js
144
+ const FLUSH_ON_IDLE_WRITE = (flushStrategy === "eager");
145
+ const FLUSH_ON_BATCH_EXIT = (flushStrategy !== "manual");
146
+ ```
147
+
148
+ They are immutable for the registry's lifetime, which gives V8's JIT the
149
+ constant-folding hook it needs: in `"eager"` mode the emitted code for `.set` is
150
+ byte-identical to 1.6.0's `if (batchDepth === 0) flushEffects()`; in
151
+ `"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && …` short-circuits on the const-false
152
+ and V8 elides the branch entirely after one tier-up. `signal()` additionally
153
+ selects between **two pre-built `.set` closures at construction time**, so the eager
154
+ body carries no extra load or branch at all. **Zero behavioural or performance
155
+ regression** for any existing user.
156
+
157
+ **The first 1.7 implementation did something else and it was slower.** It captured
158
+ a function reference (`flushAfterWrite` / `flushAfterBatch`, bound to
159
+ `eagerFlushHook | noopFlush`) and called it from `.set` / `boxSet`. V8 did **not**
160
+ inline that reference on this workload: eager-mode `.set` measured **16-65% slower
161
+ than 1.6.0** on Andrii's `updateComputations*` tests, because every write paid a
162
+ function-call indirection. A second attempt -- a single `.set` body with
163
+ `if (FLUSH_ON_IDLE_WRITE && batchDepth === 0)` -- measured **16-30% slower**, because
164
+ a closure-captured `const` boolean lives in a context slot, not as a literal in
165
+ bytecode, when the body is shared. Splitting the closure at *build* time is what
166
+ recovered parity. Both dead ends are recorded here so nobody re-derives them.
167
+
168
+ This is NOT ledger §0b #6 (per-call closure-var load of a primitive V8 can't fold).
169
+ The literals are declared `const` and never reassigned, and the hot body is selected
170
+ before the first write.
171
+
172
+ > **Known stale comment:** the file header of `Signal.js` (around line 22) still
173
+ > describes the *abandoned* function-reference design ("one of two pre-built flush
174
+ > hooks (eagerFlushHook | noopFlush)"). No such identifier exists in the code; the
175
+ > in-place comment at the `FLUSH_ON_IDLE_WRITE` declaration is the accurate one.
176
+ > The header needs a one-line correction. It is called out rather than silently
177
+ > edited because `Signal.js` is sha256-pinned across the 1.6 -> 1.7 boundary.
178
+
179
+ The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
180
+ hot path. sha256 over the extracted function bodies of `pullComputed`,
181
+ `markDownstream`, `executeEffect`, `flushEffects`, `allocateLink`, `severTail`,
182
+ `createNode`, `runCleanup`, `disposeNode`, `createRoot`, `createScope` matches
183
+ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
184
+ `createRoot` and `createScope` without disturbing either.
185
+
186
+ ### Test coverage
187
+
188
+ - **Full suite green:** **484 tests across 29 files**, 483 pass, **0 fail**, 1 skip
189
+ (only the architecturally-N/A SSR case in `17-reactivity`), 0 cancelled. Plain
190
+ `npm test` runs 476 of them -- 8 are gated on `--expose-gc` (3 in `04-zero-gc`,
191
+ 4 in `09-conformance`, 1 in `11-adopted-reactive`) and need `npm run test:gc`. The 10
192
+ previously-cancelled `25-devtools-real-boot` cases now run and pass (19/19) with
193
+ `@zakkster/lite-devtools` resolvable as a dev peer. Default-mode behaviour is
194
+ unchanged byte-for-byte from 1.6.0.
195
+ - **Coverage: `Signal.js` at 100% statements / 100% functions / 100% lines /
196
+ 99.24% branches; `Watch.js` at 100% on every metric** (`npm run test:coverage`).
197
+ Up from 97.84 / 93.40 / 97.84 / 96.22 on `preview.2`.
198
+
199
+ The four residual branch arms are **unreachable by construction**, and are listed
200
+ rather than papered over with an ignore pragma (which would have broken the
201
+ sha256 hot-path proof above for no behavioural gain):
202
+
203
+ 1-2. `freeLink`'s `link.source !== null ? … : -1` and `link.target !== null ? … : -1`
204
+ fallbacks. All three call sites pass a link taken from a live dep/sub list;
205
+ both endpoints are always non-null.
206
+ 3. The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth
207
+ ledger. `maxLinkLimit` is `maxLinks * 16` and the ledger only doubles from
208
+ `maxLinks`, so the doubling sequence lands *exactly* on the ceiling and cannot
209
+ overshoot. The ceiling itself is a real wall and is tested.
210
+ 4. The `if (batchEpoch === 0) batchEpoch = 1;` 32-bit-wraparound guard in `batch()`.
211
+ Reaching it needs 2^32 batches in one registry.
212
+
213
+ - **+16 tests in `test/28-run-with-owner.test.mjs`** (carried forward from
214
+ 1.5.0-beta.2 / 1.6.0-alpha): 7 basic-shape tests, 3 degradation tests
215
+ (`null` / `undefined` / signal-handle all fall through to rooted execution),
216
+ and 3 **hazard pins** with allocation pressure applied so the ABA guard is
217
+ actually exercised (recycled-slot cascade, corpse adoption, composed).
218
+ - **`test/03-pool` "stats() shape" test** bumped from the 11-key 1.4.0 shape to
219
+ the 12-key 1.6+ shape (adds `flushPasses`).
220
+ - **+16 tests in `test/12-coverage.test.mjs`** -- the behavioural coverage that
221
+ `preview.2` explicitly deferred is now **delivered**, and it is what closed the
222
+ gap above:
223
+ - `flushStrategy` validation (a bogus token throws at `createRegistry`; all three
224
+ valid tokens construct; an omitted config and an omitted key both default to
225
+ `"eager"`).
226
+ - All three modes end-to-end: `eager` delivers per idle write and once per batch;
227
+ `sab` defers an idle write, **dedups 1000 un-batched writes into one run**, and
228
+ drains the whole backlog at batch exit; `manual` gates *both* the idle write and
229
+ the batch exit, leaving `r.flush()` as the only settle point.
230
+ - **Lazy-pull correctness in every mode** -- a `computed` / `computedBox` read after
231
+ a deferred write returns the NEW value with no flush. The write is always eager;
232
+ only delivery defers. This is the invariant that makes `"sab"`/`"manual"` safe.
233
+ - The **entire non-eager `.set` / `boxSet` body, branch by branch**: gen guard
234
+ (a write through a stale handle is a silent no-op), `equals` short-circuit
235
+ (default and custom predicates), pre-batch revert (set-then-revert inside a batch
236
+ is a net no-op and restores `preBatchVersion`), and the real-net-change path.
237
+ - The **top-level `flush` / `getOwner` / `runWithOwner` delegators** bound to the
238
+ default registry (all three were 0% covered).
239
+ - `flush()` on an empty queue is a no-op; `flush()` is the escape hatch for an
240
+ idle-write backlog in `sab`.
241
+ - **+5 engine-edge tests in `test/12-coverage.test.mjs`** for branches no behavioural
242
+ suite reached. Two are worth recording because finding them corrected a wrong
243
+ assumption in the source comments:
244
+ - **The `allocateLink` eligibility gate (`target.flags === 0`) is NOT reachable by
245
+ plain self-dispose.** `disposeNode` already nulls `currentObserver` /
246
+ `activeObserverCurrentDep` / `isTrackingDeps` when the disposing node *is* the
247
+ current observer, so a read later in a self-disposing effect's body never reaches
248
+ `allocateLink` at all. The gate's live path is the *other* case its own comment
249
+ names: an **outer observer torn down while suspended** inside a nested pull -- a
250
+ computed whose body disposes the effect that is currently pulling it. There,
251
+ `currentObserver` is the *computed*, the effect's tracking state survives, and
252
+ `pullComputed` restores a **dead node** as the observer. The next read in the
253
+ effect's body must not splice a phantom edge into the corpse. Now pinned.
254
+ - **`executeEffect`'s `CycleError: Infinite effect loop detected.`** is likewise not
255
+ reachable through `markDownstream` (which skips any node carrying `FLAG_COMPUTING`,
256
+ so an effect writing to its own dependency is deliberately **absorbed**). It IS
257
+ reachable through a user `scheduler` that retains the cached thunk and re-invokes
258
+ it from inside the effect body. Now pinned as a `CycleError`, not a stack overflow.
259
+
260
+ ### Bench impact -- `sab` vs `eager` on the update group (sandbox VM medians, 7 samples)
261
+
262
+ `update*` group with observers-but-no-effects, apples-to-apples in `sab` mode:
263
+
264
+ | Shape (n=writes) | eager | sab | speedup |
265
+ |------------------|-------:|-------:|--------:|
266
+ | 1to1 (400k) | 14.15 | 12.04 | 1.18x |
267
+ | 1to2 (400k) | 11.68 | 10.25 | 1.14x |
268
+ | 1to4 (400k) | 11.36 | 11.01 | 1.03x |
269
+ | 1to8 (400k) | 11.47 | 10.09 | 1.14x |
270
+ | 1to1000 (4k) | 1.59 | 1.55 | 1.03x |
271
+ | 1000to1 (1k) | 0.07 | 0.03 | 2.31x |
272
+
273
+ Real wins, but smaller than the gap to Reflex on the same shapes. The residual
274
+ gap is structural (per-write `gen` check, batch-revert epoch tracking, global
275
+ version bumping) -- design decisions accepted by §0b and not in scope here.
276
+ Modern V8's `try/finally` elision varies; expect higher absolute speedups on
277
+ production V8 than on this sandbox.
278
+
279
+ ### Fixed -- `Signal.d.ts` was missing the entire 1.7.0 surface
280
+
281
+ `preview.2` shipped `flushStrategy`, `flush()`, `getOwner()` and `runWithOwner()` in
282
+ the engine and **declared none of them in the types**. Any TypeScript consumer would
283
+ have got a compile error on `createRegistry({ flushStrategy: "manual" })`, on
284
+ `r.flush()`, and on both ownership primitives. Added:
285
+
286
+ - `RegistryConfig.flushStrategy?: "eager" | "sab" | "manual"`
287
+ - `Registry.flush(): void`
288
+ - `Registry.getOwner(): OwnerHandle | undefined`
289
+ - `Registry.runWithOwner<T>(owner: OwnerHandle | null | undefined, fn: () => T): T`
290
+ - top-level `flush` / `getOwner` / `runWithOwner` bound to the default registry
291
+ - `export type OwnerHandle = NodeDescriptor` -- the gen-stamped handle, structurally
292
+ the same descriptor `describe()` returns, so it stays re-walkable through
293
+ `forEachOwned` / `ownerOf` / `nodeId`
294
+
295
+ Verified structurally: all **32** runtime exports and all **26** registry methods now
296
+ have a declaration.
297
+
298
+ ### Fixed -- documentation had `runWithOwner` marked "not yet shipped"
299
+
300
+ Both `README.md` and `llms.txt` still carried the 1.5.0-era sentence *"the re-attach
301
+ companion `runWithOwner` … is not yet shipped"* while the engine exported it. Corrected
302
+ in both, and `flushStrategy` / `flush()` -- previously mentioned nowhere outside the
303
+ harness notes -- now have a full API-reference section in the README and a Core-concepts
304
+ entry in `llms.txt`.
305
+
306
+ ### Regenerated -- every published benchmark number
307
+
308
+ `bench/results.txt`, `bench/resultsReactive.txt`, and both benchmark sections of the
309
+ README are rebuilt from the checked-in raw runs (`bench/bench-runs/`,
310
+ `bench/bench-runs-reactive/`) rather than carried forward. Two consequences worth
311
+ stating out loud:
312
+
313
+ - **The headline ranking improved.** On Andrii's 1.7.0 run (`bench/AndriiVolynetsReactiveBench1.7.0.log`,
314
+ 15 frameworks x 47 tests, checked in), lite-signal is **4th of 15 by geomean at
315
+ 71.5 ms** -- and the gap to 5th-place Preact Signals widened from ~5% to **20%**.
316
+ Outright fastest of all 15 on four tests. The `1000x5 - 25 sources` wide-dense DAG,
317
+ which was **5.7x behind** the leaders on the 1.1.2 engine Andrii first measured, is
318
+ now the **fastest result in the entire field**.
319
+ - **Two local results got worse, and are now stated plainly instead of buried.**
320
+ **DEEP CHAIN is a -73% loss to alien-signals** (172 ms vs 99 ms), not the -18% the
321
+ old (invalid) table reported -- it is the engine's largest open performance gap and
322
+ it is structural. And **DYNAMIC DAG, while +20% over alien, loses to preact-signals**
323
+ (3622 ms vs 3011 ms). The old `resultsReactive.txt` claims "fastest of all five on
324
+ every `dyn` row" and "ahead on all seven `updateComputations` rows" do not survive
325
+ the re-measurement: it is four of five `dyn` rows (solid takes `simple component`)
326
+ and two of seven update rows. Both retracted.
327
+
328
+ ### Migration
329
+
330
+ - **Every existing user**: zero work needed. The default is unchanged; every
331
+ registry created without a `flushStrategy` argument runs the same code as on
332
+ 1.6.0.
333
+ - **Bench adapters wanting apples-to-apples with Reflex-style flush semantics**:
334
+ pass `flushStrategy: "sab"` to `createRegistry` (see `liteSignal.ts` example
335
+ in the changeset).
336
+ - **Frame-aligned real-time loops**: pass `flushStrategy: "manual"` and call
337
+ `r.flush()` at the settle point.
338
+ - **Users of `createRoot` who want the capture-and-restore idiom across
339
+ async boundaries**: `getOwner()` + `runWithOwner()` are now available on
340
+ the 1.7 line (they were absent from pre-1.5.0-beta.2 branches and needed the
341
+ forward-port to reach 1.7 through the flushStrategy branch).
342
+
343
+ ### Verified
344
+
345
+ - **Full engine test suite** green: 484 total across 29 files (476 without
346
+ `--expose-gc`), 483 pass, 0 fail, 1 skip, 0 cancelled. Coverage: `Signal.js` 100/99.24/100/100
347
+ (stmts/branch/funcs/lines), `Watch.js` 100 on every metric.
348
+ - **`harness/owner-hazard-repro.mjs ./Signal.js`** reports
349
+ `VERDICT: SAFE` on the recycled-slot case AND completes the corpse case
350
+ without stack overflow -- the ABA guard degrades both hazards to rooted
351
+ execution as designed.
352
+ - **sha256 over 11 hot-path function bodies** (`pullComputed`, `markDownstream`,
353
+ `executeEffect`, `flushEffects`, `allocateLink`, `severTail`, `createNode`,
354
+ `runCleanup`, `disposeNode`, `createRoot`, `createScope`) byte-identical
355
+ between pristine 1.7.0-preview (as uploaded) and the merged-with-getOwner
356
+ engine. The port literally only adds new code between `createRoot` and
357
+ `createScope` plus updates the return object and adds two top-level exports;
358
+ zero touch on any pre-existing function.
359
+
360
+ ### Tooling -- harness wiring, and a benchmark that was measuring nothing
361
+
362
+ **`bench/benchmark.mjs` was producing invalid numbers and is fixed.** Every
363
+ lite-signal adapter in it constructed its registry with `flushStrategy: "sab"`
364
+ while driving un-batched `.set` calls. In SAB mode a `.set` outside `batch()`
365
+ *enqueues* effects but does not flush them, and the harness never called
366
+ `batch()` or `r.flush()` anywhere -- so the effect ran exactly **once** (its
367
+ creation-time run) and never again inside the timed loop. The loop was timing a
368
+ bare mark-dirty against dead-code-eliminated downstream work.
369
+
370
+ The symptom was visible in the reports and went unread: nine of eleven rows
371
+ printed `sink=[ ]` and `BENCH_SINK_SUM (anti-DCE): 0.00`. MUX reported
372
+ **22,032K ops/s** against a real **~219K** -- a ~100x fiction. Measured on the
373
+ same host: as-written `sab`-no-flush = 1 effect run, sink 0; `sab` + explicit
374
+ `r.flush()` = 20,000 runs, 191K ops/s; `eager` = 20,000 runs, 219K ops/s (which
375
+ matches the long-published ~223K MUX figure).
376
+
377
+ - The nine adapters now run **eager**, which is byte-identical to 1.6.0 and the
378
+ only mode comparable to the reference libraries -- alien-signals, preact,
379
+ vue-reactivity and solid all deliver eagerly. SAB is the right mode for
380
+ Andrii's `update*` group (observers but no effects), which is what
381
+ `harness/perf-probe.mjs` and `harness/toe-to-toe/` are for, not this harness.
382
+ - A **VALIDITY GUARD** was added: any scenario finishing with a dead sink now
383
+ prints an `INVALID RUN` block naming the offending rows and sets a non-zero
384
+ exit code. The old code computed the `sink=[x]` / `[ ]` column and then ignored
385
+ it. Silence was the bug.
386
+ - **Every number in `results.txt` and `bench/bench-runs/` predating this fix is
387
+ invalid and must be regenerated.** `bench/benchmarkReactive.mjs` is
388
+ **unaffected**: it also sets `"sab"`, but it drives every write through
389
+ `withBatch(...)`, and batch exit *does* auto-flush in SAB mode -- verified
390
+ clean against 1.7.0 (cellx vectors matched, all internal assertions pass).
391
+
392
+ **Harness wiring restored and extended.** `profile:burst` / `profile:pull`
393
+ pointed at `burst-dag.mjs` / `pull-stress.mjs` in the repo root, where neither
394
+ file has lived since 1.6; both now resolve into `harness/`. The dispatcher
395
+ (`harness/run.mjs`) gained `smoke`, `perf`, `burst`, `pull` and `toe`, and the
396
+ `harness:*` scripts plus `gate` / `prepublishOnly` (VersionMatrix) and
397
+ `test:harness` (ProfilerTools) are wired in `package.json` again. `harness:smoke`
398
+ now leads `harness:all` and `npm run verify`, because it is the only probe that
399
+ **asserts** -- a `flushStrategy` regression fails in a second instead of after
400
+ twenty minutes of timed probes.
401
+
402
+ **Scratch directories folded in.** `tmp/`, `tmp2/` and `tmp3/` are gone:
403
+
404
+ - `tmp3/toe-to-toe.mjs` + `runner.mjs` -> `harness/toe-to-toe/`. This is the
405
+ corrected cross-version sweep and it supersedes the sbench driver: it replaces
406
+ sequential ordering with round-robin (the old loop ran the newest engine last,
407
+ on the hottest chassis, which is why three sha256-**identical** propagation
408
+ bodies appeared to trend across 1.9 -> 1.11), adds a `1.6.0-sentinel` drift
409
+ column, and fixes the **silent corrupter** -- `if (mode === "sab" && engineDir
410
+ === "v17")` meant only v17 ever received `flushStrategy: "sab"`, while every
411
+ later engine was *labelled* sab and batch-wrapped but built **eager**. Its
412
+ `engines/` dir is gitignored: several snapshots are unreleased, so the sweep
413
+ script is public and the engine source is not.
414
+ - `tmp/sbench-driver.mjs` + `sbench-runner.mjs` -> `harness/attic/` (superseded).
415
+ Their output stands, though: in that sweep v17 was the only `sab` combo, so the
416
+ corrupter was accidentally correct there. Preserved as
417
+ `harness/toe-to-toe/sbench-results-1.7.0.txt`.
418
+ - `tmp2/TESTING-SAB-METHODOLOGY.md` -> `harness/`; `tmp2/sink-check.mjs` ->
419
+ `harness/attic/` (redundant -- `harness/smoke.mjs` covers eager/sab/manual and
420
+ asserts). `tmp/Signal.js` (a stale 1.7.0-WIP snapshot) and the duplicated
421
+ `CHANGELOG-1.7.0.md` / `ROADMAP` copies are dropped.
422
+ - Root loose files cleaned: `owner-hazard-repro.mjs` (a formatting-only duplicate
423
+ of the `harness/` copy) removed; `retracking.difftest.mjs` moved into
424
+ `harness/` and **fixed** -- it imported a hard-coded `./1.1.6.js` that does not
425
+ exist in this tree, so it could not run at all; it now takes
426
+ `<reference.js> [candidate.js]` on the command line.
427
+
428
+ `Signal.js` and the published `files[]` whitelist are untouched by any of the
429
+ above; installed tarballs are byte-identical.
430
+
7
431
  ## [1.6.0] -- 2026-06-26 (preview)
8
432
 
9
433
  The observability-and-lifecycle minor, shipping on the `preview` dist-tag while it
@@ -64,11 +488,52 @@ pure-owner node transparently.
64
488
  Exported as a registry method and a top-level helper bound to the default registry,
65
489
  mirroring `createRoot`.
66
490
 
491
+ ### Added -- characterization harnesses (`burst-dag.mjs`, `pull-stress.mjs`)
492
+
493
+ Two root-level standalone harnesses that exercise the new 1.6.0 instrumentation
494
+ surface against the engine's two main hot paths. Both are engine-agnostic
495
+ (`./Signal.js` + public `onGraphMutation` only), both expose a CLI + module
496
+ exports, both stay out of `npm test` and the published tarball.
497
+
498
+ **`burst-dag.mjs`** (`npm run profile:burst`, also `node --expose-gc burst-dag.mjs
499
+ [--width=512 --layers=32 ...]`) reconstructs the published
500
+ `js-reactivity-benchmark` burst shape (sources -> width x layers, fanIn 8, burst
501
+ 16) and characterizes lite-signal's own flush behavior. The standalone path uses
502
+ the new `stats().flushPasses` counter as a cross-check against the opcode-6 pass
503
+ count -- by construction they must match when the hook is attached for exactly
504
+ one burst, which the harness asserts inline. Also exports `burstDagScenario`
505
+ (for plugging into a steady-state allocation gate) and `multiPassProbe` (a
506
+ controlled two-effect write-back that forces a `passes > 1` case so the opcode
507
+ dispatch can be smoke-tested on an engine where multi-pass actually occurs).
508
+
509
+ **`pull-stress.mjs`** (`npm run profile:pull`, also `node --expose-gc
510
+ pull-stress.mjs [--maxDepth=3584 --step=512 ...]`) is the pull-path companion:
511
+ characterizes how the recursive pull scales with chain depth and binary-searches
512
+ the exact overflow point. Three answers per run: (1) the exact deepest chain
513
+ that pulls successfully (the roadmap's "~5,000 chained computeds" pinned to a
514
+ number for the current engine), (2) per-level cold cost across a depth sweep
515
+ (should be roughly linear; superlinear flags a per-node bookkeeping cost
516
+ growing with depth), and (3) cached-read cost (should be O(1) regardless of
517
+ depth via the 1.1.4 `markEpoch` short-circuit). Structure pass at a safe fixed
518
+ depth confirms the opcode triple (0 flush passes, 0 effect runs, recomputes ==
519
+ depth) -- the pull path is doing nothing it shouldn't. Also exports
520
+ `pullStressScenario` for steady-state allocation gates and `probeOverflow`
521
+ for the binary search alone. Both `--kind=callable` and `--kind=box` are
522
+ supported and surface a real engine difference (box pulls overflow earlier
523
+ because `box.get()` adds a prototype-method frame per level, and cached box
524
+ reads are several times more expensive than cached callable reads).
525
+
526
+ Both files import only `./Signal.js`, so the same harness runs against any
527
+ engine build: point `Signal.js` at 1.5.x to compare without the counters
528
+ (`burst-dag` adapts -- only opcode 5 fires on that engine -- and `pull-stress`
529
+ works identically), or at a rejected candidate to re-verify on. The numbers
530
+ they produce are reproducible, comparable, and engine-version-aware.
531
+
67
532
  ### Verified
68
533
 
69
534
  - **Full suite green** against the 1.6.0 engine: 443 tests, 442 pass, 0 fail,
70
535
  1 skip (only the architecturally-N/A SSR case in `17-reactivity`). +4
71
- `createScope` tests in `test/28-scope_test.mjs`; the 1.5.0 box and createRoot
536
+ `createScope` tests in `test/29-scope.test.mjs`; the 1.5.0 box and createRoot
72
537
  suites carry forward unchanged. **Coverage** (c8@11, Node 22): `Signal.js`
73
538
  100% statements / 96.96% branches / 100% functions / 100% lines; `Watch.js`
74
539
  100% across all four. The branch drop vs 1.5.0 (97.35% -> 96.96%) is the
@@ -153,7 +618,7 @@ dependency and updates correctly; a `computedBox` that reads a callable
153
618
  the introspection surface all apply uniformly -- a box node is indistinguishable
154
619
  from a callable node to the graph, the owner tree, and devtools.
155
620
 
156
- ### Added -- `test/24-signalbox_test.mjs` activated (9 tests)
621
+ ### Added -- `test/24-signalbox.test.mjs` activated (9 tests)
157
622
 
158
623
  The suite that was committed-but-skipped since 1.3.0 now runs against the real
159
624
  implementation: box get/set/peek/update, computedBox derive + memoize,
@@ -200,7 +665,7 @@ survives consumer re-runs.
200
665
  - **Full suite green** against the 1.5.0 engine: 439 tests, 438 pass, 0 fail,
201
666
  1 skip (only the architecturally-N/A SSR case in `17-reactivity`; the 9
202
667
  `24-signalbox` tests are now active, +6 `createRoot` tests in
203
- `test/27-create-root_test.mjs`, +3 box-coverage tests). **Coverage** (c8@11,
668
+ `test/27-create-root.test.mjs`, +3 box-coverage tests). **Coverage** (c8@11,
204
669
  Node 22): `Signal.js` 100% statements / 97.35% branches / 100% functions / 100%
205
670
  lines; `Watch.js` 100% across all four.
206
671
  - **Box hot path is zero-GC**: 200,000 writes through a 256-wide box graph,
@@ -435,7 +900,7 @@ What `createNode` still writes are the *lifetime* writes for the new resident:
435
900
  the new lifetime), plus the conditional owner-adoption splice
436
901
  (`owner`, `nextOwned`, parent chain link).
437
902
 
438
- ### Added -- `test/10-free-list-invariant_test.mjs`
903
+ ### Added -- `test/10-free-list-invariant.test.mjs`
439
904
 
440
905
  A three-test invariant suite that asserts the audit's claim by inspecting
441
906
  freshly-allocated nodes' underlying field state (via the documented
@@ -453,7 +918,7 @@ If any future change reintroduces a write to a clean-state field on the
453
918
  dispose path or removes a write that turns out NOT to be redundant, this
454
919
  suite catches it.
455
920
 
456
- ### Added -- `test/11-devtools-contract_test.mjs`
921
+ ### Added -- `test/11-devtools-contract.test.mjs`
457
922
 
458
923
  A 12-test smoke probe of the introspection surface that lite-devtools 1.1 /
459
924
  lite-studio 1.1 consume. Verifies handle resolution + walkers, owner-tree
@@ -800,7 +1265,7 @@ over 1.1.4, no breaking changes.
800
1265
  shape kept uniform (monomorphic). **Zero steady-state cost.**
801
1266
 
802
1267
  ### Test suite
803
- - Added `test/15-identity_test.mjs`: 5 tests -- ids unique + stable, `nodeId`/`describe`
1268
+ - Added `test/15-identity.test.mjs`: 5 tests -- ids unique + stable, `nodeId`/`describe`
804
1269
  undefined on non-handles, descriptor shape `{ id, kind, value }`, descriptors re-walkable,
805
1270
  identity walks non-perturbing.
806
1271
 
@@ -852,7 +1317,7 @@ All accept a public `Signal`/`Computed` handle.
852
1317
  on a non-handle argument; `observeObservers` throws `TypeError`.
853
1318
 
854
1319
  ### Test suite
855
- - Added `test/13-introspection_test.mjs`: 10 tests across 3 describe blocks --
1320
+ - Added `test/13-introspection.test.mjs`: 10 tests across 3 describe blocks --
856
1321
  `hasObservers` (live observation reflects, peek doesn't count), `observeObservers`
857
1322
  auto-pause lifecycle (start-on-first/stop-on-last, no extra connect for a 2nd
858
1323
  observer, re-observe fires again, no churn on re-track, conditional reads toggle
@@ -896,7 +1361,7 @@ allocation on whether the read will actually subscribe anything.
896
1361
  Roughly 1-2 ns per call.
897
1362
 
898
1363
  ### Test suite
899
- - Added `test/10-is-tracking_test.mjs`: 11 tests across 5 describe blocks --
1364
+ - Added `test/10-is-tracking.test.mjs`: 11 tests across 5 describe blocks --
900
1365
  observer-bodies (effect + computed), untracked windows (`untrack`, `subscribe`
901
1366
  callback, `onCleanup`, `watch` callback), outside-observer (module scope,
902
1367
  call-site of unobserved computed read), robustness (state restored after