@zakkster/lite-signal 1.8.0-experimental → 1.8.0-experimental.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 ADDED
@@ -0,0 +1,1532 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@zakkster/lite-signal` are documented here.
4
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+ This project follows [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [1.8.0-preview] -- 2026-07-XX
8
+
9
+ The **effect cleanup return** minor -- Reflex-study pattern A. One additive
10
+ hot-path change: an effect body may now `return` a cleanup function, which
11
+ runs before the next re-run and on dispose, composing with imperative
12
+ `onCleanup(fn)` in call order. Plus the recurring **`getOwner` /
13
+ `runWithOwner` forward-port from 1.5.0-beta.2** -- the 1.8.0-preview
14
+ `Signal.js` was branched from the same pre-1.5.0-beta.2 base as 1.7.0-preview
15
+ and 1.6.0-alpha, so the two async-gap ownership primitives are re-added
16
+ unchanged on this line.
17
+
18
+ The 1.7.0 flushStrategy scaffolding (`"eager"` | `"sab"` | `"manual"` + explicit
19
+ `r.flush()`) carries forward unchanged, as does every 1.5-era API surface
20
+ (`signalBox` / `computedBox` / `createRoot` / `createScope`) and every
21
+ propagation-core primitive. **Only `executeEffect` legitimately changed** from
22
+ 1.7.0-preview; sha256 over the 15 other function bodies is byte-identical
23
+ between pristine 1.7.0-preview and pristine 1.8.0 (verified: `pullComputed`,
24
+ `markDownstream`, `flushEffects`, `allocateLink`, `severTail`, `createNode`,
25
+ `runCleanup`, `disposeNode`, `createRoot`, `createScope`, `flush`, `batch`,
26
+ `signal`, `computed`, `effect`).
27
+
28
+ Drop-in over 1.7.0-preview. The default is unchanged; effects that do not
29
+ return a function are unaffected (one `typeof` check per effect run, off the
30
+ mark/pull path).
31
+
32
+ ### Added -- effect cleanup return (Reflex pattern A)
33
+
34
+ ```javascript
35
+ effect(() => {
36
+ const timer = setInterval(tick, 16);
37
+ return () => clearInterval(timer); // <-- ran before next re-run, and on dispose
38
+ });
39
+ ```
40
+
41
+ Solid/Vue/Reflex-compatible: an effect body may **return a cleanup function**.
42
+ It runs before the next re-run and on the effect's disposal, appended to any
43
+ imperative `onCleanup(fn)` registered inside the same body with the same append
44
+ semantics (single fn -> pair array -> push), so the two registration styles
45
+ **compose in call order**. Non-function returns are ignored. A self-disposed
46
+ body (one that generation-advances mid-execution) registers nothing -- the
47
+ slot may already host a new resident by the time the return is inspected, so
48
+ the guard is `node.gen === savedGen` before touching `node.cleanupFn`.
49
+
50
+ **Computeds are untouched.** A computed returning a function keeps treating
51
+ that function as the *value*. The cleanup-return check is inside
52
+ `executeEffect` and gated on the effect body's return type; the computed pull
53
+ path has no analogous inspection.
54
+
55
+ **Cost.** One `typeof` per effect run, entirely off the mark/pull path.
56
+ `executeEffect`'s sha256 is the only 1.7 -> 1.8 body change; every other
57
+ propagation function is byte-identical (see Hot-path safety below).
58
+
59
+ ### Added -- `getOwner` / `runWithOwner` (carried forward from 1.5.0-beta.2)
60
+
61
+ The capture-and-restore companion to `createRoot`. `getOwner()` returns the
62
+ current lifecycle owner as an opaque, gen-stamped handle (`undefined` outside
63
+ any effect/computed body); `runWithOwner(handle, fn)` runs `fn` with that
64
+ owner reinstated so effects/computeds created directly in `fn` are adopted by
65
+ it (and cascade-dispose when the owner re-runs). Nulls the tracking observer
66
+ for `fn`'s direct body -- same pairing as `createRoot`, so accidental
67
+ cross-async dependency edges cannot form.
68
+
69
+ **Handles are gen-stamped.** They use the `describeNode` + `liveNode`
70
+ ABA-guard machinery (`NODE_GEN` stamp checked against the pool slot's current
71
+ gen), same as `describe` / `nodeId` / `forEachOwned` / `ownerOf` since 1.2.1.
72
+ Safe to hold across async boundaries: stale handles (owner disposed, slot
73
+ recycled by an unrelated effect via the LIFO free list) degrade to **rooted
74
+ execution** rather than adopting the continuation into the recycled slot's new
75
+ resident. Two hazards on the raw-pointer alternative are empirically
76
+ reproduced by `harness/owner-hazard-repro.mjs`:
77
+
78
+ - **Recycled-slot cascade death** -- capture, dispose owner, allocate a
79
+ stranger effect that reuses the slot; a raw-pointer
80
+ `runWithOwner(captured)` silently adopts the continuation into the
81
+ stranger; the stranger's next re-run cascade-disposes it.
82
+ - **Corpse adoption = engine crash** -- capture, dispose owner but
83
+ not-yet-recycled; a raw-pointer `runWithOwner(captured, () => effect(...))`
84
+ splices a child into a disposed owner's `firstOwned`; the next disposal
85
+ walk recurses without termination (`RangeError: Maximum call stack size
86
+ exceeded`). Not a leak; a crash.
87
+
88
+ Both fail on the raw-pointer sketch; both pass on the shipped `describeNode` /
89
+ `liveNode` implementation. Verified against 1.8.0-preview's engine directly:
90
+ `harness/owner-hazard-repro.mjs ./Signal.js` reports `VERDICT: SAFE` on
91
+ the recycled-slot case (continuation runs 2 times before stranger disposal, 3
92
+ times after) and completes the corpse case without stack overflow.
93
+
94
+ Exported as registry methods AND top-level helpers bound to `defaultRegistry`,
95
+ inserted between `createRoot`'s top-level binding and `createScope`'s for
96
+ stable ordering. No hot path touched; sha256 over the 15 other function
97
+ bodies matches pristine 1.8.0-preview byte-for-byte.
98
+
99
+ ### Rejected during this cycle (ledger #13)
100
+
101
+ The **"lean node shape" batch-revert side stack** (Reflex pattern C). Moving
102
+ the on-node `{preBatchValue, preBatchVersion, revertEpoch}` triple into a
103
+ registry-level capture stack -- both a parallel-arrays variant AND an
104
+ interleaved stride-3 variant -- held the full behavioral contract (**439/439
105
+ internal tests, conformance clean**) and was VersionMatrix-neutral, but
106
+ regressed capture-dense batched writes **+5-9%** and revert-heavy batches
107
+ **+20%** in cold-process A/B (n=3, consistent).
108
+
109
+ Family (c) loses in **both** directions: these fields are not cold. The first
110
+ batched write is a hot edge (every batch that mutates a signal touches
111
+ `preBatchValue` on the way in), and the on-node triple **already rides
112
+ `node.value`'s cache line** -- no side structure can beat sitting inside the
113
+ line that's about to be loaded anyway. The build is archived under
114
+ `engines/rejected/1_8_0-sidestack.js` with its probe for future reference.
115
+
116
+ ### Also measured this cycle (not a 1.8.0 engine property)
117
+
118
+ The **recursive-pull depth plateau is V8-scope-shape-sensitive**. Adding ANY
119
+ context slots to `createRegistry` -- **four dummy consts suffice** -- drops
120
+ the cold-pull overflow point from ~4096 to ~2559 on Node 22 by parking the
121
+ probe on interpreted-size frames. Ceiling scales linearly with
122
+ `--stack-size` on every build. Public claims quoting `~4k depth` should be
123
+ tightened to **"plateau-dependent, 2.5k-4k, tunable"** because the exact
124
+ ceiling is a V8 frame-layout artifact, not an engine constant. Nothing in
125
+ this release changed the pull path; the sensitivity was there in 1.7 too and
126
+ is documented here for the record. `pull-stress.mjs` (1.6+) will pin the
127
+ exact number on any given build.
128
+
129
+ ### Hot-path safety
130
+
131
+ **Only `executeEffect` legitimately changed** from 1.7.0-preview -- the
132
+ cleanup-return check is an extra `typeof` + a small append. sha256 over the
133
+ 15 other propagation-relevant function bodies (`pullComputed`,
134
+ `markDownstream`, `flushEffects`, `allocateLink`, `severTail`, `createNode`,
135
+ `runCleanup`, `disposeNode`, `createRoot`, `createScope`, `flush`, `batch`,
136
+ `signal`, `computed`, `effect`) matches pristine 1.7.0-preview byte-for-byte.
137
+
138
+ The `getOwner` / `runWithOwner` port only adds new user-API functions between
139
+ `createRoot` and `createScope` -- verified via sha256 that no pre-existing
140
+ function was disturbed by the insertion. Nothing in the propagation core,
141
+ scheduler, or pool moved.
142
+
143
+ ### Test coverage
144
+
145
+ - **Full suite green** on 1.8.0-preview with the getOwner/runWithOwner port
146
+ merged in: **451 total**, 440 pass, 0 fail, 1 skip (only the
147
+ architecturally-N/A SSR case in `17-reactivity`), 10 cancelled (the
148
+ `25-devtools-real-boot` cases that need `@zakkster/lite-devtools` installed
149
+ as a peer -- pre-existing, unrelated). Default-mode behavior for effects
150
+ that do not return a function is unchanged from 1.7.0-preview byte-for-byte.
151
+ - **+16 tests in `test/28-run-with-owner.test.mjs`** carried forward from
152
+ 1.5.0-beta.2 (basic shape, degradation, and the three hazard pins with
153
+ allocation pressure applied).
154
+ - **`test/03-pool` "stats() shape"** carries the 12-key 1.6+ shape assertion
155
+ forward (`flushPasses` present).
156
+ - **New behavioral coverage to add** for effect cleanup return (deferred to
157
+ `1.8.0-preview.1`): fires before next re-run, fires on dispose,
158
+ composition with `onCleanup(fn)` respects call order, non-function returns
159
+ ignored, self-disposed body registers no cleanup, computed returning a
160
+ function still treats it as the VALUE (regression pin), cleanup exceptions
161
+ do not stop the effect from re-running (or do -- design decision either way
162
+ needs a test).
163
+
164
+ ### Verified
165
+
166
+ - **Full engine test suite** green on the merged engine (451 total, 440 pass,
167
+ 0 fail, 1 skip, 10 cancelled).
168
+ - **`harness/owner-hazard-repro.mjs ./Signal.js`** reports `VERDICT:
169
+ SAFE` on the recycled-slot case AND completes the corpse case without stack
170
+ overflow -- the ABA guard degrades both hazards to rooted execution as
171
+ designed.
172
+ - **sha256 over 15 pre-existing function bodies** byte-identical between
173
+ pristine 1.8.0-preview and my merged-with-getOwner engine (port added new
174
+ code only). **`executeEffect` sha256** matches between pristine 1.8.0 and
175
+ my merged file too -- the cleanup-return addition survives the port
176
+ unchanged; my port did not touch that function.
177
+ - **`executeEffect` sha256 vs 1.7.0-preview**: `26613285331deaed` ->
178
+ `4487beb9d15f80c6`. Legitimate change; the sole 1.7 -> 1.8 hot-path
179
+ modification.
180
+ - **`markDownstream` / `flushEffects` sha256**: unchanged from 1.7.0-preview
181
+ (still `ad7a007ec23260fc` / `a25b36ba097fdf1a`), which in turn track back
182
+ to 1.6.0-alpha's opcode 6/7 additions. The 1.8 minor introduces no new
183
+ hook-gate branches.
184
+
185
+ ### Migration
186
+
187
+ - **Every existing user**: zero work needed. Effects that don't return a
188
+ function are unaffected. `flushStrategy` default remains `"eager"` (1.7's
189
+ byte-identical mode).
190
+ - **Effects that already return a value (e.g. a state update)**: only
191
+ function returns are treated as cleanups. If an effect happens to return a
192
+ function today (rare, but possible), it will now be registered as a
193
+ cleanup. Audit before upgrading if this is your codebase's pattern.
194
+ - **Users of `createRoot` who want capture-and-restore across async
195
+ boundaries**: `getOwner()` + `runWithOwner()` are now on the 1.8 line
196
+ (same signatures and semantics as 1.5.0-beta.2 / 1.6.0-alpha /
197
+ 1.7.0-preview).
198
+
199
+ ### Tooling, types, and docs
200
+
201
+ - **`Signal.d.ts` now types the cleanup return.** It declared
202
+ `effect(fn: () => void, ...)`, so the headline 1.8.0 feature did not
203
+ typecheck for TypeScript consumers at all -- and `Signal.d.ts` ships in
204
+ `files[]`. Added `EffectCleanup` and `EffectBody` (`() => void |
205
+ EffectCleanup`) and widened both `effect()` signatures (the `Registry`
206
+ method and the top-level export). Verified with `tsc --strict`: returning a
207
+ cleanup typechecks, plain `void` bodies still typecheck (no regression), and
208
+ a computed returning a function still yields the function as its **value**.
209
+ - **Interim behavioral coverage for the cleanup return.** The Test-coverage
210
+ note above defers this feature's tests to a later preview, which left the
211
+ flagship 1.8.0 change shipping unpinned. `harness/smoke.mjs` (which
212
+ **asserts**, and runs first in `harness:all` and `npm run verify`) now
213
+ carries T6-T9: the cleanup fires before the next re-run *and* on dispose; it
214
+ composes with `onCleanup` in call order; non-function returns
215
+ (number/string/null/object/undefined) are ignored without throwing; and a
216
+ computed returning a function still treats it as the VALUE. These are a
217
+ regression pin, not a substitute for the full `test/` cases.
218
+ - **VersionMatrix manifest fixed and moved.** An updated manifest sat at the
219
+ repo root, where the gate never reads it -- `pre-publish.mjs` spawns
220
+ `matrix.sh` with `cwd: harness/VersionMatrix`, and `matrix.sh` `cd`s to its
221
+ own directory, so `./manifest.json` always resolves inside `VersionMatrix/`.
222
+ The gate was therefore still running against the stale `floor: 1.3.0` /
223
+ `rolling: 1.5.0-alpha.1` baselines. Its intent (move the baselines forward)
224
+ is now applied in the file the gate actually reads -- **but not with the
225
+ labels it proposed**: `floor: "1.5.0"` and `rolling: "1.7.0-eager"` are not
226
+ npm-installable (no plain `1.5.0` was ever published, and `1.7.0-eager` is a
227
+ toe-to-toe column label, not a version). `matrix.sh` `swap`s floor/rolling in
228
+ from the registry, so those would have failed before measuring anything.
229
+ Now: `floor: "1.3.0"` (the current `latest` stable anchor) and
230
+ `rolling: "1.7.0-preview.2"` (the `preview` tag -- this candidate's true
231
+ predecessor), with a `_notes` line recording the npm-installable constraint.
232
+ - **The `~5,000 chained computeds` depth claim is retired** from README and
233
+ `llms.txt`, per the "Also measured" finding above. The recursive-pull ceiling
234
+ is a **plateau, not a constant**: 4096 on 1.8.0 at Node 22's default stack
235
+ (overflow at 4097), V8-scope-shape-sensitive, and linear in `--stack-size`
236
+ (measured: `--stack-size=4000` lifts the same engine to 16384). The docs now
237
+ say **plateau-dependent, 2.5k-4k on a default stack, tunable**, and point at
238
+ `npm run profile:pull` to pin it per build.
239
+
240
+ ## [1.7.0-preview] -- 2026-07-XX
241
+
242
+ The **flush-strategy minor**, shipping on the `preview` dist-tag while it settles.
243
+ Two additions on top of 1.6.0-preview:
244
+
245
+ - **`flushStrategy` registry option + `r.flush()`** -- the primary 1.7 lever, a
246
+ per-registry choice of when effects auto-deliver (`"eager"` default | `"sab"` |
247
+ `"manual"`) plus an explicit `flush()` method on every registry. Resolved once at
248
+ registry init by binding to a pre-built closure reference; the "eager" inlined
249
+ body is byte-identical to 1.6's `if (batchDepth === 0) flushEffects()` so
250
+ existing users see zero behavioral or performance regression.
251
+ - **`getOwner` / `runWithOwner` port** -- carried forward from 1.5.0-beta.2 into
252
+ this line. The 1.7.0-preview `Signal.js` was branched from a pre-1.5.0-beta.2
253
+ base and the two async-gap primitives (`getOwner()` capture, `runWithOwner()`
254
+ restore) were missing. Ported unchanged: the same safe `describeNode` +
255
+ `liveNode` gen-guard machinery that landed in 1.5.0-beta.2 and carried into 1.6
256
+ is now present here too, so any consumer using the ownership escape hatch (e.g.
257
+ `lite-query`'s query-watcher across an `await`) gets the same guarantees on the
258
+ 1.7 line.
259
+
260
+ The two hot-path changes 1.6 -> 1.7 are localised to `signal` / `computed` /
261
+ `effect` / `signalBox` / `computedBox` (their `.set` sites) and `batch` (their
262
+ exit sites) -- specifically the resolved-once binding to `flushAfterWrite` /
263
+ `flushAfterBatch`. **Every other hot-path body is byte-identical to 1.6.0**
264
+ (sha256-verified over `pullComputed`, `markDownstream`, `executeEffect`,
265
+ `flushEffects`, `allocateLink`, `severTail`, `createNode`, `runCleanup`,
266
+ `disposeNode`, `createRoot`, `createScope`). The two ownership primitives added
267
+ by this port only add new user-API functions -- they do not touch any of the
268
+ above; the sha256 check confirms it.
269
+
270
+ Drop-in over 1.6.0-preview. The default is unchanged.
271
+
272
+ ### Added -- `flushStrategy` registry option
273
+
274
+ Selects when effects auto-deliver, chosen once at `createRegistry` time:
275
+
276
+ - **`"eager"`** (default, byte-identical to 1.6.0): `.set` outside batch
277
+ auto-flushes; batch exit auto-flushes.
278
+ - **`"sab"`** (**stable-after-batch**, matches Reflex semantics): `.set` outside
279
+ batch enqueues effects via the existing `FLAG_SCHEDULED` dedup but does NOT
280
+ auto-flush; batch exit DOES auto-flush. This is the apples-to-apples mode for
281
+ the `js-reactivity-benchmark` `update*` group -- on shapes with observers but
282
+ no effects, the eager `flushEffects` empty-path `try/finally` was the dominant
283
+ per-write overhead.
284
+ - **`"manual"`**: neither `.set` nor batch exit auto-flush; only explicit
285
+ `r.flush()` drains the queue. For hard-real-time loops that need frame-aligned
286
+ settle points (Hueforge, Gradient Studio).
287
+
288
+ ### Added -- `r.flush()` explicit flush API
289
+
290
+ Explicit flush method on every registry. Re-entrant safe (the existing
291
+ `isFlushing` guard applies unchanged); empty queue exits immediately. The three
292
+ strategies use it as follows: `"eager"` never needs it (auto-flushes cover
293
+ everything); `"sab"` needs it if you `.set` outside batch and want the effects
294
+ to run without waiting for the next batch exit; `"manual"` needs it to run any
295
+ effects at all.
296
+
297
+ ### Added -- `getOwner` / `runWithOwner` (carried forward from 1.5.0-beta.2)
298
+
299
+ The capture-and-restore companion to `createRoot`. `getOwner()` returns the
300
+ current lifecycle owner as an opaque, gen-stamped handle (`undefined` outside
301
+ any effect/computed body); `runWithOwner(handle, fn)` runs `fn` with that owner
302
+ reinstated so effects/computeds created directly in `fn` are adopted by it (and
303
+ cascade-dispose when the owner re-runs). Nulls the tracking observer for `fn`'s
304
+ direct body -- same pairing as `createRoot`, so accidental cross-async
305
+ dependency edges cannot form.
306
+
307
+ **Handles are gen-stamped.** They use the `describeNode` + `liveNode` ABA-guard
308
+ machinery (`NODE_GEN` stamp checked against the pool slot's current gen), same as
309
+ `describe` / `nodeId` / `forEachOwned` / `ownerOf` since 1.2.1. Safe to hold
310
+ across async boundaries: if the captured owner is disposed and the pool slot is
311
+ recycled by an unrelated effect via the LIFO free list, the handle's gen no
312
+ longer matches and `runWithOwner` degrades to **rooted execution** rather than
313
+ adopting the continuation into the recycled slot's new resident. Two hazards on
314
+ the raw-pointer alternative pinned in `test/28-run-with-owner.test.mjs` and
315
+ empirically reproduced against a patched engine via
316
+ `harness/owner-hazard-repro.mjs`:
317
+
318
+ - **Recycled-slot cascade death** -- capture, dispose owner, allocate a stranger
319
+ effect that reuses the slot; a raw-pointer `runWithOwner(captured)` silently
320
+ adopts the continuation into the stranger; the stranger's next re-run
321
+ cascade-disposes it.
322
+ - **Corpse adoption = engine crash** -- capture, dispose owner but not-yet-
323
+ recycled; a raw-pointer `runWithOwner(captured, () => effect(...))` splices a
324
+ child into a disposed owner's `firstOwned`; the next disposal walk recurses
325
+ without termination (`RangeError: Maximum call stack size exceeded`). Not a
326
+ leak; a crash.
327
+
328
+ Both fail on the raw-pointer sketch; both pass on the shipped `describeNode` /
329
+ `liveNode` implementation. Verified against 1.7.0-preview's engine directly --
330
+ `harness/owner-hazard-repro.mjs ./Signal.js` reports `VERDICT: SAFE` on the
331
+ recycled-slot case (continuation runs 2 times before stranger disposal, 3
332
+ times after) and completes the corpse case without stack overflow.
333
+
334
+ Exported as registry methods AND top-level helpers bound to `defaultRegistry`,
335
+ mirroring `createRoot` and `createScope`. Top-level exports added right before
336
+ the top-level `createScope` binding for stable ordering.
337
+
338
+ ### Hot-path safety
339
+
340
+ The `flushStrategy` lever is resolved ONCE at registry init by binding
341
+ `flushAfterWrite` and `flushAfterBatch` to one of two pre-built closure
342
+ references (`eagerFlushHook | noopFlush`). Every `.set` / `boxSet` / `batch`
343
+ call site captures a constant function reference for its lifetime; V8 sees
344
+ monomorphic targets and inlines the body. In "eager" mode the inlined body is
345
+ byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
346
+ -- **zero behavioral or performance regression** for any existing user.
347
+
348
+ This is NOT ledger §0b #6 (per-call closure-var load of a primitive). It is a
349
+ hoisted function reference resolved once at registry build time and is a NEW
350
+ mechanism by the v1 roadmap §0b line 100 definition.
351
+
352
+ The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
353
+ hot path. sha256 over the extracted function bodies of `pullComputed`,
354
+ `markDownstream`, `executeEffect`, `flushEffects`, `allocateLink`, `severTail`,
355
+ `createNode`, `runCleanup`, `disposeNode`, `createRoot`, `createScope` matches
356
+ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
357
+ `createRoot` and `createScope` without disturbing either.
358
+
359
+ ### Test coverage
360
+
361
+ - **Full suite green** on 1.7.0-preview with the getOwner/runWithOwner port
362
+ merged in: **451 total**, 440 pass, 0 fail, 1 skip (only the
363
+ architecturally-N/A SSR case in `17-reactivity`), 10 cancelled (the
364
+ `25-devtools-real-boot` cases that need `@zakkster/lite-devtools` installed as
365
+ a peer -- pre-existing, unrelated). Default-mode behavior is unchanged
366
+ byte-for-byte from 1.6.0.
367
+ - **+16 tests in `test/28-run-with-owner.test.mjs`** (carried forward from
368
+ 1.5.0-beta.2 / 1.6.0-alpha): 7 basic-shape tests, 3 degradation tests
369
+ (`null` / `undefined` / signal-handle all fall through to rooted execution),
370
+ and 3 **hazard pins** with allocation pressure applied so the ABA guard is
371
+ actually exercised (recycled-slot cascade, corpse adoption, composed).
372
+ - **`test/03-pool` "stats() shape" test** bumped from the 11-key 1.4.0 shape to
373
+ the 12-key 1.6+ shape (adds `flushPasses`). This was flagged already in the
374
+ 1.6.0 line; the 1.7 line inherits it.
375
+ - **New behavioral coverage to add** (per the drafted 1.7 notes, deferred to
376
+ 1.7.0-preview.1): `sab` batch-exit flush, `sab` dedup across many writes,
377
+ `manual` flush gating, lazy-pull correctness across all three modes, invalid
378
+ `flushStrategy` validation.
379
+
380
+ ### Bench impact (sandbox VM medians, 7 samples)
381
+
382
+ `update*` group with observers-but-no-effects, apples-to-apples in `sab` mode:
383
+
384
+ | Shape (n=writes) | eager | sab | speedup |
385
+ |------------------|-------:|-------:|--------:|
386
+ | 1to1 (400k) | 14.15 | 12.04 | 1.18x |
387
+ | 1to2 (400k) | 11.68 | 10.25 | 1.14x |
388
+ | 1to4 (400k) | 11.36 | 11.01 | 1.03x |
389
+ | 1to8 (400k) | 11.47 | 10.09 | 1.14x |
390
+ | 1to1000 (4k) | 1.59 | 1.55 | 1.03x |
391
+ | 1000to1 (1k) | 0.07 | 0.03 | 2.31x |
392
+
393
+ Real wins, but smaller than the gap to Reflex on the same shapes. The residual
394
+ gap is structural (per-write `gen` check, batch-revert epoch tracking, global
395
+ version bumping) -- design decisions accepted by §0b and not in scope here.
396
+ Modern V8's `try/finally` elision varies; expect higher absolute speedups on
397
+ production V8 than on this sandbox.
398
+
399
+ ### Migration
400
+
401
+ - **Every existing user**: zero work needed. The default is unchanged; every
402
+ registry created without a `flushStrategy` argument runs the same code as on
403
+ 1.6.0.
404
+ - **Bench adapters wanting apples-to-apples with Reflex-style flush semantics**:
405
+ pass `flushStrategy: "sab"` to `createRegistry` (see `liteSignal.ts` example
406
+ in the changeset).
407
+ - **Frame-aligned real-time loops**: pass `flushStrategy: "manual"` and call
408
+ `r.flush()` at the settle point.
409
+ - **Users of `createRoot` who want the capture-and-restore idiom across
410
+ async boundaries**: `getOwner()` + `runWithOwner()` are now available on
411
+ the 1.7 line (they were absent from pre-1.5.0-beta.2 branches and needed the
412
+ forward-port to reach 1.7 through the flushStrategy branch).
413
+
414
+ ### Verified
415
+
416
+ - **Full engine test suite** green on the merged engine (451 total, 440 pass,
417
+ 0 fail, 1 skip, 10 cancelled).
418
+ - **`harness/owner-hazard-repro.mjs ./Signal.js`** reports
419
+ `VERDICT: SAFE` on the recycled-slot case AND completes the corpse case
420
+ without stack overflow -- the ABA guard degrades both hazards to rooted
421
+ execution as designed.
422
+ - **sha256 over 11 hot-path function bodies** (`pullComputed`, `markDownstream`,
423
+ `executeEffect`, `flushEffects`, `allocateLink`, `severTail`, `createNode`,
424
+ `runCleanup`, `disposeNode`, `createRoot`, `createScope`) byte-identical
425
+ between pristine 1.7.0-preview (as uploaded) and the merged-with-getOwner
426
+ engine. The port literally only adds new code between `createRoot` and
427
+ `createScope` plus updates the return object and adds two top-level exports;
428
+ zero touch on any pre-existing function.
429
+
430
+ ## [1.6.0] -- 2026-06-26 (preview)
431
+
432
+ The observability-and-lifecycle minor, shipping on the `preview` dist-tag while it
433
+ settles. Two additions: `stats()` gains a twelfth key, **`flushPasses`**, plus two
434
+ flush-profiling mutation-hook opcodes -- the flush/recompute dimension
435
+ lite-devtools 1.2 / lite-studio 1.2 read through `watchAllocations`; and
436
+ **`createScope(fn)`** (landed in `preview.0`), the disposable-owner counterpart to
437
+ `createRoot` that a keyed-list / scene reconciler needs for per-item teardown.
438
+ Drop-in over 1.5.0: the callable API and hot paths are unchanged, and the new
439
+ instrumentation is frozen and zero-cost unless a mutation-hook listener is attached.
440
+
441
+ ### Added -- `flushPasses` on `stats()` + flush-profiling opcodes
442
+
443
+ `stats()` now returns **12 keys**: the 11 from 1.4.x plus `flushPasses`, a counter
444
+ that advances once per effect-flush drain pass. Two `onGraphMutation` opcodes back
445
+ the flush dimension:
446
+
447
+ - **`6` flush pass** -- `(passCount, effectsToRun)`, at the top of each drain pass.
448
+ - **`7` effect run in pass** -- `(id, 0)`, before each effect re-run inside a pass.
449
+
450
+ Both the counter bump and the opcode dispatch sit behind the existing
451
+ `if (mutationHook !== null)` gate, so when no profiler is attached they are inert:
452
+ `flushPasses` is frozen and the flush loop is byte-identical to 1.5.0. This is what
453
+ lets `watchAllocations` chart recompute/flush activity alongside the 1.4.0
454
+ allocation counters (`totalAllocations` / `poolGrowths` / `totalDisposals`), which
455
+ remain available from 1.4.0 on every engine -- only the flush series requires 1.6.
456
+
457
+ ### Added -- `createScope(fn)` (disposable owner scope) [preview.0]
458
+
459
+ `createScope` runs `fn(dispose)` in a detached scope and returns whatever `fn`
460
+ returns, having handed `fn` a single `dispose` that **cascade-disposes every effect
461
+ and computed created inside `fn`**. It is the lifecycle complement to `createRoot`:
462
+
463
+ - `createRoot(fn)` only **detaches** -- nodes created inside are unowned and the
464
+ caller must dispose each one by hand (there is no owner to do it automatically).
465
+ Correct for spawning one known long-lived watcher (lite-query's pattern).
466
+ - `createScope(fn)` **adopts** -- it owns whatever `fn` builds, so one disposer tears
467
+ down a subtree of *unknown* shape. This is what a per-item scope in a keyed-list or
468
+ scene reconciler requires, where the item's reactive graph is the consumer's
469
+ `mapFn`, not something the reconciler can enumerate.
470
+
471
+ **Semantics.** `fn` runs once in a detached, untracked context: no ownership and no
472
+ dependency leak from `fn`'s direct body into the enclosing scope, and the scope owner
473
+ never re-runs. Reactive bindings belong in inner effect/computed bodies inside `fn`
474
+ (those track normally and are owned by the scope); direct-body reads are untracked.
475
+ Consistent with the 1.2.0 ownership rule, **plain signals created directly in `fn` are
476
+ not adopted** -- dispose those explicitly (the creator holds the handle) or let them
477
+ fall out of reference; computeds and effects are adopted and cascade.
478
+
479
+ **Implementation.** The scope owner is backed by a never-re-running effect node, so it
480
+ counts as one effect in `stats()` and its disposer is the same gen-guarded, ABA-safe,
481
+ introspection-stamped handle `effect()` returns (`describe` / `nodeId` / `forEachOwned`
482
+ resolve it to the owner). No new node kind, flag, or `stats()` key -- the pinned
483
+ `signals + computeds + effects === activeNodes` invariant is untouched. The API
484
+ (`fn => dispose`) is the stable contract; a future engine may swap in a lighter
485
+ pure-owner node transparently.
486
+
487
+ Exported as a registry method and a top-level helper bound to the default registry,
488
+ mirroring `createRoot`.
489
+
490
+ ### Added -- characterization harnesses (`burst-dag.mjs`, `pull-stress.mjs`)
491
+
492
+ Two root-level standalone harnesses that exercise the new 1.6.0 instrumentation
493
+ surface against the engine's two main hot paths. Both are engine-agnostic
494
+ (`./Signal.js` + public `onGraphMutation` only), both expose a CLI + module
495
+ exports, both stay out of `npm test` and the published tarball.
496
+
497
+ **`burst-dag.mjs`** (`npm run profile:burst`, also `node --expose-gc burst-dag.mjs
498
+ [--width=512 --layers=32 ...]`) reconstructs the published
499
+ `js-reactivity-benchmark` burst shape (sources -> width x layers, fanIn 8, burst
500
+ 16) and characterizes lite-signal's own flush behavior. The standalone path uses
501
+ the new `stats().flushPasses` counter as a cross-check against the opcode-6 pass
502
+ count -- by construction they must match when the hook is attached for exactly
503
+ one burst, which the harness asserts inline. Also exports `burstDagScenario`
504
+ (for plugging into a steady-state allocation gate) and `multiPassProbe` (a
505
+ controlled two-effect write-back that forces a `passes > 1` case so the opcode
506
+ dispatch can be smoke-tested on an engine where multi-pass actually occurs).
507
+
508
+ **`pull-stress.mjs`** (`npm run profile:pull`, also `node --expose-gc
509
+ pull-stress.mjs [--maxDepth=3584 --step=512 ...]`) is the pull-path companion:
510
+ characterizes how the recursive pull scales with chain depth and binary-searches
511
+ the exact overflow point. Three answers per run: (1) the exact deepest chain
512
+ that pulls successfully (the roadmap's "~5,000 chained computeds" pinned to a
513
+ number for the current engine), (2) per-level cold cost across a depth sweep
514
+ (should be roughly linear; superlinear flags a per-node bookkeeping cost
515
+ growing with depth), and (3) cached-read cost (should be O(1) regardless of
516
+ depth via the 1.1.4 `markEpoch` short-circuit). Structure pass at a safe fixed
517
+ depth confirms the opcode triple (0 flush passes, 0 effect runs, recomputes ==
518
+ depth) -- the pull path is doing nothing it shouldn't. Also exports
519
+ `pullStressScenario` for steady-state allocation gates and `probeOverflow`
520
+ for the binary search alone. Both `--kind=callable` and `--kind=box` are
521
+ supported and surface a real engine difference (box pulls overflow earlier
522
+ because `box.get()` adds a prototype-method frame per level, and cached box
523
+ reads are several times more expensive than cached callable reads).
524
+
525
+ Both files import only `./Signal.js`, so the same harness runs against any
526
+ engine build: point `Signal.js` at 1.5.x to compare without the counters
527
+ (`burst-dag` adapts -- only opcode 5 fires on that engine -- and `pull-stress`
528
+ works identically), or at a rejected candidate to re-verify on. The numbers
529
+ they produce are reproducible, comparable, and engine-version-aware.
530
+
531
+ ### Verified
532
+
533
+ - **Full suite green** against the 1.6.0 engine: 443 tests, 442 pass, 0 fail,
534
+ 1 skip (only the architecturally-N/A SSR case in `17-reactivity`). +4
535
+ `createScope` tests in `test/28-scope_test.mjs`; the 1.5.0 box and createRoot
536
+ suites carry forward unchanged. **Coverage** (c8@11, Node 22): `Signal.js`
537
+ 100% statements / 96.96% branches / 100% functions / 100% lines; `Watch.js`
538
+ 100% across all four. The branch drop vs 1.5.0 (97.35% -> 96.96%) is the
539
+ zero-cost gate on `flushPasses` / opcode 6 / opcode 7 -- the
540
+ `if (mutationHook !== null)` mutation-hook-attached branch is not exercised
541
+ by the active test suite, which never attaches a hook; the inert path is
542
+ covered.
543
+ - **`createScope` behavior** (4 tests, `node --expose-gc`): returns `fn`'s value and
544
+ runs the owner exactly once even when `fn` reads signals in its direct body
545
+ (untracked); inner effects/computeds track and update; `dispose()` cascade-disposes
546
+ the owned subtree (effects + computeds) while an un-adopted signal correctly
547
+ survives; a disposed scope's inner effects stop firing; **a scope created inside a
548
+ consumer effect survives that consumer's re-run** (the reconciler-critical detach
549
+ property); `dispose()` is an idempotent no-op on the second call; the disposer is
550
+ introspection-stamped to its owner effect; and `totalAllocations - totalDisposals
551
+ === activeNodes` holds after teardown. Plus a smoke confirming signal -> computed ->
552
+ effect is unaffected by the additive change.
553
+ - **Instrumentation is zero-cost when unobserved**: `flushPasses` advances and opcodes
554
+ 6/7 fire only while a mutation-hook listener is attached; with none, the flush path
555
+ is unchanged from 1.5.0.
556
+
557
+
558
+
559
+ ## [1.5.0] -- 2026-06-XX
560
+
561
+ The API-surface minor: two new **non-callable, allocation-light** reactive
562
+ primitives, `signalBox` and `computedBox`, land alongside the existing callable
563
+ `signal` / `computed`; and **`createRoot`** lands as the ownership escape hatch
564
+ the owner tree was designed for. They wrap the same `ReactiveNode` machinery and
565
+ interoperate freely in one graph -- a box can depend on a callable and vice
566
+ versa -- so this is an additive surface, not a second engine. Drop-in over 1.4.0:
567
+ the callable API, hot paths, and `stats()` shape are unchanged; the boxes are new
568
+ exports and the `24-signalbox` suite (staged `{skip:true}` since 1.3.0) now runs
569
+ and passes. The 1.3.0 eager pool default carries forward (`prealloc: "eager"`).
570
+
571
+ ### Added -- `signalBox(initial, opts?)` and `computedBox(fn, opts?)`
572
+
573
+ Non-callable variants that return a plain object on a shared prototype instead of
574
+ a callable function:
575
+
576
+ - **`signalBox`** returns `{ get, set, peek, update, subscribe }`.
577
+ - **`computedBox`** returns `{ get, peek, subscribe }` (no `set` / `update` --
578
+ it is derived).
579
+
580
+ Both are exported as registry methods *and* as top-level helpers bound to the
581
+ default registry, mirroring `signal` / `computed`. The `opts.equals` custom
582
+ equality option is supported on both, same default (`Object.is`).
583
+
584
+ **Why a second shape.** The callable API (`count()`, `count.set(x)`) is the most
585
+ ergonomic surface, but constructing a callable means building a function object
586
+ and hanging methods/state off it. For code that creates *many* short-lived
587
+ reactive cells, or that wants a plain serializable-looking handle, the box trades
588
+ call ergonomics for cheaper construction:
589
+
590
+ - **Box creation is faster than callable** -- on this host, 10,000 `signalBox`
591
+ in ~10ms vs ~18ms for 10,000 callable `signal` (about 1.7x cheaper),
592
+ because `Object.create(proto)` is cheaper than allocating a closure with
593
+ attached properties.
594
+ - **The hot read/write path stays zero-GC** -- 200,000 box writes through a
595
+ 256-wide graph allocate nothing and grow the pool zero times. The box is a
596
+ thin handle over the same pooled node; only the *handle object* differs from
597
+ the callable, and it is created once.
598
+
599
+ ### Engineering note -- monomorphic boxes via `Object.create`, not `setPrototypeOf`
600
+
601
+ Each box is built with `Object.create(SIGNAL_BOX_PROTO)` (resp.
602
+ `COMPUTED_BOX_PROTO`) and then has its two own properties (`NODE_PTR`,
603
+ `NODE_GEN`) added in a fixed order. This is deliberate: using `setPrototypeOf`
604
+ on an already-constructed object transitions it to dictionary mode and forces the
605
+ method-call inline caches at `box.get()` / `box.set()` to megamorphic. Building on
606
+ the shared prototype from the start keeps every box monomorphic, so the method
607
+ calls stay inline-cached and fast. This is the same class of V8-closure-tax
608
+ avoidance the engine applies throughout; a rejected earlier prototype that used
609
+ `setPrototypeOf` regressed box method calls and was not shipped.
610
+
611
+ ### Interop -- one graph, two handle shapes
612
+
613
+ A box and a callable handle wrap the same kind of `ReactiveNode`. Verified both
614
+ directions: a callable `computed` that reads `box.get()` tracks the box as a
615
+ dependency and updates correctly; a `computedBox` that reads a callable
616
+ `signal()` does the same. Glitch-freedom, batching, ownership/auto-disposal, and
617
+ the introspection surface all apply uniformly -- a box node is indistinguishable
618
+ from a callable node to the graph, the owner tree, and devtools.
619
+
620
+ ### Added -- `test/24-signalbox_test.mjs` activated (9 tests)
621
+
622
+ The suite that was committed-but-skipped since 1.3.0 now runs against the real
623
+ implementation: box get/set/peek/update, computedBox derive + memoize,
624
+ peek-does-not-track, subscribe fires-and-untracks, box<->callable interop both
625
+ directions, batch coalescing across boxes, dispose stopping updates with
626
+ ABA-safety, and the `equals` short-circuit. All 9 pass.
627
+
628
+ ### Added -- `createRoot(fn)` (ownership escape hatch)
629
+
630
+ `createRoot` runs `fn` in a **detached ownership scope**: effects and computeds
631
+ created inside `fn` are not adopted by the enclosing owner, so they survive the
632
+ enclosing effect's re-runs and disposal. The caller owns their lifecycle (there
633
+ is no parent to auto-dispose them -- `fn` typically returns a disposer or the
634
+ created handle). Exported as a registry method and a top-level helper, mirroring
635
+ `signal` / `computed` / `untrack`.
636
+
637
+ **Why it exists.** The owner tree's defining behavior is that owned children
638
+ dispose with their parent -- correct and intended (pinned by the cleanup-ordering
639
+ tests since 1.2.0). But that makes one pattern a footgun: lazily spawning a
640
+ *long-lived* node from *inside* a consumer effect. The spawned node is adopted by
641
+ the consumer, so the consumer's next re-run cascade-disposes it. This is not an
642
+ engine defect -- it is the ownership model working as designed -- but until now
643
+ there was no sanctioned way to opt a child *out* of ownership. `createRoot` is
644
+ that opt-out. The engine head comment has named `runWithOwner` / `createRoot` as
645
+ the intended future API for exactly this since the owner/observer split shipped
646
+ in 1.2.0 (`currentOwner` and `currentObserver` were made distinct pointers
647
+ precisely so ownership could be detached without affecting tracking); 1.5.0
648
+ delivers the first of the two.
649
+
650
+ **What it detaches.** For the duration of `fn`, both `currentOwner` and
651
+ `currentObserver` (and the tracking flag) are nulled, so neither ownership nor a
652
+ reactive dependency leaks from `fn`'s direct body into the enclosing scope. Inner
653
+ effect / computed bodies still establish their own owner+observer scopes as
654
+ usual -- only the boundary at `fn` is detached. Mirrors Solid's `createRoot` on
655
+ the lifecycle axis.
656
+
657
+ **Who needs it.** Any consumer that lazily creates a watcher/subscription inside
658
+ a reactive scope and expects it to outlive that scope -- `lite-query`'s
659
+ query-watcher being the first in the ecosystem. Those consumers wrap the spawn in
660
+ `createRoot(() => effect(...))` and dispose it themselves; the watcher then
661
+ survives consumer re-runs.
662
+
663
+
664
+ - **Full suite green** against the 1.5.0 engine: 439 tests, 438 pass, 0 fail,
665
+ 1 skip (only the architecturally-N/A SSR case in `17-reactivity`; the 9
666
+ `24-signalbox` tests are now active, +6 `createRoot` tests in
667
+ `test/27-create-root_test.mjs`, +3 box-coverage tests). **Coverage** (c8@11,
668
+ Node 22): `Signal.js` 100% statements / 97.35% branches / 100% functions / 100%
669
+ lines; `Watch.js` 100% across all four.
670
+ - **Box hot path is zero-GC**: 200,000 writes through a 256-wide box graph,
671
+ 0 heap growth, 0 pool growths after warm-up -- identical steady-state profile
672
+ to the callable API.
673
+ - **Box creation is allocation-light**: measurably cheaper construction than the
674
+ callable equivalent (~1.7x on this host), the design goal of the second shape.
675
+ - **Interop confirmed**: callable-reads-box and box-reads-callable both track and
676
+ update correctly in a single graph; `stats()` counts box nodes in `signals` /
677
+ `computeds` exactly as callable nodes.
678
+ - **`stats()` shape unchanged** from 1.4.0 (11 keys); boxes allocate nodes
679
+ through the same `createNode` path, so the 1.4.0 lifecycle counters
680
+ (`totalAllocations` etc.) account for box nodes automatically.
681
+ - **`createRoot` detaches ownership without leaking**: a watcher effect spawned
682
+ inside a consumer effect via `createRoot` survives the consumer's re-run (fires
683
+ on later dependency changes where, unwrapped, it would have been cascade-
684
+ disposed), and an explicit disposer on the detached effect still stops it
685
+ cleanly -- detachment costs no auto-cleanup but introduces no leak. Verified
686
+ against the exact lazy-watcher pattern `lite-query` uses.
687
+
688
+
689
+
690
+ ## [1.4.0] -- 2026-06-XX
691
+
692
+ The observability minor: `stats()` gains **three cumulative lifecycle counters**
693
+ (`totalAllocations`, `totalDisposals`, `poolGrowths`) -- the surface reserved for
694
+ 1.4.0 in the 1.2.x and 1.3.0 notes, now delivered. This is what lite-devtools /
695
+ lite-studio read to chart allocation rate, pool-reuse ratio, and graph churn over
696
+ time. Drop-in over 1.3.0 -- no hot-path change, no public callable API change; the
697
+ counters are bumped on existing lifecycle edges (acquire / dispose / grow) that
698
+ already ran, so steady-state throughput and zero-GC are unchanged. The eager pool
699
+ default introduced in 1.3.0 carries forward (`prealloc: "eager"`).
700
+
701
+ ### Added -- cumulative lifecycle counters on `stats()`
702
+
703
+ `stats()` now returns **11 keys**: the 8 from 1.2.x/1.3.0 plus three monotonic
704
+ counters. They are cumulative over the registry's life and reset only by
705
+ `destroy()`.
706
+
707
+ - **`totalAllocations`** -- incremented on every node acquire, whether the node
708
+ is popped from the free list or freshly constructed during a pool-growth chunk.
709
+ This is the true number of nodes the registry has ever handed out, not the
710
+ current live count (`activeNodes` remains the live gauge).
711
+ - **`totalDisposals`** -- incremented on every `disposeNode`, i.e. every node
712
+ returned to the pool. `totalAllocations - totalDisposals` tracks the live set
713
+ and should equal `activeNodes` in a quiescent registry.
714
+ - **`poolGrowths`** -- incremented whenever a node *or* link refill chunk pushes
715
+ capacity past its current ledger (`maxNodes` / `maxLinks`). A nonzero value
716
+ after warm-up means the initial pool was undersized for the workload and the
717
+ registry grew at runtime -- the signal a tool uses to recommend a larger
718
+ `maxNodes` / `maxLinks`, or that confirms an eager pool was sized correctly
719
+ (stays 0).
720
+
721
+ The counters are exact, not sampled: they sit on the same `createNode` /
722
+ `disposeNode` / chunk-refill edges the engine already executes, so reading them
723
+ costs nothing and they cannot drift from the real lifecycle.
724
+
725
+ ### Why these three, and what they enable
726
+
727
+ The point is *derivable* observability without the engine itself computing rates.
728
+ A consumer sampling `stats()` over time gets, with no extra engine work:
729
+
730
+ - **allocation rate** = delta `totalAllocations` / delta t (graph build pressure),
731
+ - **pool-reuse ratio** = `1 - poolGrowths * initialCapacity / totalAllocations`
732
+ (how much work the pool absorbed vs. how much forced growth),
733
+ - **approximate average lifetime** ~ `totalDisposals` / allocation rate (churn).
734
+
735
+ These are exactly the series lite-devtools 1.2 / lite-studio 1.2 plot. The engine
736
+ stays a measurement *source*, not a metrics framework -- consistent with the
737
+ zero-overhead-in-steady-state contract.
738
+
739
+ ### Changed -- `destroy()` resets the counters
740
+
741
+ `destroy()` (the in-place arena reset) now also zeroes the three counters along
742
+ with the rest of registry state, so a reused registry reports lifecycle numbers
743
+ for its current epoch only. Grown pool *capacity* is retained across `destroy()`
744
+ as before (the reset keeps the arena warm); only the cumulative counts reset.
745
+
746
+ ### Verified
747
+
748
+ - **Full suite green** against the 1.4.0 engine: 429 tests, 419 pass, 0 fail,
749
+ 10 skip (9 signalBox-staged-for-1.5.0 plus 1 architecturally-N/A SSR skip). The eager-default and the counter additions
750
+ changed no existing test outcome.
751
+ - **Counter correctness** confirmed directly: after building a signal ->
752
+ computed -> effect graph, `totalAllocations` equals the node count and
753
+ `totalDisposals` tracks effect/computed teardown; forcing a pool past its
754
+ ledger under `onCapacityExceeded: "grow"` increments `poolGrowths`; an
755
+ eager pool sized to cover its graph keeps `poolGrowths` at 0.
756
+ - **Zero-GC steady state holds**: the counters bump only on acquire / dispose /
757
+ grow, none of which occur on the steady-state write path after warm-up. Writing
758
+ through a built graph allocates nothing and moves no counter.
759
+ - **`stats()` shape** is now the authoritative 11-key 1.4.x shape, pinned by a
760
+ new shape-and-initial-zeros test in `03-pool` -- the first explicit pin for
761
+ the `stats()` surface (the 1.2.x / 1.3.0 entries described the absence of the
762
+ counters in prose; 1.4.0 codifies the new shape as a test assertion).
763
+
764
+
765
+
766
+ ## [1.3.0] -- 2026-06-XX
767
+
768
+ The pool minor: the node and link pools become **growable and incrementally
769
+ populated**, the propagation mark phase moves to an **intrusive linked-list
770
+ stack**, and a small **registry config surface** (`prealloc`,
771
+ `onCapacityExceeded`, `maxFlushPasses`) is exposed. Drop-in over 1.2.2 -- the
772
+ hot paths and public callable API are byte-identical; everything here is pool
773
+ mechanics, construction-time behavior, and new opt-in config. Steady-state
774
+ zero-GC is unchanged: after warm-up the pools recycle exactly as before.
775
+
776
+ **Default behavior: `prealloc: "eager"`.** The pools are preallocated up front
777
+ by default, preserving 1.2.x's deterministic-latency profile (no allocation
778
+ inside a hot loop or render frame -- the contract that matters for the 16ms /
779
+ 120fps Twitch-overlay and canvas use cases this engine targets). Lazy population
780
+ is available as an opt-in (`prealloc: "lazy"`) for footprint-sensitive or
781
+ fast-cold-start consumers. See the tradeoff note under *Added -- registry config*.
782
+
783
+ ### Added -- growable pools (`onCapacityExceeded: "grow"`)
784
+
785
+ The node and link pools can now grow past their initial capacity instead of
786
+ only throwing. Growth is **chunked and incremental**, not a single doubling
787
+ burst:
788
+
789
+ - **Link pool** refills in contiguous runs of up to **1024** links per
790
+ free-list miss; **node pool** in runs of up to **256**. This bounds any
791
+ single growth pause to roughly `chunk x ~0.5us` and keeps the freshly
792
+ constructed slots contiguous in memory (better locality than scattered
793
+ one-at-a-time `new`).
794
+ - `onCapacityExceeded` (default `"throw"`) selects the policy: `"throw"` fails
795
+ fast with a `CapacityError` when a pool is full (the 1.2.x behavior, now
796
+ named); `"grow"` extends the pool on demand. Link growth is bounded by a hard
797
+ ceiling of `maxLinks * 16`.
798
+ - The growth path **no longer length-extends the effect queues or mark stack**.
799
+ Previously `arr.length = newCap` permanently converted those arrays from
800
+ PACKED to HOLEY elements-kind -- a silent flush-path tax. They now grow by
801
+ sequential `arr[len++] = x` appends, which keep them packed.
802
+
803
+ ### Added -- registry config surface
804
+
805
+ `createRegistry(config)` accepts three new options. All are additive and
806
+ non-breaking; omitting `config` reproduces 1.2.x behavior with the eager
807
+ default.
808
+
809
+ - **`prealloc`** (`"eager"` default | `"lazy"`). `"eager"` constructs the full
810
+ `maxNodes` / `maxLinks` pools up front -- deterministic latency, zero
811
+ allocation inside any subsequent hot path, at the cost of a larger resident
812
+ heap that every major GC must trace. `"lazy"` treats `maxNodes` / `maxLinks`
813
+ as capacity *ledgers*, constructs nodes/links on first demand, and recycles
814
+ through the free lists thereafter -- smaller heap, faster cold start, lighter
815
+ GC marking, identical zero-GC steady state after warm-up. **Choose eager for
816
+ hard-real-time (render loops, game ticks, extension frame budgets); choose
817
+ lazy for footprint-sensitive or short-lived registries.**
818
+ - **`onCapacityExceeded`** (`"throw"` default | `"grow"`) -- see above.
819
+ - **`maxFlushPasses`** (default `100`) -- cycle-protection ceiling: the maximum
820
+ number of effect-queue drain passes before the flush throws an `Error`
821
+ prefixed `"CycleError:"`. Exposes what was a fixed internal bound so
822
+ pathological-but-legitimate deep-cascade graphs can raise it.
823
+
824
+ ### Changed -- intrusive mark stack in `markDownstream`
825
+
826
+ The propagation mark phase now walks an **iterative DFS backed by an intrusive
827
+ linked-list stack** (a `nextMark` field on each node) instead of a separate
828
+ `markStack` container array. Because `nextMark` sits adjacent to the
829
+ `markEpoch` field that the same sweep reads, the stack write lands in an
830
+ already-hot cache line. Behaviorally identical -- same nodes marked in the same
831
+ order, same glitch-free guarantee -- and it removes the container array's growth
832
+ and HOLEY-conversion concerns entirely. The mark stack never grows the JS call
833
+ stack regardless of graph depth (the iterative property from 1.2.4 is retained).
834
+
835
+ ### Added -- `ReactiveNode.nextMark`
836
+
837
+ One field added to the node shape to back the intrusive mark stack. Initialized
838
+ to `null` on construction, cleared on pop during a sweep and defensively on
839
+ dispose, so the chain stays clean for reuse. This is the only node-shape change
840
+ in 1.3.0.
841
+
842
+ ### Verified
843
+
844
+ - **Full suite green** against the 1.3.0 engine: 423 tests, 413 pass, 0 fail,
845
+ 10 skip (9 `24-signalbox` tests `{skip:true}` on 1.3.x -- those primitives
846
+ land in 1.5.0 -- plus 1 architecturally-N/A SSR skip). The eager-default flip
847
+ changed no test outcome.
848
+ - **Behavior-preservation difftest**: 20,000 direct + 10,000 batched writes
849
+ against the published 1.1.5 reference, 0 disagreements. Pool growth, chunked
850
+ refill, and the intrusive mark stack do not alter observable propagation.
851
+ - **Zero-GC steady state holds**: after warm-up, writing through a built graph
852
+ allocates nothing and the pool does not grow (eager) / does not grow further
853
+ (lazy, post warm-up). Confirmed across deep-chain, wide fan-out, and batched
854
+ scenarios.
855
+ - **`stats()` shape unchanged from 1.2.x** (8 keys). The cumulative allocation
856
+ counters (`totalAllocations` / `totalDisposals` / `poolGrowths`) remain
857
+ reserved for 1.4.0 and are still absent here.
858
+
859
+
860
+
861
+ ## [1.2.2] -- 2026-06-XX
862
+
863
+ A code-deletion ship: a `createNode` audit removes ten redundant field-writes
864
+ that defended against a state the engine cannot produce on a clean free-list.
865
+ No public surface change, no semantic change, no new tests required for new
866
+ behavior (because there is none) -- only an added invariant suite that pins
867
+ the cleanliness claim the audit relies on. Drop-in over 1.2.1.
868
+
869
+ **Version lineage note.** This is the engine previously labeled `1.2.3` in dev.
870
+ Renumbered to `1.2.2` to keep semver tidy: the deletion is small, isolated, and
871
+ intentionally non-behavioral; bumping the patch rather than the minor reflects
872
+ that. The upcoming `1.3.0` (lazy/chunked pool with `prealloc:"eager"` default
873
+ and intrusive mark stack) carries the next minor bump.
874
+
875
+ ### Changed -- clean free-list invariant audit in `createNode`
876
+
877
+ Two clusters of redundant writes removed. Both rely on a single invariant:
878
+ **every node leaving the pool has the listed fields at their fresh-construct
879
+ default values** because `disposeNode` and `runCleanup` already null them and
880
+ the `ReactiveNode` constructor initializes them to the same values on
881
+ fresh-pool-growth allocation.
882
+
883
+ - **Seven graph/batch fields** no longer rewritten on every allocate:
884
+ `headDep`, `tailDep`, `headSub`, `tailSub`, `revertEpoch`, `preBatchValue`,
885
+ `preBatchVersion`. Paired-checked: `disposeNode` clears all seven on the
886
+ recycle path; the `ReactiveNode` constructor inits all seven to the same
887
+ values on the fresh-allocation path used by pool growth.
888
+ - **Three owner-tree fields** in the non-adoption path no longer rewritten:
889
+ the `firstOwned = null`, the adoption-path `prevOwned = null`, and the
890
+ else-branch `owner = null`. The `disposeNode` direct path nulls
891
+ `owner / prevOwned / nextOwned`; the `runCleanup` cascade path nulls them
892
+ on every disposed child and sets the parent's `firstOwned = null` at exit.
893
+ The constructor inits all four owner-tree fields to `null` on
894
+ fresh-allocation.
895
+
896
+ What `createNode` still writes are the *lifetime* writes for the new resident:
897
+ `value`, `flags`, `id`, and the three fields `disposeNode` does NOT touch
898
+ (`version`, `evalVersion`, `markEpoch` -- propagation state that must reset for
899
+ the new lifetime), plus the conditional owner-adoption splice
900
+ (`owner`, `nextOwned`, parent chain link).
901
+
902
+ ### Added -- `test/10-free-list-invariant_test.mjs`
903
+
904
+ A three-test invariant suite that asserts the audit's claim by inspecting
905
+ freshly-allocated nodes' underlying field state (via the documented
906
+ `describe()` -> `NODE_PTR` surface, the same protocol devtools uses). Tests:
907
+
908
+ - Recycled slot reports null `headDep/tailDep/headSub/tailSub` and zero
909
+ `revertEpoch/preBatchVersion`, undefined `preBatchValue`, after disposing
910
+ a real signal->computed->effect graph.
911
+ - Recycled slot reports null `owner/prevOwned/nextOwned/firstOwned` after an
912
+ owner-cascade tears down a nested observer tree.
913
+ - Mixed-pattern churn (simple, batched-write, error-flush) leaves no dirty
914
+ state on the free list across 32 follow-up allocations.
915
+
916
+ If any future change reintroduces a write to a clean-state field on the
917
+ dispose path or removes a write that turns out NOT to be redundant, this
918
+ suite catches it.
919
+
920
+ ### Added -- `test/11-devtools-contract_test.mjs`
921
+
922
+ A 12-test smoke probe of the introspection surface that lite-devtools 1.1 /
923
+ lite-studio 1.1 consume. Verifies handle resolution + walkers, owner-tree
924
+ walkers, the `onGraphMutation` push hook, the `observeObservers` ghost
925
+ contract (zero added nodes under heavy introspection), and pins the
926
+ authoritative 1.2.x `stats()` shape (exactly 8 keys: `signals`, `computeds`,
927
+ `effects`, `activeNodes`, `activeLinks`, `pooledLinks`, `nodePoolCapacity`,
928
+ `linkPoolCapacity`). Also pins the absence of `totalAllocations` /
929
+ `totalDisposals` / `poolGrowths` on 1.2.x -- those are reserved for 1.4.0 and
930
+ the test fails if they appear early.
931
+
932
+ ### Verified
933
+
934
+ - **408 tests total: 398 pass, 10 skip, 0 fail** across the 23 active
935
+ suites (01-09 baseline + 11-23 introspection/ownership/perf-pin + my new
936
+ 25 devtools-real-boot + 26 free-list-invariant). The 10 skips are 9
937
+ signalBox-staged-for-1.5.0 in `24-signalbox` and 1 architecturally-N/A
938
+ SSR case in `17-reactivity`.
939
+ - **Coverage on `Signal.js`: 100% statements, 98.43% branches, 100%
940
+ functions, 100% lines.** `Watch.js`: 100% across all four. (c8@11,
941
+ Node 22.) Better branch coverage than the 1.2.1 baseline documented in
942
+ `llms.txt` (was 98.07%); the engine path that closed the gap was a
943
+ targeted test of the swallow-on-self-dispose-then-throw branch in
944
+ `pullComputed`. The remaining ~5 unreached branches are exactly the
945
+ unreachable-by-construction cases already catalogued as `/* c8 ignore */`
946
+ candidates in `COVERAGE-NOTES.md` (cursor fast path, batch wraparound
947
+ sentinel, etc.).
948
+ - **Devtools 1.1.0 + Studio 1.1.0 contract: green.** Test
949
+ `25-devtools-real-boot` boots the actual `Devtools.js` against the
950
+ 1.2.2 engine and exercises all 19 exports + the 10 symbols Studio
951
+ imports from Devtools. The ghost contract holds (heavy introspection
952
+ adds zero nodes). One real test-rig finding surfaced during this work:
953
+ if the engine is developed in a repo whose own `package.json` declares
954
+ `name: "@zakkster/lite-signal"`, importing the package by name from the
955
+ project root can resolve to a different module instance than imports
956
+ from inside a sibling `node_modules/@zakkster/lite-devtools/`,
957
+ fragmenting the `defaultRegistry`. This is purely a dev-loop / test-rig
958
+ matter (not an engine, devtools, or studio bug) -- in a real consumer
959
+ installation both packages live in `node_modules` and resolve once.
960
+
961
+ ### Not changed
962
+
963
+ - Public API: no additions, no removals, no signature changes.
964
+ - Type surface: `Signal.d.ts` unchanged.
965
+ - Behavior: every existing test case in 01-09 passes unmodified.
966
+
967
+ ### Honest notes
968
+
969
+ - **Perf**: no microbench numbers cited. Ten removed field writes per
970
+ `createNode` is a real saving on creation-heavy workloads, but creation
971
+ cost is dominated by the owner-adoption splice and the optional mutation
972
+ hook, not by these writes. Any "X% faster on creation" claim would need
973
+ to come from a per-run lite-vs-alien measurement on the project's
974
+ standard benchmark harness; this ship does not include one because the
975
+ audit is justified by correctness (clean invariant beats defensive
976
+ writes) rather than measured speedup.
977
+ - **Differential testing**: the retracking difftest harness expects two
978
+ engine builds (REF = prior shipped, CANDIDATE = under review). This ship
979
+ was validated against itself (30,000 writes, 0 disagreements), which
980
+ proves determinism but not 1.2.2-vs-1.2.1 behavioral equivalence --
981
+ equivalence is argued instead from the audit being a code-deletion of
982
+ writes provably-redundant under the existing pre/post-invariants, and
983
+ from the full 01-09 suite passing unmodified.
984
+
985
+ ### Benchmarks
986
+
987
+ The audit ship does not move the curve on any benchmark -- by design;
988
+ the steady-state hot paths are byte-identical to 1.2.1. The bench
989
+ results were re-measured against 1.2.2 on the project's reference host
990
+ (2016 MacBook Pro, Intel, Node 22) and are published as the baseline
991
+ for the next version. See [`bench/results.txt`](./bench/results.txt)
992
+ (in-house anti-DCE harness, median-of-3 cold-process runs from
993
+ `bench/run-all.sh`), [`bench/resultsReactive.txt`](./bench/resultsReactive.txt)
994
+ (community reactive suite, 10 raw runs), and the third-party
995
+ [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark)
996
+ results (16 frameworks). Position on the third-party suite: **#4 of 16
997
+ by geomean** (2.05× vs alien-signals 1.00×), behind alien-signals,
998
+ reflex, and @reactively; ahead of Preact Signals (2.09×), uSignal,
999
+ $mol_wire, and 9 others. Outright wins on `manyEffectsFromOneSource`
1000
+ and `manySourcesIntoOneComputedEffectWithDirect`; top-3 finishes on
1001
+ 18 of 47 tests. The version dependencies used for these numbers are
1002
+ pinned in [`bench/package.json`](./bench/package.json) at
1003
+ `lite-signal-bench@2.2.0`.
1004
+
1005
+ ## [1.2.1] -- 2026-06-12
1006
+
1007
+ A correctness-and-pauses patch in two halves: the pool allocator stops paying
1008
+ for growth in unbounded bursts, and the introspection surface stops lying about
1009
+ handles the 1.2.0 owner tree disposed behind your back. Plus the graph-mutation
1010
+ hook -- the keystone that lets lite-devtools 1.1 / lite-studio 1.1 go push-based.
1011
+ Drop-in over 1.2.0: 404-test suite green, 177/178 on
1012
+ johnsoncodehk/reactive-framework-test-suite (same single open cell, Inner
1013
+ Write #179), hot-path regression gate flat on two hosts.
1014
+
1015
+ ### Fixed -- bounded pool growth (no more construction bursts)
1016
+ - Under `onCapacityExceeded: "grow"`, exhausting a pool used to double it by
1017
+ synchronously constructing `currentCapacity` fresh nodes/links -- at a
1018
+ 524,288-node pool that is a quarter-million 25-field allocations in one
1019
+ pause, in whatever frame triggered it. Growth is now incremental: **one**
1020
+ node/link constructed per free-list miss, pushed into the pool, recycled
1021
+ forever after. The capacity **ledger** still doubles, so `stats()`
1022
+ (`nodePoolCapacity` / `linkPoolCapacity` / `pooledLinks`), the
1023
+ `maxLinks × 16` ceiling, and every `CapacityError` are bit-identical to
1024
+ 1.2.0 -- only the construction schedule changed. Locked by the existing
1025
+ `test/03-pool` capacity/ceiling/recycle contracts.
1026
+ - Benchmark effect (volynetstyle/js-reactivity-benchmark, same host as the
1027
+ 1.2.0 baseline run): creation group 489 -> 423 ms (-13.5%), with the burst
1028
+ cases roughly halved (`1to2` 112 -> 58, `1to8` 113 -> 55, `1to4` 81 -> 54).
1029
+ Honest redistribution note: rows that previously *fit inside the doubling
1030
+ overshoot* (`createDataSignals` 12.8 -> 71.9, `1to1` 17.8 -> 43.2) now pay
1031
+ their construction inside the measured window -- 1.2.0's overshoot was an
1032
+ accidental prefetch, and the same mechanism produced the pathological
1033
+ bursts. Bounded pauses are the right trade for real applications; the
1034
+ group total still improves.
1035
+ - Steady-state hot paths are untouched (update / dynamic-retracking /
1036
+ effect-recycle measured flat on both benchmark hosts).
1037
+
1038
+ ### Fixed -- effect queues / mark stack stay PACKED
1039
+ - Pool growth used to pre-size `effectQueueA/B` and the mark stack with
1040
+ `arr.length = newCap` -- which permanently converts a PACKED V8 array to
1041
+ HOLEY elements, a silent tax on every subsequent flush read. The queues now
1042
+ grow by sequential append (packed-preserving, auto-amortised) and
1043
+ `destroy()` truncates instead of null-filling to capacity.
1044
+
1045
+ ### Fixed -- `destroy()` iterates physical pools
1046
+ - `destroy()` walked `currentNodesCapacity` slots by index; with incremental
1047
+ growth (and any future lazy population) the ledger can exceed the physical
1048
+ pool. It now walks `nodePool.length` / `linkPool.length` and is safe on an
1049
+ empty pool.
1050
+
1051
+ ### Fixed -- stale-handle introspection (the owner-tree follow-up)
1052
+ - 1.2.0's owner tree made the engine recycle pool slots **autonomously**: an
1053
+ owner re-run cascade-disposes its owned observers, so holding a stale handle
1054
+ stopped being a user error and became a routine occurrence. The
1055
+ introspection surface -- `nodeId` / `describe` / `forEachObserver` /
1056
+ `forEachSource` / `hasObservers` / `observeObservers` -- still resolved
1057
+ `NODE_PTR` without a generation check and would happily report the
1058
+ **recycled slot's new resident** (wrong id, wrong value, wrong edges)
1059
+ through an old handle. All six entry points now resolve through a
1060
+ gen-guarded `liveNode()` and report stale handles as `undefined` (or throw
1061
+ the existing `TypeError`, for `observeObservers`) -- the same ABA discipline
1062
+ `read()` / `set()` / `dispose()` already had.
1063
+ - `describe()` descriptors are now **gen-stamped** alongside the node
1064
+ reference, so the documented "descriptors are re-walkable handles" contract
1065
+ survives the guard: a fresh descriptor walks; one held across a recycle
1066
+ correctly goes stale. Pinned by the existing
1067
+ "forEach* descriptors carry id and are re-walkable" test.
1068
+ - **Effect dispose handles are now first-class introspection handles.** On
1069
+ every prior version, `effect()` returned a bare closure carrying neither
1070
+ `NODE_PTR` nor `NODE_GEN` -- so `describe` / `nodeId` / `forEachSource`
1071
+ returned `undefined`/empty for a **live** effect handle, and
1072
+ `observeObservers(effectHandle)` threw. The dispose function is now stamped
1073
+ with the same symbol pair as signal/computed handles (`NODE_GEN` mirrors the
1074
+ disposer's own `birthGen`, so introspection validity agrees exactly with its
1075
+ stale-guard). After explicit dispose, slot recycle, or owner-cascade the
1076
+ handle correctly reads stale. Measured cost: two property stores per effect
1077
+ creation (~50 ns on a create/dispose churn microbench) -- symmetric with
1078
+ what signal/computed handles already pay, create-path only. Found by the
1079
+ lite-devtools 1.1 cross-probe campaign (`track(effectHandle)` threw).
1080
+ - `peek()` had the same hole: `sharedSignalPeek` / `sharedComputedPeek`
1081
+ resolved the slot ungated, so a stale handle's `peek()` returned the new
1082
+ resident's value. Both now gen-check first and return `undefined` when
1083
+ stale -- closing the last unguarded entry point in the probe-c1 ABA family.
1084
+ Measured cost: 4M peeks 7.1 -> 7.4 ms (~0.08 ns/op).
1085
+
1086
+ ### Added -- `onGraphMutation(fn)`: the graph-mutation hook
1087
+ - Registry-level (and default-registry module export) debug hook, the
1088
+ connection point for push-based tooling. Single nullable listener; every
1089
+ fire point is one `if (mutationHook !== null)` branch and the dispatch is
1090
+ allocation-free -- `(opcode, intA, intB)`:
1091
+ - `1` node create -- `(id, flags)`, end of `createNode`
1092
+ - `2` node dispose -- `(id, flags)`, top of `disposeNode` (cascades included)
1093
+ - `3` link add -- `(source.id, target.id)`
1094
+ - `4` link remove -- `(source.id, target.id)`
1095
+ - `5` recompute -- `(id, 0)`, before an effect re-run / computed re-eval
1096
+ - Cost: **zero when unregistered** (hot-path gate flat); registered, the
1097
+ worst case measured is +29% on a dynamic-retracking torture loop (11.4M
1098
+ events for 400K writes) -- a debug-mode tax paid only while a consumer is
1099
+ attached, proportional to event volume.
1100
+ - **Listener contract: observe only -- never throw, never mutate the graph.**
1101
+ The hook fires synchronously inside mutation points; lite-devtools 1.1
1102
+ multiplexes all of its consumers behind one registration, isolates their
1103
+ exceptions, and unregisters when the last consumer stops (returning the
1104
+ engine to the zero-cost state). `onGraphMutation` returns an unsubscribe
1105
+ that restores the previously registered listener.
1106
+
1107
+ ### Added -- owner-tree introspection: `forEachOwned` / `ownerOf`
1108
+ - The 1.2.0 owner tree finally gets a (read-only, gen-guarded) window:
1109
+ `forEachOwned(handle, fn)` iterates a node's owned children as standard
1110
+ re-walkable descriptors; `ownerOf(handle)` returns the owner's descriptor
1111
+ or `undefined` (top-level or stale). Same descriptor conventions as
1112
+ `forEachObserver` / `forEachSource`; garbage input is a no-op /
1113
+ `undefined`. This is what lite-devtools 1.1 builds `ownerTree()` and the
1114
+ `graph({owners: true})` ownership edges on
1115
+ (`capabilities().owners === true` from this release).
1116
+
1117
+ ### Compatibility
1118
+ - No behavioural change for live handles; stale handles now read as stale
1119
+ everywhere instead of as the slot's next tenant. Allocation strategy is
1120
+ unobservable through the public API. Tooling floor: lite-devtools >= 1.1.0
1121
+ detects `onGraphMutation` / `forEachOwned` at load and degrades to its
1122
+ 1.0 polling behaviour on older engines.
1123
+
1124
+ ## [1.2.0] -- 2026-06-11
1125
+
1126
+ A structural refactor that internally splits the engine into three named layers
1127
+ (graph topology / ownership-lifecycle / propagation-execution) with a strict
1128
+ dependency direction, plus a small set of additive features built on top of
1129
+ that split. No behavioural changes for existing code -- drop-in over 1.1.5.
1130
+
1131
+ ### Added -- auto-disposal of nested observers (owner tree)
1132
+ - An effect or computed that creates **observers** (nested `effect`/`computed`)
1133
+ now owns them via an internal owner tree. When the owner re-runs or is
1134
+ disposed, all owned observers are cascade-disposed before the new run starts.
1135
+ This is what closes the long-standing "nested effects leak on re-run" hazard
1136
+ that other engines fix with `createRoot` wrappers.
1137
+ - **Plain signals are deliberately NOT owner-adopted.** Lazy-allocation
1138
+ wrappers (`lite-store` allocates a key's signal on first read, `lite-form`
1139
+ allocates lazy fields the same way) depend on a lazily-created signal
1140
+ surviving its allocating computed's re-runs. The rule is:
1141
+ *observers cascade with the owner; signals do not.* Locked in by 5 tests in
1142
+ `test/15-owner-lazy-alloc.test.mjs` (the lite-store cross-wire shape) and
1143
+ the new `test/19-v12-additions.test.mjs`.
1144
+
1145
+ ### Added -- pre-batch revert (the "set X, set X back" optimisation)
1146
+ - Inside a `batch(...)`, if a signal is set and then set back to its
1147
+ pre-batch value (under the signal's own `equals`), the version bump is
1148
+ reverted and downstream effects/computeds do **not** fire. Eliminates a
1149
+ whole class of "spurious re-run from a temporary mutation" patterns common
1150
+ in form state and undo/redo. Verified end-to-end (signal, computed, effect)
1151
+ in `test/19-v12-additions.test.mjs`.
1152
+
1153
+ ### Added -- multi-effect throws aggregate to `AggregateError`
1154
+ - When two or more effects throw in the **same flush pass**, the engine
1155
+ collects all errors and rethrows a native `AggregateError` at the
1156
+ triggering `set()` / batch boundary. A single thrown error is rethrown
1157
+ unwrapped (no change). Effects that don't throw still run. Cycle detection
1158
+ unchanged -- a flush exceeding `maxFlushPasses` (default 100) throws an
1159
+ `Error` prefixed `"CycleError:"`.
1160
+
1161
+ ### Added -- scheduler thunk caching with gen-bound ABA guard
1162
+ - `effect(fn, { scheduler })` now caches the scheduler thunk on the node
1163
+ itself (`node.schedulerThunk`) so repeated re-schedules reuse the same
1164
+ closure (no allocation per re-schedule). The thunk holds a generation snapshot
1165
+ taken at effect creation: after `dispose()` the engine bumps the node's
1166
+ generation, so a stale thunk fired by an async scheduler against a recycled
1167
+ pool slot is a guaranteed no-op (ABA safe).
1168
+
1169
+ ### Changed -- internal refactor, no behavioural difference
1170
+ - The engine is reorganised into three explicit layers with documented
1171
+ invariants (see the file header in `Signal.js`):
1172
+ - **L1 Graph topology** -- `allocateLink` / `freeLink` / `severTail`. Pure
1173
+ edge mechanics. Never touches `owner` / `firstOwned`.
1174
+ - **L2 Ownership/lifecycle** -- `createNode` / `disposeNode` / `runCleanup`.
1175
+ Owns the owner tree and user cleanup. Never touches the tracking cursor.
1176
+ - **L3 Propagation/execution** -- `markDownstream` (cursor-free), and the
1177
+ orchestrators `executeEffect` / `pullComputed` that drive the cursor
1178
+ (L1) and call `runCleanup` (L2) before a re-run.
1179
+ - `currentObserver` and `currentOwner` are now distinct pointers. Today they
1180
+ move together (no behavioural change), but the split paves the way for
1181
+ future `runWithOwner`/`createRoot` without coupling tracking and lifecycle.
1182
+ - **Shared `peek` (perf).** `signal()` and `computed()` now reuse a single
1183
+ `peek` function per registry instead of allocating a fresh closure per
1184
+ primitive. Equivalent across registries (each registry has its own pair).
1185
+ ~10-14% faster signal/computed creation on the `S:create*` micros, no
1186
+ hot-path or behavioural change. Verified by 5 dedicated tests + the full
1187
+ 309-strong existing suite + 30,000-write differential retracking fuzz vs
1188
+ the published 1.1.5.
1189
+
1190
+ ### Changed -- port-forward of the 1.1.3/1.1.4 perf fixes
1191
+ - `pullComputed` retains the **`markEpoch` clean short-circuit** -- re-reading
1192
+ a computed after an unrelated source changed is O(1).
1193
+ - `allocateLink` retains the **O(1) `tailSub` dedup** -- divergent re-tracking
1194
+ remains O(N), not O(N^2). The same documented edge note applies: a nested
1195
+ re-read of the same source after an intervening observer can retain one
1196
+ duplicate link per intervening edge, bounded by the loop count and
1197
+ dispose-reclaimed.
1198
+
1199
+ ### Fixed -- conformance regressions surfaced during release prep
1200
+ - **#141 (`dispose during execution then continue: no re-run`)**: an effect that
1201
+ called its own dispose handle mid-run and then continued to read another
1202
+ signal would corrupt the link-list bookkeeping in `severTail` (latent crash
1203
+ present in 1.1.5 too -- the v1.2 owner tree exercised the path more
1204
+ aggressively and made it visible). Fixed by nulling the tracking cursor in
1205
+ `disposeNode` when the disposed node is the active observer, plus a
1206
+ gen-snapshot guard in `executeEffect` / `pullComputed` so a post-body
1207
+ `severTail` on a recycled slot is skipped.
1208
+ - **#238 / #241 / #243 (cleanup ordering)**: nested effect cleanups must fire
1209
+ inside-out on owner-tree disposal -- grandchild before child before outer.
1210
+ The previous `runCleanup` ran the node's OWN cleanup before cascading, which
1211
+ surfaced on cascade-dispose, on owner re-run, AND on the regression path
1212
+ where an inner-only re-run had fired first. Fixed by swapping the order:
1213
+ cascade children first, then own. Matches React / Solid (children may rely
1214
+ on parent state being live at cleanup time; never the reverse).
1215
+ - Permanent regression guards for all four landed in
1216
+ `test/20-axis-stress.test.mjs` under "Conformance pins" (7 new tests across
1217
+ two suites; includes a BONUS test for the re-run cascade path which has the
1218
+ same invariant).
1219
+
1220
+ ### Test suite (released numbers)
1221
+ - 363 tests / 133 suites total, all passing under `node --expose-gc --test`.
1222
+ - **100% line coverage** and **98.62% branch coverage** on `Signal.js`
1223
+ + `Watch.js` (the few uncovered branches are defensive guards: cycle
1224
+ detection, batchEpoch wraparound after 2^3^2 batches, and the self-dispose
1225
+ `gen` branches added by the conformance fixes -- unreachable from
1226
+ conformance + existing user code).
1227
+ - New file `test/19-v12-additions.test.mjs` (24 tests) locks in shared peek,
1228
+ owner adoption rule, pre-batch revert, AggregateError aggregation,
1229
+ CycleError detection, the `maxLinks` config branch, the disposed-signal
1230
+ read/set behaviour, and the stop-fn ABA guard.
1231
+ - New file `test/20-axis-stress.test.mjs` (23 tests) -- eight orthogonal
1232
+ engine-invariant "axes" plus the permanent conformance pins for #141,
1233
+ #238, #241, #243.
1234
+ - Existing `test/15-owner-lazy-alloc.test.mjs` skips ("scheduler-thunk
1235
+ caching lands in v1.2.0") are removed -- the owner tree exists, the
1236
+ tests pass.
1237
+ - Differential retracking fuzz against the published 1.1.5: 30,000 writes,
1238
+ **0 disagreements** (`bench/retracking.difftest.mjs`).
1239
+
1240
+ ### Notes for users
1241
+ - **Drop-in.** No public surface removed. Behaviour identical to 1.1.5 except
1242
+ for: (i) the owner-cascade auto-dispose of nested observers (was: leaked),
1243
+ (ii) the pre-batch revert (was: always fired even if reverted), and
1244
+ (iii) multi-throw aggregation. (i) and (ii) are silent wins; if you
1245
+ previously caught the first thrown effect in a flush, you now get an
1246
+ `AggregateError` whose `.errors[0]` is what you used to get.
1247
+ - The "scheduler-thunk caching" hint that referenced an older internal
1248
+ staging name (Signal-1.3.0-rc) is gone; the file is the public 1.2.0.
1249
+
1250
+ ## [1.1.5] -- 2026-06-04
1251
+
1252
+ Additive release in service of `@zakkster/lite-devtools`: stable node identity on the
1253
+ introspection surface, so a tool can dedupe and traverse the full reactive DAG. Drop-in
1254
+ over 1.1.4, no breaking changes.
1255
+
1256
+ ### Added -- node identity (top-level + per-registry)
1257
+ - `nodeId(handle)` -> the node's stable per-allocation id (`number`), or `undefined` for a
1258
+ non-handle. The dedupe key for graph walks.
1259
+ - `describe(handle)` -> the handle's own `{ id, kind, value }` descriptor, or `undefined`
1260
+ for a non-handle. **Re-walkable**: the descriptor may be passed back into
1261
+ `forEachObserver`/`forEachSource` -- the recursion primitive for full DAG discovery.
1262
+ - `forEachObserver`/`forEachSource` descriptors now carry `id` (`{ id, kind, value }`).
1263
+ - Every node gains a stable `id` assigned at allocation: one SMI write at creation, node
1264
+ shape kept uniform (monomorphic). **Zero steady-state cost.**
1265
+
1266
+ ### Test suite
1267
+ - Added `test/15-identity_test.mjs`: 5 tests -- ids unique + stable, `nodeId`/`describe`
1268
+ undefined on non-handles, descriptor shape `{ id, kind, value }`, descriptors re-walkable,
1269
+ identity walks non-perturbing.
1270
+
1271
+ ## [1.1.4] -- 2026-05-31
1272
+
1273
+ Combined release: a retracking rewrite that closes the two documented chaotic
1274
+ read-order limitations, plus an observer-lifecycle introspection surface. No
1275
+ breaking changes, no public-API removals -- drop-in over 1.1.3. (This release
1276
+ folds in the work that was internally staged as 1.1.4 and 1.1.5; it ships as a
1277
+ single 1.1.4.)
1278
+
1279
+ ### Changed -- performance (retracking, no semantic change)
1280
+ - **Version-stamped O(1) reconciliation + clean-read short-circuit.** The cursor
1281
+ reconciliation now stamps each source per evaluation and a `markEpoch` guard
1282
+ short-circuits the pull when a subtree is already clean. This replaces the
1283
+ prior strategy's O(N)-per-dep degradation under chaotic, high-fan-in, batched
1284
+ read-after-write (every read re-validating its dependency subtree). Stable
1285
+ read order is unchanged -- still O(1) per dep via cursor reuse, still zero-alloc.
1286
+ - **Result.** The two rows that were the documented v1.1.x limitation flipped from
1287
+ multiples-behind to ahead of `alien-signals`, and are now the fastest of the five
1288
+ benchmarked frameworks:
1289
+ - `dyn: large web app` 6194ms -> **571ms** (~10.9× faster; +9% vs alien)
1290
+ - `dyn: wide dense` 5115ms -> **912ms** (~5.6× faster; +10% vs alien)
1291
+ No regressions on the other rows (steady-state update, propagation, and creation
1292
+ paths are within noise of 1.1.2). See `resultsReactive.txt`.
1293
+ - **Correctness.** The new retracking is validated by `retracking.difftest.mjs`
1294
+ against a reference reconciler: 20,000 direct writes and 10,000 batched writes,
1295
+ **0 disagreements**.
1296
+
1297
+ ### Added -- observer-lifecycle introspection (top-level + per-registry)
1298
+ A small, zero-cost-when-unused surface for auto-pausing wrappers and devtools.
1299
+ All accept a public `Signal`/`Computed` handle.
1300
+ - **`hasObservers(handle)` -> `boolean`.** O(1) (`node.headSub !== null`). The
1301
+ auto-pause predicate: is anything subscribed to this source right now? A `peek`
1302
+ does not count.
1303
+ - **`observeObservers(handle, { onConnect?, onDisconnect? })` -> `unobserve`.**
1304
+ Fires `onConnect` on the 0->1 observer transition and `onDisconnect` on 1->0,
1305
+ *after* registration (transition-only -- no immediate fire if the handle is
1306
+ already observed). Re-tracking a persistently-read source does **not** churn
1307
+ connect/disconnect. This is the hook `lite-time` / `lite-raf` use to start a
1308
+ ticker only while a derived value is being watched.
1309
+ - **`forEachObserver(handle, fn)` / `forEachSource(handle, fn)`.** Walk the live
1310
+ graph in either direction; `fn` receives a `{ kind, value }` descriptor where
1311
+ `kind` is `"signal" | "computed" | "effect"`. For graph inspection (lite-devtools).
1312
+ - **Cost.** The hooks sit behind an internal lifecycle counter -- when no handle is
1313
+ being observed, the hot path adds a single branch-predicted `count !== 0` check
1314
+ inside link alloc/free and nothing else. Zero steady-state cost when unused.
1315
+ - **Error contract.** `hasObservers` / `forEachObserver` / `forEachSource` no-op
1316
+ on a non-handle argument; `observeObservers` throws `TypeError`.
1317
+
1318
+ ### Test suite
1319
+ - Added `test/13-introspection_test.mjs`: 10 tests across 3 describe blocks --
1320
+ `hasObservers` (live observation reflects, peek doesn't count), `observeObservers`
1321
+ auto-pause lifecycle (start-on-first/stop-on-last, no extra connect for a 2nd
1322
+ observer, re-observe fires again, no churn on re-track, conditional reads toggle
1323
+ honestly, transition-only registration, works for computeds), and
1324
+ `forEachObserver`/`forEachSource` enumeration (both directions, descriptor carries
1325
+ kind + value).
1326
+
1327
+ ### Migration from 1.1.3
1328
+ None required. Drop-in upgrade. No existing surface or behavior changed; the
1329
+ introspection functions are purely additive and the retracking change is internal.
1330
+
1331
+ ## [1.1.3] -- 2026-05-28
1332
+
1333
+ Patch release: one new export, no behavior changes, no engine changes -- drop-in
1334
+ over 1.1.2.
1335
+
1336
+ ### Added
1337
+ - **`isTracking()`** (top-level + per-registry). Returns `true` iff a read RIGHT
1338
+ NOW would record a dependency on this registry -- an observer body is on the
1339
+ stack AND tracking is enabled. Returns `false` inside `untrack()`, inside the
1340
+ callback of `signal.subscribe` (which inlines the same untracked-notify), inside
1341
+ `onCleanup` bodies, inside the `watch` / `when` callback path, and outside any
1342
+ observer. The predicate mirrors the engine's own read-trap check
1343
+ (`isTrackingDeps && currentObserver !== null`) so callers stay in lockstep with
1344
+ what the engine actually does on a read, not just whether an observer is on the
1345
+ stack.
1346
+
1347
+ ### Why
1348
+ Wrapper libraries (lite-store, lite-query, lite-form) need to allocate reactive
1349
+ primitives lazily on property reads to preserve the zero-GC contract. Without a
1350
+ predicate they must either always allocate (defeats the point) or inspect engine
1351
+ internals (fragile coupling). `isTracking()` is the first-class way to gate
1352
+ allocation on whether the read will actually subscribe anything.
1353
+
1354
+ ### API notes
1355
+ - **Per-registry.** A wrapper operating against a non-default registry MUST call
1356
+ THAT registry's `isTracking()`, not the top-level one -- each registry has its
1357
+ own tracking state. The top-level helper delegates to the default registry,
1358
+ matching the existing pattern for `signal`/`computed`/`effect`/`untrack`.
1359
+ - **Cost.** Two closure-variable loads, one AND, one return; V8 inlines it.
1360
+ Roughly 1-2 ns per call.
1361
+
1362
+ ### Test suite
1363
+ - Added `test/10-is-tracking_test.mjs`: 11 tests across 5 describe blocks --
1364
+ observer-bodies (effect + computed), untracked windows (`untrack`, `subscribe`
1365
+ callback, `onCleanup`, `watch` callback), outside-observer (module scope,
1366
+ call-site of unobserved computed read), robustness (state restored after
1367
+ observer body throws, per-registry isolation), and the top-level binding.
1368
+
1369
+ ### Migration from 1.1.2
1370
+ None required. Drop-in upgrade. No existing surface or behavior changed.
1371
+
1372
+ ## [1.1.2] -- 2026-05-26
1373
+
1374
+ Patch release: hot-path micro-optimizations and a zero-allocation cleanup of
1375
+ the creation path. No behavior changes, no API changes -- drop-in over 1.1.1.
1376
+
1377
+ ### Changed -- performance (no semantic change)
1378
+ - **Inlined cursor fast-path in `signal()`/`computed()` reads.** On stable read
1379
+ order the cursor match is now handled inline; only a cursor *miss* falls
1380
+ through into the (large, non-inlinable) `allocateLink` frame. Removes a
1381
+ function call from the steady-state read hot path.
1382
+ - **Allocation-free creation.** `signal`/`computed`/`effect` now read their
1383
+ `opts` argument defensively instead of defaulting the parameter to `{}`. The
1384
+ `= {}` default allocated a throwaway object on every no-opts call -- the common
1385
+ path when mounting many cells. Creation is now zero-allocation on that path.
1386
+ - **Single-closure `subscribe`.** The tracked read + untracked notify is inlined
1387
+ (one closure instead of two), dropping a per-subscription closure and an
1388
+ `untrack` wrapper call on every fire.
1389
+ - **`markDownstream` micro-cleanup.** Combined `(FLAG_QUEUED | FLAG_COMPUTING)`
1390
+ test and tightened stack/queue index arithmetic. The `flags` read stays inside
1391
+ the `markEpoch` dedup guard on purpose (hoisting it would add work on the
1392
+ already-marked revisit path that the guard exists to keep cheap).
1393
+
1394
+ ### Changed -- packaging
1395
+ - Canonical single-engine layout: the implementation is `Signal.js` and the
1396
+ watcher utilities are `Watch.js`, which imports `effect`/`untrack` from
1397
+ `./Signal.js`. Both the public entry and `Watch.js` resolve to one engine
1398
+ instance -- eliminating any chance of a duplicate-module-instance split that
1399
+ would silently break cross-module dependency tracking.
1400
+
1401
+ ### Test suite
1402
+ - `tests/09-conformance.test.mjs`: the owner-tree conformance items **#209** and
1403
+ **#210** (three-level cascading disposal; inner-effect cleanup on outer re-run)
1404
+ are marked skipped with a v1.2 pointer. The baseline engine maintains no owner
1405
+ tree; these are validated against the v1.2 ownership hybrid. All other
1406
+ conformance items pass.
1407
+
1408
+ ### Performance
1409
+ - Steady-state hot path remains **0 allocations** (`signal.set`, `peek`, computed
1410
+ read, effect re-run, dispose). Creation path now also 0-allocation on the
1411
+ no-opts common case. Re-run `npm run bench` on your target host for current
1412
+ ops/s; the 1.1.1 numbers stand as a floor.
1413
+
1414
+ ### Migration from 1.1.x
1415
+ None required. Drop-in upgrade.
1416
+
1417
+ ## [1.1.1] -- 2026-05-22
1418
+
1419
+ Patch release: cleanup-semantics adapter integration, conformance fixes from
1420
+ the `johnsoncodehk/reactive-framework-test-suite`, and one targeted
1421
+ correctness bug in flush error reporting.
1422
+
1423
+ ### Added
1424
+ - Top-level `destroy()` export. Wipes the default registry; intended for
1425
+ test-suite isolation only. Previously the function existed but was not
1426
+ re-exported from the package entrypoint, breaking any adapter that
1427
+ destructure-imports it.
1428
+ - `tailSub` field on `ReactiveNode`. Symmetric with the existing `tailDep`;
1429
+ enables O(1) tail insertion into the subscriber list.
1430
+
1431
+ ### Changed -- conformance fixes
1432
+
1433
+ - **#216** Effects now fire in **creation order** on a shared signal.
1434
+ Subscriber list insertion is tail-first instead of head-first; traversal
1435
+ order in `markDownstream` is unchanged. Brings lite-signal in line with
1436
+ every other library in the suite except solid-js and pota.
1437
+
1438
+ - **#178** `runCleanup` invokes registered cleanups in an **untracked
1439
+ context** (`currentObserver = null`, `isTrackingDeps = false`). Reads
1440
+ inside a cleanup body -- including reads triggered by a synchronous
1441
+ `dispose()` from a containing effect -- no longer leak into the parent
1442
+ observer's dep set.
1443
+
1444
+ - **#111** `executeEffect` bails cleanly when a node is disposed by its own
1445
+ cleanup. Previously the post-cleanup body invocation hit `undefined()` on
1446
+ the cleared `computeFn`.
1447
+
1448
+ - **#123 / #132 / #147** **Revert detection in batches.** A signal whose
1449
+ in-batch write sequence ends at the pre-batch value (per its `equals`
1450
+ predicate) restores its `version` and skips propagation. Captures are
1451
+ scoped per top-level batch via a `revertEpoch` counter; the `0` sentinel
1452
+ is preserved through SMI wraparound by skipping it on increment.
1453
+
1454
+ - **#121** **Throw isolation in flush.** Effects that throw during
1455
+ `flushEffects` no longer halt the flush. Errors are collected in a
1456
+ reused per-registry buffer; on flush completion, a single thrown error
1457
+ re-raises as-is, multiple throws raise as `AggregateError`. `isFlushing`
1458
+ is now cleared in a `try/finally`, eliminating the registry-deadlock
1459
+ that the prior throw-out path would leave behind.
1460
+
1461
+ - **#180 / #213** **No-re-run semantics for self-cycles.** An effect that
1462
+ is currently executing on the call stack is no longer re-queued by
1463
+ `markDownstream` when its own body's writes propagate back through a
1464
+ computed chain. Matches S.js / pre-2.0 Solid. Sibling effects on the
1465
+ same chain continue to fire normally.
1466
+
1467
+ ### Fixed
1468
+ - Flush error buffer no longer leaks across calls when a `CycleError`
1469
+ escapes the flush loop. Buffered effect errors are cleared in the
1470
+ outer `finally` if the flush is exiting abnormally.
1471
+
1472
+ ### Performance
1473
+ - No regressions observed in MUX, BROADCAST, DEEP CHAIN, KAIROS, or
1474
+ SELECTIVE DAG benchmarks. MUX moved from 156K to 226K ops/s -- V8 appears
1475
+ to optimise the flush loop more aggressively now that the per-iteration
1476
+ `try/catch` shape is stable. Out-of-batch `signal.set` is unchanged
1477
+ (revert-detection guards short-circuit on `batchDepth === 0`).
1478
+
1479
+ ### Conformance score
1480
+ - Before 1.1.1: 145 / 156 (with v1.1.0 adapter pre-fix), 164 / 177
1481
+ (corrected adapter, no library fixes).
1482
+ - After 1.1.1: TBD pending full conformance re-run. Expected: all
1483
+ Tier 1 + Tier 2 items closed (#216, #178, #111, #123, #132, #147, #121,
1484
+ #180, #213, #235), leaving `#179`, `#209`, `#210` deferred to v1.2
1485
+ (owner-tree / computed-self-write).
1486
+
1487
+ ### Internal test suite
1488
+ - Added `tests/09-conformance.test.mjs` collecting the upstream test IDs
1489
+ by number, with companion tests pinning the design decisions
1490
+ (sibling-effect propagation under no-re-run, cycle precedence over
1491
+ buffered errors, custom-equals revert, etc.).
1492
+
1493
+ ## [1.1.0] -- 2026-05-20
1494
+
1495
+ ### Added
1496
+ - `markDownstream` iterative DFS marker backed by preallocated `markStack` -- propagation no longer grows the JS call stack regardless of graph depth.
1497
+ - Double-buffered effect queue (`effectQueueA` / `effectQueueB`) -- effects scheduled mid-flush land in the next pass, no recursive flush.
1498
+ - Generation counter (`gen`) per node -- stale handles after dispose+recycle silently no-op instead of corrupting the pool.
1499
+ - `CapacityError` with `kind` (`"nodes"` | `"links"`) and `capacity` fields, thrown when the `"throw"` policy is set and a pool is exhausted.
1500
+ - `createRegistry({ onCapacityExceeded: "grow" })` -- opt-in unbounded pool growth, bounded by `maxLinks * 16` ceiling.
1501
+ - `createRegistry({ maxFlushPasses })` -- configurable cycle-protection limit (default `100`).
1502
+ - `destroy()` -- full registry reset; all prior handles silently no-op afterward.
1503
+ - `watch(source, callback, { immediate? })`, `when(predicate, callback)`, `whenAsync(predicate)` -- re-exported from `Watch.js`. Zero-allocation hot paths in `watch` and `when`; `whenAsync` allocates one Promise per call (documented; not for per-frame use).
1504
+
1505
+ ### Changed
1506
+ - 32-bit modular epoch arithmetic across `globalVersion`, `evalVersion`, `markEpoch`. Engine survives indefinite uptime without integer-overflow risk.
1507
+ - `dispose(api)` is now universal across signals, computeds, effect handles, and `.subscribe()` return values. Cross-registry calls are silent no-ops. Foreign reactive primitives are duck-typed (on `.peek`) and not invoked.
1508
+ - `untrack(fn)` restores prior tracking state via `try / finally` -- safe under thrown errors inside `fn`.
1509
+ - `onCleanup(fn)` now accepts multiple registrations per scope and works in computeds, not just effects. Stored as a single function or upgraded to an array.
1510
+
1511
+ ### Fixed
1512
+ - Diamond dependency reads no longer over-fire effects (versioned pull resolves convergence cleanly in one pass).
1513
+ - Effect re-runs no longer leak link slots when the dep set shrinks (tail-link severance in `severTail`).
1514
+ - Disposed-then-recycled slots no longer mis-dispose under stale handles (generation guard in `dispose`).
1515
+ - Cleanup functions registered inside computeds now fire (previously effect-only).
1516
+
1517
+ ### Performance
1518
+ - Steady-state hot path: **0 allocations** across `signal.set`, `signal.peek`, computed read, effect re-run, dispose.
1519
+ - **249K ops/s** on MUX fan-in (Node 22, 2016 MacBook Pro). +20% vs alien-signals on identical workload.
1520
+ - **15 KB** transient heap across 20,000 iterations.
1521
+ - Full methodology and reproducibility recipe in [`bench/README.md`](./bench/README.md).
1522
+
1523
+ ### Known limitations
1524
+ - Dependency reconciliation is O(1) per read on stable read order; degrades to O(N) under chaotic read order. v1.2 (in benchmark validation) replaces the cursor-based retracking with per-source version-stamped reconciliation -- see [RFC #N1](https://github.com/PeshoVurtoleta/lite-signal/issues/1).
1525
+ - Computed resolution is recursive on the JS call stack; bounded by the engine stack limit (~10,000 frames).
1526
+ - `whenAsync` allocates one Promise per call. Use `when` (callback form) for per-frame paths.
1527
+
1528
+ ### Migration from 1.0.x
1529
+ None required. Drop-in upgrade.
1530
+
1531
+ ## [1.0.0] -- 2026-05-12
1532
+ Initial public release.