@zakkster/lite-signal 1.4.0-rc.1 → 1.4.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.
Files changed (5) hide show
  1. package/CHANGELOG.md +211 -10
  2. package/README.md +118 -47
  3. package/Signal.js +30 -2
  4. package/llms.txt +63 -44
  5. package/package.json +10 -6
package/CHANGELOG.md CHANGED
@@ -4,6 +4,202 @@ All notable changes to `@zakkster/lite-signal` are documented here.
4
4
  Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
  This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [1.4.1] -- 2026-07-21
8
+
9
+ The verification-surface patch. **The engine is unchanged**: the only edit to
10
+ `Signal.js` is the version string in its header banner, and `Signal.d.ts` is
11
+ untouched. Everything here lives in `bench/torture/`, which does not ship --
12
+ `files[]` excludes it. If you consume the package, 1.4.1 is byte-for-byte 1.4.0
13
+ plus a version number.
14
+
15
+ What changed is what the repo can *prove* about that engine. The torture
16
+ directory used to answer two questions -- did anything throw, and did the pool
17
+ come back -- and both are liveness questions. Neither reads a value and asks
18
+ whether it is right. This release adds five scenarios that assert on meaning,
19
+ and fixes the three existing soaks, which had been lying in small ways.
20
+
21
+ ### Added -- five semantic torture scenarios
22
+
23
+ The three pre-1.4.1 soaks (`graph-fuzzer`, `scheduler-bench`, `torture-soak`)
24
+ pass green on an engine whose computeds return stale values. That is not a
25
+ hypothesis. Flipping the clean short-circuit in `pullComputed` from `<= 0` to
26
+ `<= 1` -- a one-character edit, exactly the shape a perf tweak makes -- keeps the
27
+ pool perfectly balanced, throws nothing, and all three soaks report PASS. The
28
+ new scenarios exist to close that gap.
29
+
30
+ - **`oracle-fuzzer.mjs`** -- differential correctness. Drives a random DAG and,
31
+ after every operation, compares **every** computed against an independent
32
+ reference evaluator that recomputes from the leaves with no caching, no
33
+ versioning and no short-circuit. The reference shares no code with the engine,
34
+ so a bug in the engine's invalidation cannot hide in the oracle too. Node
35
+ shapes cover static fan-in (`sum`), dynamic dependency sets (`select`, which
36
+ reads a selector then exactly one dep, so the source set moves between
37
+ evaluations), and value passthrough (`identity`, which preserves `-0` and `NaN`
38
+ where a `sum` would normalise them away). Failures print the seed and a
39
+ minimised operation log so they replay.
40
+ - **`glitch-hunter.mjs`** -- glitch freedom across diamond topologies plus exact
41
+ wakeup accounting. An engine may not expose an intermediate state in which two
42
+ branches of a diamond disagree about which epoch they reflect.
43
+ - **`work-accounting.mjs`** -- minimum body-execution counts across 10 fixed
44
+ topologies. Pins that the engine does *exactly* the necessary work: no
45
+ recompute of an unaffected node, and no skipped recompute of an affected one.
46
+ Both directions fail loudly.
47
+ - **`concurrent-storm.mjs`** -- reentrancy, nesting and flush ordering against
48
+ eight documented contracts: self-write termination, mutual A->B->A loops
49
+ tripping `CycleError` rather than hanging, nested batches flushing only at the
50
+ outermost boundary, effects scheduled *by* a pass draining in the *next* pass,
51
+ writes and reads inside cleanup, dispose-mid-flush, self-disposal from inside
52
+ a body, and async writes interleaved with flushes.
53
+ - **`scheduler-storm.mjs`** -- deferred-execution hazards under saturation. The
54
+ cached `schedulerThunk` is gen-bound; `dispose` bumps `gen`, so a `run` the
55
+ scheduler is still holding must become a silent no-op and must **not** fire the
56
+ new resident once that pool slot is recycled. That is a textbook ABA hazard and
57
+ the guard is one `===` away from being wrong. Also pins that `FLAG_QUEUED` is
58
+ cleared only inside `executeEffect` (which is what makes a microtask scheduler
59
+ coalesce N writes into one run), and that a throwing scheduler does not take
60
+ the rest of the flush pass down with it.
61
+
62
+ Where no contract is documented, these files **pin the observed behaviour** and
63
+ say so at the scenario, rather than asserting an invented one.
64
+
65
+ #### Measured discrimination
66
+
67
+ Each scenario was validated by mutating the engine and confirming the scenario
68
+ fails, then restoring. Recorded because a torture suite nobody has mutation-
69
+ tested is decoration:
70
+
71
+ | mutant | caught by | missed by |
72
+ | ------ | --------- | --------- |
73
+ | `pullComputed` short-circuit `<= 0` -> `<= 1` | oracle-fuzzer (400/400 seeds), glitch-hunter, work-accounting | all three legacy soaks |
74
+ | drop `node.gen === gen` from the cached thunk | scheduler-storm | **the entire 405-test unit suite** |
75
+ | `batch` flushing at every boundary, not the outermost | concurrent-storm | -- (unit suite catches it too) |
76
+
77
+ The ABA row is the reason this release exists: 405 unit tests pass on an engine
78
+ whose stale thunks fire into recycled pool slots.
79
+
80
+ ### Added -- one entry point, two groups
81
+
82
+ `bench/torture/run.mjs` replaces the ad-hoc shell loops people were writing
83
+ around six separate `node --expose-gc bench/torture/<file>.mjs` invocations.
84
+
85
+ ```bash
86
+ npm run torture # everything
87
+ npm run torture:semantic # correctness only, ~10s, CI-shaped
88
+ npm run torture:soak # resource soaks only
89
+ node bench/torture/run.mjs --list
90
+ node bench/torture/run.mjs --seconds 30 --bail
91
+ node bench/torture/run.mjs oracle glitch # substring match on names
92
+ ```
93
+
94
+ Scenarios are split into **`semantic`** (deterministic, fast, assert on meaning
95
+ -- belong in CI on every commit) and **`soak`** (wall-clock bound, assert on
96
+ resources -- belong in a nightly or pre-publish job). Each scenario stays a
97
+ standalone executable module, and the runner **spawns them as child processes**
98
+ rather than importing them. That is deliberate: several assert on global pool
99
+ accounting and on the default registry, so running two in one process would let
100
+ the first one's residue poison the second's baseline. Process isolation is the
101
+ only thing that makes those assertions mean anything.
102
+
103
+ `--expose-gc` is passed by the runner unconditionally. It is not optional:
104
+ several scenarios force collection to settle finalizers, and without it they
105
+ would silently degrade to asserting nothing rather than failing loudly.
106
+
107
+ ### Added -- shared torture infrastructure
108
+
109
+ `bench/torture/helpers/index.mjs` collects what every soak had grown its own
110
+ copy of: the seeded `mulberry32` PRNG (so a failure replays from its seed
111
+ alone), the `soakRegistry` / `fixedRegistry` constructors, and `createReport`,
112
+ which **collects failures instead of throwing on the first one** -- torture
113
+ output is read once, usually in CI, and "fix, rerun, discover the next one" is a
114
+ slow loop.
115
+
116
+ It also holds `VALUE_POOL`, the adversarial value domain. An earlier draft of
117
+ the oracle used integers only, and a mutant that swapped the default equality
118
+ from `Object.is` to `==` sailed straight through, because on integers the two
119
+ agree. The pool now contains the pairs where the candidate definitions
120
+ disagree: `Object.is` vs `===` differ on `NaN` and on `-0`/`0`; `===` vs `==`
121
+ differ on `0`/`""`/`false`/`"0"` and `null`/`undefined`. Equality decides whether
122
+ a write propagates at all, so it has to be fuzzed with values that can tell the
123
+ definitions apart.
124
+
125
+ The module is deliberately dependency-free and side-effect-free: importing it
126
+ must not touch the default registry, or an import would quietly allocate and
127
+ poison the pool baselines the scenarios assert on.
128
+
129
+ ### Fixed -- the soaks printed `impossible` on a healthy run
130
+
131
+ All three legacy soaks used a magic-constant guard as a JIT sink
132
+ (`if (acc === 1234567) console.log("impossible")`) to stop V8 eliminating the
133
+ accumulator loops that make the engine do real work. Those constants are
134
+ **reachable**: a 1.4.0 soak run printed `impossible` for real, because the
135
+ accumulator genuinely landed on the sentinel. The sink polluted stdout on a
136
+ passing run, which is how a CI log teaches people to ignore it.
137
+
138
+ Replaced with a module-scoped int32 sink accumulated in the loop and read at
139
+ teardown. It never prints -- and it now carries an assertion the old form could
140
+ not: **if the sink never advances, the run fails**, because that means the work
141
+ loops were optimised away and the soak measured nothing. Previously that failure
142
+ mode was undetectable.
143
+
144
+ ### Fixed -- "pool returned to baseline" was not what was being asserted
145
+
146
+ The soaks printed a `baseline` (e.g. `7500 / 17992`), a post-teardown figure
147
+ (`2500 / 0`), and then declared that the pool had "returned to baseline". Those
148
+ numbers never match and were never supposed to: teardown disposes the computeds
149
+ and effects and leaves only the signals alive, so the real assertion is a
150
+ leaf-only floor of `N_SIGNALS + 8`. The verdict did not describe the check.
151
+
152
+ - the pre-run stat is now labelled `pre-soak`, not `baseline`;
153
+ - the floor actually asserted on is printed
154
+ (`post-teardown floor asserted: <= 2508 nodes / 0 links`), so a reader can
155
+ check the verdict against the numbers instead of trusting it;
156
+ - the pass line reads `pool drained to its leaf-only floor`.
157
+
158
+ ### Fixed -- `helpers/` resolution
159
+
160
+ The helpers module was committed at `bench/torture/index.mjs` while the
161
+ scenarios -- and the module's own header docstring -- referenced
162
+ `bench/torture/helpers/index.mjs`. Four of the five semantic scenarios died with
163
+ `ERR_MODULE_NOT_FOUND` before executing a single assertion, leaving the suite at
164
+ 1/5 with three stack traces in the log. Moved to the path everything already
165
+ expected. `run.mjs` propagated the failure correctly; nothing else would have
166
+ caught it, because the torture suite is not wired into `npm test` or
167
+ `npm run gate`.
168
+
169
+ ### Changed -- torture sources are ASCII
170
+
171
+ `bench/torture/*.mjs` carried em dashes, less-than-or-equal glyphs, and 1,820
172
+ box-drawing characters. `Signal.js` is pure ASCII and `bench/benchmark.mjs` uses
173
+ only the sanctioned multiplication sign, which made the torture directory the
174
+ lone outlier against the ecosystem's ASCII-only source rule. Normalised to
175
+ `--`, `<=` and `-`. The directory's `README.md` is left as it is, consistent
176
+ with `bench/README.md`.
177
+
178
+ ### Added -- `harness/ProfilerTools/` is now checked in
179
+
180
+ The combined profiler + devtools integration harness has been described in the
181
+ README and wired into `test:harness` / `test:all` since 1.4.0, but its four files
182
+ were never committed. They land here: `harness.test.mjs`, `package.json`,
183
+ `setup.sh`, `README.md`. Verified working -- 5/5 passing, a 7-node / 6-edge
184
+ telemetry DAG discovered through devtools, and `activeNodes 22 -> 22` across
185
+ 2,000 driven frames, which is the zero-GC contract holding end-to-end across
186
+ three packages rather than on a microbench.
187
+
188
+ Its scope is now stated explicitly in the README and `llms.txt`, because it was
189
+ previously ambiguous and the ambiguity was dangerous: **`setup.sh` hard-pins
190
+ `@zakkster/lite-signal@1.6.0-preview.2` from the registry and nothing resolves
191
+ to `../../Signal.js`.** The harness does not test the working tree. Since
192
+ `npm run test:all` chains it, a passing `test:all` is not by itself clearance to
193
+ publish -- `npm test`, `npm run torture` and `npm run test:hardening` are the
194
+ legs that exercise local changes.
195
+
196
+ ### Not changed
197
+
198
+ - `Signal.js` behaviour, `Signal.d.ts`, the public API, the hot path, bundle
199
+ size, and the 1.4.0 `stats()` surface.
200
+ - `npm test` still runs `test/*.test.mjs` only: **405 passing**, unchanged.
201
+ - The torture suite remains opt-in and unpublished.
202
+
7
203
  ## [1.4.0] -- 2026-06-XX
8
204
 
9
205
  The observability minor: `stats()` gains **three cumulative lifecycle counters**
@@ -64,9 +260,9 @@ as before (the reset keeps the arena warm); only the cumulative counts reset.
64
260
 
65
261
  The repo now ships **three opt-in test harnesses** alongside the in-tree engine
66
262
  suite, each in its own subdirectory with its own `package.json` and setup story.
67
- They do **not** run on `npm test`; they opt in through dedicated scripts (with
68
- the exception of the VersionMatrix gate, which is wired into `prepublishOnly`
69
- so it runs automatically on `npm publish`). The default `npm test` is now scoped
263
+ They do **not** run on `npm test`; they opt in through dedicated scripts,
264
+ including the VersionMatrix gate (run on demand via `npm run gate`). The
265
+ default `npm test` is now scoped
70
266
  via a Node 22 native glob -- `'test/*.test.mjs'` -- so only the 26 root engine
71
267
  test files are discovered. Subdirectory test files (e.g.
72
268
  `test/ProfilerTests/test/*.test.mjs`) and out-of-tree test files
@@ -87,8 +283,8 @@ the default run.
87
283
  `stats()` it monitors that the profiler allocates no new nodes in steady
88
284
  state). Setup is one-time (`bash setup.sh`) and pins specific package
89
285
  versions via tarball install so the harness re-runs reproducibly.
90
- - **`harness/VersionMatrix/`** -- a **cold-process regression gate** wired into
91
- `prepublishOnly`. Each version-x-workload is profiled in its own `node`
286
+ - **`harness/VersionMatrix/`** -- a **cold-process regression gate** run on
287
+ demand via `npm run gate`. Each version-x-workload is profiled in its own `node`
92
288
  invocation (so V8 never carries inline caches or JIT state from one version
93
289
  into another), fed an identical LCG write sequence (delta = engine change,
94
290
  not input), and reduced to a per-metric median-of-N. Two baselines gate every
@@ -110,21 +306,26 @@ the default run.
110
306
  `harness/VersionMatrix/README.md`.
111
307
 
112
308
  New root scripts: `test:hardening`, `test:hardening:gc`, `test:harness`,
113
- `test:all`, `gate` (which is also the value of `prepublishOnly`). The README's
309
+ `test:all`, `gate` (the on-demand VersionMatrix regression gate). The README's
114
310
  "Test harnesses" section documents all three subdirectories, the setup story,
115
311
  and the expectation that more dedicated harnesses will land as future
116
312
  publications need targeted defensive validation.
117
313
 
118
314
  ### Verified
119
315
 
120
- - **Full suite green** against the 1.4.0 engine: 429 tests, 419 pass, 0 fail,
121
- 10 skip. The 10 skips are the 9 `{skip:true}` `signalBox` tests in `24-signalbox`
316
+ - **Full suite green** against the 1.4.0 engine: 425 tests, 415 pass, 0 fail,
317
+ 10 skip (this counts the four branch-closure tests added to `12-coverage` for the
318
+ 1.4.0-rc coverage pass; re-verify against your own runner). The 10 skips are the 9 `{skip:true}` `signalBox` tests in `24-signalbox`
122
319
  (staged for 1.5.0) plus 1 architecturally-N/A SSR case in `17-reactivity`. The
123
320
  eager-default and the counter additions changed no existing test outcome; 6 new
124
321
  counter tests in `03-pool` cover the new surface.
125
- - **Coverage** (c8@11, Node 22): `Signal.js` 100% statements / 98.26% branches /
322
+ - **Coverage** (c8@11, Node 22): `Signal.js` 100% statements / 100% branches /
126
323
  100% functions / 100% lines; `Watch.js` 100% across all four. The three counter
127
- bumps sit on already-covered acquire / dispose / grow edges.
324
+ bumps sit on already-covered acquire / dispose / grow edges. The rc coverage pass
325
+ closed the last branch gap (98.26% -> 100%): three reachable branches gained tests,
326
+ two provably-unreachable clamps got `/* c8 ignore */` with proofs, and one branch
327
+ pair reachable only through a now-fixed dangling-cursor crash was removed with the
328
+ fix. See `COVERAGE-NOTES.md`; reconfirm under codify.
128
329
  - **Counter correctness** confirmed directly: after building a signal ->
129
330
  computed -> effect graph, `totalAllocations` equals the node count and
130
331
  `totalDisposals` tracks effect/computed teardown; forcing a pool past its
package/README.md CHANGED
@@ -9,6 +9,8 @@
9
9
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@zakkster/lite-signal?style=for-the-badge)](https://bundlephobia.com/result?p=@zakkster/lite-signal)
10
10
  [![npm downloads](https://img.shields.io/npm/dm/@zakkster/lite-signal?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@zakkster/lite-signal)
11
11
  [![npm total downloads](https://img.shields.io/npm/dt/@zakkster/lite-signal?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@zakkster/lite-signal)
12
+ [![Coverage Status](https://coveralls.io/repos/github/PeshoVurtoleta/lite-signal/badge.svg?branch=main)](https://coveralls.io/github/PeshoVurtoleta/lite-signal?branch=main)
13
+ ![Tree-Shakeable](https://img.shields.io/badge/tree--shakeable-yes-brightgreen)
12
14
  ![TypeScript](https://img.shields.io/badge/TypeScript-Types-informational)
13
15
  ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
14
16
  [![license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](./LICENSE)
@@ -698,37 +700,37 @@ npm run bench
698
700
 
699
701
  ## Testing strategy
700
702
 
701
- Three tiers, all reproducible.
703
+ Four tiers, all reproducible.
702
704
 
703
705
  ### Tier 1 -- Behavior (unit tests, fast)
704
706
 
705
707
  `npm test` runs the suite in `test/`, covering:
706
708
 
707
- - **`01-core_test.mjs`** -- signal/computed/effect basics, equality semantics, NaN/+/-0, subscribe/peek/update, untrack, batch, cleanup ordering, first-run error recovery, nested object reference-identity gotchas.
708
- - **`02-topology_test.mjs`** -- diamond glitch-freedom, 256-deep and 1024-deep computed chains, wide fan-out (1000 effects from one signal), dynamic dependency switching, conditional fan-out, nested effects, cycle detection (`CycleError`).
709
- - **`03-pool_test.mjs`** -- `CapacityError` under both `"throw"` and `"grow"` policies, the 16× link ceiling, stable pool reuse across thousands of create/dispose cycles, registry isolation, (1.3.0) the lazy-prealloc paths: on-demand construction reaching the same steady state as eager, a never-allocated lazy registry surviving `destroy()`, and `"grow"` extending both pool ledgers past their initial capacity, and (1.4.0) the `stats()` lifecycle counters: the 11-key shape, `totalAllocations` / `totalDisposals` tracking the `activeNodes` live invariant, `poolGrowths` firing on growth and staying 0 on a correctly-sized eager pool, and `destroy()` resetting all three.
710
- - **`05-scheduler_test.mjs`** -- scheduler-deferred effects, dispose-during-schedule races, microtask integration, 32-bit version wrap (simulated), `setDefaultRegistry`, `onCleanup` inside computeds.
711
- - **`06-nested-objects_test.mjs`** -- array mutation patterns (push/splice/spread), deep nested paths, Map/Set/Date inside signals, custom structural equality, computed memoisation cutoffs over object slices, signal-of-signals composition, high-frequency object updates, batched immutable updates.
712
- - **`07-dispose_test.mjs`** -- unified `dispose(api)` across signals, computeds and effect handles, idempotency, cross-registry isolation (per-registry Symbol prevents pool corruption), foreign-value safety, top-level helper routing, 500-cycle balanced churn leaving pool and stats stable.
713
- - **`08-watch_test.mjs`** -- Validates the user-land observer utilities (watch, when, whenAsync). Covers lifecycle teardown, old/new value tracking, and Promise-based asynchronous state resolution.
714
- - **`09-conformance_test.mjs`** -- Industry-standard conformance tests. Validates the engine against extreme edge cases from the johnsoncodehk reactive test suite, ensuring strict zero-GC invariants, correct cleanup isolation, and re-entrant stability.
715
- - **`10-is-tracking_test.mjs`** -- The `isTracking()` observer-context predicate. 11 tests across 5 describe blocks: true inside effect/computed bodies; false inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and `watch` callbacks (the untracked-window cases that catch an observer-only misimplementation); false outside any observer including at the call site of an unobserved computed read; state-restoration after a thrown body; per-registry isolation; top-level binding.
716
- - **`11-adopted-reactive_test.mjs`** -- 24 engine-agnostic edge cases adopted from across the ecosystem: alien-signals' parent-child link-integrity regression (#226-228), equality-predicate corners (preact/solid/vue), `signal.update(fn)` functional setter (vue/solid), `peek()` non-subscription depth (preact/vue), and the `subscribe` behavioral contract (preact/mobx).
717
- - **`12-coverage_test.mjs`** -- 18 targeted exercises for public surface and hot-path branches the behavioral suites don't incidentally hit: top-level routing to the default registry, the computed clean-read short-circuit (`markEpoch` O(1) skip), dependency-set shrink severing the stale tail, error/structural edge paths, scheduler ABA across a recycled pool slot, and the v1.2 owner-tree paths (direct-child detach, cascade tolerates an already-freed child). Capability-gated via a runtime probe, so the same file runs unchanged across engines.
718
- - **`13-introspection_test.mjs`** -- The observer-lifecycle surface (1.1.4). 10 tests across 3 describe blocks: `hasObservers` (live observation reflects; a peek doesn't count), `observeObservers` auto-pause lifecycle (start-on-first / stop-on-last, no extra connect for a 2nd observer, re-observe fires again, no churn on re-track, conditional reads toggle honestly, transition-only registration, works for computeds), and `forEachObserver`/`forEachSource` enumeration (both directions; descriptor carries kind + value).
719
- - **`14-lifecycle-teardown_test.mjs`** -- Effect-teardown guards against the alien-signals@3.2.1 regressions (4 tests). A stopped effect must not re-subscribe to a signal read later in the same run; self-dispose must leave no orphaned link (clean `activeLinks`); a throwing setup must leave no live subscription; normal and dynamic re-tracking stay unaffected by the `allocateLink` eligibility gate.
720
- - **`15-owner-lazy-alloc_test.mjs`** -- Owner-adoption contract for the 1.2.0 owner tree (5 tests). A signal allocated lazily *inside* a computed/effect must **not** be owner-adopted (it survives the owner's re-run -- the lite-store/lite-form lazy-field shape) and sibling lazy signals must not cross-wire, while observers (nested effect/computed) *are* still auto-disposed on the owner's re-run.
721
- - **`16-alien-parity_test.mjs`** -- Differential regression guards (3 tests) reproducing the *properties* behind alien-signals@3.2.0 fixed bugs: reads inside a cleanup create no spurious dependencies (the dispose-cleanup fix); an inner-effect write does not block later propagation through a computed chain (#112); a dynamic dependency-set change stays correct under dirty-check (#109/#110).
722
- - **`17-reactivity_test.mjs`** -- Behavioral suite (~30 tests across 11 groups) mirroring universal signal-system bug classes: subscription lifecycle, cleanup ordering, stale-dependency tracking, batching/timing (incl. set-then-revert), equality cutoff (NaN/+/-0/custom), nested invalidation + glitch-free diamond, memory/retained nodes, the synchronous async-boundary, scheduler & loops (self-write termination, self-reading computed), and differential-review additions (cached computed errors, mid-batch pull, self-disposing getter, pooled-slot return). SSR hydration is a documented N/A -- lite has no DOM layer.
723
- - **`18-identity_test.mjs`** -- Node identity (1.1.5; 5 tests). Unique/stable ids; `nodeId`/`describe` return `undefined` for a non-handle; the descriptor's visible shape is `{ id, kind, value }`; `forEach*` descriptors carry `id` and are **re-walkable** (`nodeId`/`forEachSource` accept a descriptor); identity walks are non-perturbing (add no observers).
724
- - **`19-v12-additions_test.mjs`** -- v1.2.0 release-prep regressions (24 tests across 8 suites). Shared `peek` (one closure per registry, identical reference across primitives, no tracking, two registries hold independent peeks). Owner-adoption rule (signals not adopted, computeds/effects adopted, cascade drains correctly). Pre-batch revert (signal-level, propagates through computeds, respects custom `equals`, nested batches, final-different-value still fires). Multi-throw aggregation (`AggregateError` with both errors carried, single-throw unwrapped, engine survives). `CycleError` via `maxFlushPasses` (default + custom). `maxLinks` config branch under `throw` and `grow`. Documented disposed-signal semantics (read undefined, set silent no-op, dispose idempotent). Scheduler-thunk ABA guard across a recycled pool slot.
725
- - **`20-axis-stress_test.mjs`** -- engine-invariant regression guards along eight orthogonal "axes" (16 tests across 9 suites). Pins lite-signal's actual contract on: batch semantics under exception (writes commit; pre-batch revert holds; effects see the post-throw value), connect/disconnect lifecycle re-entrancy (`observeObservers` from inside an `onConnect`, transition-only registration), untrack does NOT suppress owner adoption (a nested effect created via `untrack` is still owner-cascaded), untrack inside a computed body (no hidden dep leaks; tracked source re-evaluates), queue safety under self-dispose mid-flush (no UAF), value-dependent cycle detection (computed graph closes a cycle, `CycleError` thrown), nested-effect creation order (effects run synchronously on creation; immediately-stopped one still ran), synchronous flush (no scheduler in the default path; batch coalesces). Plus a bonus suite: 1,000 effect-create-then-dispose cycles return pool to baseline; `dispose()` idempotent; `dispose()` on foreign values safe.
726
- - **`21-perf-pins_test.mjs`** -- v1.2.1 construction-shape pins (6 tests). Locks the canonical handle shapes (`signal` 6 own props: peek/set/update/subscribe + NODE_PTR/NODE_GEN; `computed` 4: peek/subscribe + NODE_PTR/NODE_GEN) so a future "let's unify them" change has to be explicit. Locks the 1.2.1 ABA guards: detached `const {set} = signal()` keeps working on a LIVE signal; `read()` returns `undefined` and skips dep-tracking on a stale handle (no phantom subscription to the recycled slot); `set()` on a stale handle is a no-op across three corruption tiers (disposed slot, recycled slot, downstream propagation); `peek()` returns `undefined` for stale signal and computed handles.
727
- - **`22-mutation-hook_test.mjs`** -- 1.2.1 `onGraphMutation` semantics (12 tests across 2 suites). Registration: unsubscribe returns a function; `null` argument clears and the unsub restores the prior listener; non-function/non-null throws `TypeError`; multiple registrations stack LIFO; registries are isolated (no cross-talk). Opcode emission: `1` node-create fires with `(id, flags)` for signal (32) / computed (1) / effect (2); `2` node-dispose fires for cascade-disposed owned children; `3` link-add fires with `(source.id, target.id)` on dependency record; `4` link-remove fires when a dep-set flip severs the tail; `5` recompute fires on initial eval AND re-eval; the hook fires synchronously inside the mutation (listener sees its own event before the caller returns); payload is always three plain numbers -- no objects, no closures.
728
- - **`23-owner-introspection_test.mjs`** -- 1.2.1 owner-tree introspection + effect-disposer regression (22 tests across 4 suites). `ownerOf`: undefined for top-level / garbage input / stale handle; returns the enclosing effect's descriptor for a child created inside an effect body. `forEachOwned`: no-op for handles with no owned children / garbage input / stale handle; iterates owned children as `{id, kind, value}` descriptors. Gen-guarded introspection (ABA fix): `nodeId` / `describe` / `hasObservers` return undefined / false for stale handles; `observeObservers` throws `TypeError`; `forEachObserver` / `forEachSource` are no-ops; descriptors returned by `describeNode` are themselves gen-stamped so a descriptor obtained pre-recycle correctly walks as a no-op post-recycle (the "descriptors are re-walkable handles" contract survives the guard). Plus the 1.2.1 effect-dispose-handle fix: passing the effect's disposer directly to `describe` / `nodeId` / `forEachSource` / `forEachOwned` / `ownerOf` / `hasObservers` works as a first-class introspection handle (pre-fix it was a bare closure and returned `undefined` for a *live* effect); after `fx()` dispose the same handle correctly goes stale on every entry point; the disposer's `NODE_GEN` mirrors the effect node's birthGen exactly.
729
- - **`24-signalbox_test.mjs`** -- staged for v1.5.0; all 9 tests `{skip: true}` on 1.3.x. The `signalBox` / `computedBox` allocation-light handle API lands in 1.5.0; the suite is committed early so the surface is pinned and the skips are visible in the test count (the 10 skips on 1.3.0 are these 9 plus 1 architecturally-N/A SSR case in `17-reactivity`).
730
- - **`25-devtools-real-boot_test.mjs`** -- Devtools/Studio contract (10 tests). Boots the actual `Devtools.js` against the 1.4.0 engine and exercises all 19 Devtools exports plus the 10 symbols Studio imports from Devtools. Pins the ghost contract: heavy introspection (graph walk, owner-tree, observer descriptors) adds **zero** nodes to the live graph. Catches the real-rig failure mode where importing the package by its own name from a repo whose `package.json` declares `name: "@zakkster/lite-signal"` resolves to the published build instead of the local engine.
731
- - **`26-free-list-invariant_test.mjs`** -- the 1.2.2 audit's cleanliness pins (3 invariant tests + 1 targeted coverage test). Asserts directly -- by inspecting freshly-allocated nodes through the documented `describe()` -> `NODE_PTR` introspection protocol -- that the `ReactiveNode` constructor and the fresh-pool-growth path initialize the ten fields the audit removed from `createNode` to identical values, so the deleted writes were defending against a state the engine cannot produce on a clean free list. The 4th test covers the swallow-on-self-dispose-then-throw branch in `pullComputed` (the path that lifted branch coverage from 98.07% to 98.43%).
709
+ - **`01-core.test.mjs`** -- signal/computed/effect basics, equality semantics, NaN/+/-0, subscribe/peek/update, untrack, batch, cleanup ordering, first-run error recovery, nested object reference-identity gotchas.
710
+ - **`02-topology.test.mjs`** -- diamond glitch-freedom, 256-deep and 1024-deep computed chains, wide fan-out (1000 effects from one signal), dynamic dependency switching, conditional fan-out, nested effects, cycle detection (`CycleError`).
711
+ - **`03-pool.test.mjs`** -- `CapacityError` under both `"throw"` and `"grow"` policies, the 16× link ceiling, stable pool reuse across thousands of create/dispose cycles, registry isolation, (1.3.0) the lazy-prealloc paths: on-demand construction reaching the same steady state as eager, a never-allocated lazy registry surviving `destroy()`, and `"grow"` extending both pool ledgers past their initial capacity, and (1.4.0) the `stats()` lifecycle counters: the 11-key shape, `totalAllocations` / `totalDisposals` tracking the `activeNodes` live invariant, `poolGrowths` firing on growth and staying 0 on a correctly-sized eager pool, and `destroy()` resetting all three.
712
+ - **`05-scheduler.test.mjs`** -- scheduler-deferred effects, dispose-during-schedule races, microtask integration, 32-bit version wrap (simulated), `setDefaultRegistry`, `onCleanup` inside computeds.
713
+ - **`06-nested-objects.test.mjs`** -- array mutation patterns (push/splice/spread), deep nested paths, Map/Set/Date inside signals, custom structural equality, computed memoisation cutoffs over object slices, signal-of-signals composition, high-frequency object updates, batched immutable updates.
714
+ - **`07-dispose.test.mjs`** -- unified `dispose(api)` across signals, computeds and effect handles, idempotency, cross-registry isolation (per-registry Symbol prevents pool corruption), foreign-value safety, top-level helper routing, 500-cycle balanced churn leaving pool and stats stable.
715
+ - **`08-watch.test.mjs`** -- Validates the user-land observer utilities (watch, when, whenAsync). Covers lifecycle teardown, old/new value tracking, and Promise-based asynchronous state resolution.
716
+ - **`09-conformance.test.mjs`** -- Industry-standard conformance tests. Validates the engine against extreme edge cases from the johnsoncodehk reactive test suite, ensuring strict zero-GC invariants, correct cleanup isolation, and re-entrant stability.
717
+ - **`10-is-tracking.test.mjs`** -- The `isTracking()` observer-context predicate. 11 tests across 5 describe blocks: true inside effect/computed bodies; false inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and `watch` callbacks (the untracked-window cases that catch an observer-only misimplementation); false outside any observer including at the call site of an unobserved computed read; state-restoration after a thrown body; per-registry isolation; top-level binding.
718
+ - **`11-adopted-reactive.test.mjs`** -- 24 engine-agnostic edge cases adopted from across the ecosystem: alien-signals' parent-child link-integrity regression (#226-228), equality-predicate corners (preact/solid/vue), `signal.update(fn)` functional setter (vue/solid), `peek()` non-subscription depth (preact/vue), and the `subscribe` behavioral contract (preact/mobx).
719
+ - **`12-coverage.test.mjs`** -- 30 targeted exercises for public surface and hot-path branches the behavioral suites don't incidentally hit: top-level routing to the default registry, the computed clean-read short-circuit (`markEpoch` O(1) skip), dependency-set shrink severing the stale tail, error/structural edge paths, scheduler ABA across a recycled pool slot, and the v1.2 owner-tree paths (direct-child detach, cascade tolerates an already-freed child). The final four close the 1.4.0-rc branch gap: the `allocateLink` dead-target gate, the `executeEffect` scheduler-reentrancy cycle throw, the stale computed-handle read, and the disposeNode cursor-repair regression. Capability-gated via a runtime probe, so the same file runs unchanged across engines.
720
+ - **`13-introspection.test.mjs`** -- The observer-lifecycle surface (1.1.4). 10 tests across 3 describe blocks: `hasObservers` (live observation reflects; a peek doesn't count), `observeObservers` auto-pause lifecycle (start-on-first / stop-on-last, no extra connect for a 2nd observer, re-observe fires again, no churn on re-track, conditional reads toggle honestly, transition-only registration, works for computeds), and `forEachObserver`/`forEachSource` enumeration (both directions; descriptor carries kind + value).
721
+ - **`14-lifecycle-teardown.test.mjs`** -- Effect-teardown guards against the alien-signals@3.2.1 regressions (4 tests). A stopped effect must not re-subscribe to a signal read later in the same run; self-dispose must leave no orphaned link (clean `activeLinks`); a throwing setup must leave no live subscription; normal and dynamic re-tracking stay unaffected by the `allocateLink` eligibility gate.
722
+ - **`15-owner-lazy-alloc.test.mjs`** -- Owner-adoption contract for the 1.2.0 owner tree (4 tests). A signal allocated lazily *inside* a computed/effect must **not** be owner-adopted (it survives the owner's re-run -- the lite-store/lite-form lazy-field shape) and sibling lazy signals must not cross-wire, while observers (nested effect/computed) *are* still auto-disposed on the owner's re-run.
723
+ - **`16-alien-parity.test.mjs`** -- Differential regression guards (3 tests) reproducing the *properties* behind alien-signals@3.2.0 fixed bugs: reads inside a cleanup create no spurious dependencies (the dispose-cleanup fix); an inner-effect write does not block later propagation through a computed chain (#112); a dynamic dependency-set change stays correct under dirty-check (#109/#110).
724
+ - **`17-reactivity.test.mjs`** -- Behavioral suite (~30 tests across 11 groups) mirroring universal signal-system bug classes: subscription lifecycle, cleanup ordering, stale-dependency tracking, batching/timing (incl. set-then-revert), equality cutoff (NaN/+/-0/custom), nested invalidation + glitch-free diamond, memory/retained nodes, the synchronous async-boundary, scheduler & loops (self-write termination, self-reading computed), and differential-review additions (cached computed errors, mid-batch pull, self-disposing getter, pooled-slot return). SSR hydration is a documented N/A -- lite has no DOM layer.
725
+ - **`18-identity.test.mjs`** -- Node identity (1.1.5; 5 tests). Unique/stable ids; `nodeId`/`describe` return `undefined` for a non-handle; the descriptor's visible shape is `{ id, kind, value }`; `forEach*` descriptors carry `id` and are **re-walkable** (`nodeId`/`forEachSource` accept a descriptor); identity walks are non-perturbing (add no observers).
726
+ - **`19-v12-additions.test.mjs`** -- v1.2.0 release-prep regressions (24 tests across 8 suites). Shared `peek` (one closure per registry, identical reference across primitives, no tracking, two registries hold independent peeks). Owner-adoption rule (signals not adopted, computeds/effects adopted, cascade drains correctly). Pre-batch revert (signal-level, propagates through computeds, respects custom `equals`, nested batches, final-different-value still fires). Multi-throw aggregation (`AggregateError` with both errors carried, single-throw unwrapped, engine survives). `CycleError` via `maxFlushPasses` (default + custom). `maxLinks` config branch under `throw` and `grow`. Documented disposed-signal semantics (read undefined, set silent no-op, dispose idempotent). Scheduler-thunk ABA guard across a recycled pool slot.
727
+ - **`20-axis-stress.test.mjs`** -- engine-invariant regression guards along eight orthogonal "axes" (23 tests across 11 suites). Pins lite-signal's actual contract on: batch semantics under exception (writes commit; pre-batch revert holds; effects see the post-throw value), connect/disconnect lifecycle re-entrancy (`observeObservers` from inside an `onConnect`, transition-only registration), untrack does NOT suppress owner adoption (a nested effect created via `untrack` is still owner-cascaded), untrack inside a computed body (no hidden dep leaks; tracked source re-evaluates), queue safety under self-dispose mid-flush (no UAF), value-dependent cycle detection (computed graph closes a cycle, `CycleError` thrown), nested-effect creation order (effects run synchronously on creation; immediately-stopped one still ran), synchronous flush (no scheduler in the default path; batch coalesces). Plus a bonus suite: 1,000 effect-create-then-dispose cycles return pool to baseline; `dispose()` idempotent; `dispose()` on foreign values safe.
728
+ - **`21-perf-pins.test.mjs`** -- v1.2.1 construction-shape pins (6 tests). Locks the canonical handle shapes (`signal` 6 own props: peek/set/update/subscribe + NODE_PTR/NODE_GEN; `computed` 4: peek/subscribe + NODE_PTR/NODE_GEN) so a future "let's unify them" change has to be explicit. Locks the 1.2.1 ABA guards: detached `const {set} = signal()` keeps working on a LIVE signal; `read()` returns `undefined` and skips dep-tracking on a stale handle (no phantom subscription to the recycled slot); `set()` on a stale handle is a no-op across three corruption tiers (disposed slot, recycled slot, downstream propagation); `peek()` returns `undefined` for stale signal and computed handles.
729
+ - **`22-mutation-hook.test.mjs`** -- 1.2.1 `onGraphMutation` semantics (12 tests across 2 suites). Registration: unsubscribe returns a function; `null` argument clears and the unsub restores the prior listener; non-function/non-null throws `TypeError`; multiple registrations stack LIFO; registries are isolated (no cross-talk). Opcode emission: `1` node-create fires with `(id, flags)` for signal (32) / computed (1) / effect (2); `2` node-dispose fires for cascade-disposed owned children; `3` link-add fires with `(source.id, target.id)` on dependency record; `4` link-remove fires when a dep-set flip severs the tail; `5` recompute fires on initial eval AND re-eval; the hook fires synchronously inside the mutation (listener sees its own event before the caller returns); payload is always three plain numbers -- no objects, no closures.
730
+ - **`23-owner-introspection.test.mjs`** -- 1.2.1 owner-tree introspection + effect-disposer regression (14 tests across 3 suites). `ownerOf`: undefined for top-level / garbage input / stale handle; returns the enclosing effect's descriptor for a child created inside an effect body. `forEachOwned`: no-op for handles with no owned children / garbage input / stale handle; iterates owned children as `{id, kind, value}` descriptors. Gen-guarded introspection (ABA fix): `nodeId` / `describe` / `hasObservers` return undefined / false for stale handles; `observeObservers` throws `TypeError`; `forEachObserver` / `forEachSource` are no-ops; descriptors returned by `describeNode` are themselves gen-stamped so a descriptor obtained pre-recycle correctly walks as a no-op post-recycle (the "descriptors are re-walkable handles" contract survives the guard). Plus the 1.2.1 effect-dispose-handle fix: passing the effect's disposer directly to `describe` / `nodeId` / `forEachSource` / `forEachOwned` / `ownerOf` / `hasObservers` works as a first-class introspection handle (pre-fix it was a bare closure and returned `undefined` for a *live* effect); after `fx()` dispose the same handle correctly goes stale on every entry point; the disposer's `NODE_GEN` mirrors the effect node's birthGen exactly.
731
+ - **`24-signalbox.test.mjs`** -- staged for v1.5.0; all 9 tests `{skip: true}` on 1.4.0. The `signalBox` / `computedBox` allocation-light handle API lands in 1.5.0; the suite is committed early so the surface is pinned and the skips are visible in the test count (the 10 skips on 1.4.0 are these 9 plus 1 architecturally-N/A SSR case in `17-reactivity`).
732
+ - **`25-devtools-real-boot.test.mjs`** -- Devtools/Studio contract (10 tests). Boots the actual `Devtools.js` against the 1.4.0 engine and exercises all 19 Devtools exports plus the 10 symbols Studio imports from Devtools. Pins the ghost contract: heavy introspection (graph walk, owner-tree, observer descriptors) adds **zero** nodes to the live graph. Catches the real-rig failure mode where importing the package by its own name from a repo whose `package.json` declares `name: "@zakkster/lite-signal"` resolves to the published build instead of the local engine.
733
+ - **`26-free-list-invariant.test.mjs`** -- the 1.2.2 audit's cleanliness pins (3 invariant tests + 1 targeted coverage test). Asserts directly -- by inspecting freshly-allocated nodes through the documented `describe()` -> `NODE_PTR` introspection protocol -- that the `ReactiveNode` constructor and the fresh-pool-growth path initialize the ten fields the audit removed from `createNode` to identical values, so the deleted writes were defending against a state the engine cannot produce on a clean free list. The 4th test covers the swallow-on-self-dispose-then-throw branch in `pullComputed` (the path that lifted branch coverage from 98.07% to 98.43%).
732
734
 
733
735
  ```bash
734
736
  npm test
@@ -736,7 +738,7 @@ npm test
736
738
 
737
739
  ### Tier 2 -- Memory (allocation-free verification)
738
740
 
739
- `npm run test:gc` runs `test/04-zero-gc_test.mjs` with `--expose-gc`:
741
+ `npm run test:gc` runs the whole suite with `--expose-gc` so the memory budgets in `test/04-zero-gc.test.mjs` are enforced (they no-op without an exposed GC):
740
742
 
741
743
  - 100,000 `set()` calls on a graph with effects retain **< 200 KB** of heap.
742
744
  - 1,000 create/dispose cycles retain **< 50 KB**.
@@ -757,12 +759,64 @@ npm run test:gc
757
759
  npm run bench
758
760
  ```
759
761
 
760
- ### Tier 4 -- Torture soaks (crash detection under chaos)
762
+ ### Tier 4 -- Torture (correctness and resources under chaos)
761
763
 
762
- `bench/torture/` contains three soak harnesses that build large randomised graphs (1,500 / 7,500 / 3,300 nodes) and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires, effect rewires, nested-batch + untrack reads, and microtask-scheduled async flushes -- for 5-10 seconds. These are not perf benchmarks. The numbers they print (ops/sec) reflect random workload composition, not engine throughput; the existing `bench/benchmark.mjs` is the canonical perf harness. What the soaks DO assert, with a non-zero exit code on failure:
764
+ `bench/torture/` holds eight scenarios in two groups, behind one runner. They are
765
+ not perf benchmarks: the ops/sec figures reflect random workload composition, not
766
+ engine throughput -- `bench/benchmark.mjs` remains the canonical perf harness.
763
767
 
764
- - zero thrown exceptions during the run, and
765
- - after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
768
+ ```bash
769
+ npm run torture # everything
770
+ npm run torture:semantic # correctness only, ~10s, CI-shaped
771
+ npm run torture:soak # resource soaks only
772
+ ```
773
+
774
+ ```bash
775
+ node bench/torture/run.mjs --list
776
+ node bench/torture/run.mjs --seconds 30 --bail
777
+ node bench/torture/run.mjs oracle glitch # substring match on names
778
+ ```
779
+
780
+ The runner spawns each scenario as a **child process** rather than importing it.
781
+ Several assert on global pool accounting and on the default registry, so running
782
+ two in one process would let the first one's residue poison the second's
783
+ baseline. `--expose-gc` is passed unconditionally -- some scenarios force
784
+ collection to settle finalizers, and without it they would silently degrade to
785
+ asserting nothing.
786
+
787
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
788
+
789
+ Run these on every commit. They pin values, wakeups, work and ordering.
790
+
791
+ | scenario | pins |
792
+ | -------- | ---- |
793
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, over 400 seeds x 120 ops |
794
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
795
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies -- no missing recompute, no surplus one |
796
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts: self-write, `CycleError` on mutual loops, nested-batch boundaries, cascade ordering, cleanup writes, dispose-mid-flush, self-disposal, async interleaving |
797
+ | `scheduler-storm` | deferred execution under 10,000 effects: the gen-bound thunk's ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler not taking the pass down |
798
+
799
+ Why this group exists: the resource soaks below pass green on an engine whose
800
+ computeds return stale values. Flipping the clean short-circuit in `pullComputed`
801
+ from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws nothing --
802
+ `oracle-fuzzer` catches it on 400/400 seeds, and all three soaks report PASS.
803
+ Separately, removing the `node.gen === gen` guard from the cached scheduler thunk
804
+ is caught by `scheduler-storm` and **missed by all 405 unit tests**.
805
+
806
+ Where no contract is documented, these files pin the *observed* behaviour and say
807
+ so at the scenario, rather than asserting an invented one.
808
+
809
+ #### `soak` -- wall-clock bound, asserts on **resources**
810
+
811
+ Run these nightly or pre-publish. Large randomised graphs (1,500 / 7,500 / 3,300
812
+ nodes) under mixed fuzz -- leaf writes, batched writes, computed and effect
813
+ rewires, nested-batch and untrack reads, microtask-scheduled async flushes. Each
814
+ exits non-zero unless:
815
+
816
+ - zero exceptions were thrown during the run,
817
+ - after teardown `activeNodes` is at or below its leaf-only floor and
818
+ `activeLinks` is exactly `0`, and
819
+ - the JIT sink advanced -- proving the accumulator loops were not optimised away.
766
820
 
767
821
  ```bash
768
822
  node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
@@ -770,16 +824,22 @@ node --expose-gc bench/torture/torture-soak.mjs # 5s high-volume churn, 750
770
824
  node --expose-gc bench/torture/scheduler-bench.mjs # 10s microtask-scheduled, 3300 nodes
771
825
  ```
772
826
 
773
- Run any of them with `TORTURE_SECONDS=N` for a longer soak. Indicative numbers from a development host (post-teardown pool returns to baseline in all three):
827
+ Any of them takes `TORTURE_SECONDS=N` for a longer soak (the runner's `--seconds`
828
+ sets it for all three). Indicative numbers from a development host:
829
+
830
+ | | duration | ops | errors | post-teardown nodes / links | floor |
831
+ | --------------------- | --------:| --------:| ------:| --------------------------- | -------- |
832
+ | graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 | <= 508 |
833
+ | torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 | <= 2508 |
834
+ | scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 | <= 1008 |
774
835
 
775
- | | duration | ops | errors | post-teardown nodes / links |
776
- | --------------------- | --------:| --------:| ------:| --------------------------- |
777
- | graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 |
778
- | torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 |
779
- | scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 |
836
+ The floor is the assertion; the pre-soak figure is not. Teardown disposes the
837
+ computeds and effects and leaves the signals alive, so post-teardown is *supposed*
838
+ to sit far below the pre-soak node count. Each soak prints the floor it asserted
839
+ against so the verdict can be checked against the numbers.
780
840
 
781
841
  ```bash
782
- npm run verify # test + test:gc + a sanity bench
842
+ npm run verify # test + a sanity bench
783
843
  ```
784
844
 
785
845
  ---
@@ -811,7 +871,7 @@ The matrix is **ratcheted stricter every release**: a regression in a future ver
811
871
 
812
872
  ### `harness/VersionMatrix/` -- cold-process performance gate
813
873
 
814
- A **same-host, cold-process regression gate** for the engine. Turns "did this release regress?" from a judgment call into a checkpoint: the driver swaps each engine version into `node_modules` in its own `node` invocation (so V8 never carries inline caches or JIT state from one version into another), feeds every version an identical LCG write sequence (so a delta is the engine changing, not the input), and reduces N cold samples per version-x-workload to a per-metric median. Wired as `prepublishOnly` -- a regression aborts `npm publish` before it starts.
874
+ A **same-host, cold-process regression gate** for the engine. Turns "did this release regress?" from a judgment call into a checkpoint: the driver swaps each engine version into `node_modules` in its own `node` invocation (so V8 never carries inline caches or JIT state from one version into another), feeds every version an identical LCG write sequence (so a delta is the engine changing, not the input), and reduces N cold samples per version-x-workload to a per-metric median. Run on demand via `npm run gate` -- it reports whether the current tree regresses on the four reference workloads -- and as an explicit pre-publish step in the release process.
815
875
 
816
876
  **Two baselines.** A candidate must clear BOTH a **floor** (never moves -- "we shall not regress below this line") AND a **rolling** baseline (the previous published version). Tolerances are calibrated against measured self-noise (`npm run calibrate`): `frame.avg` is the stable anchor (self-noise <=~3%, gated tight at 5% vs rolling / 10% vs floor); `frame.p99` and `phase.write.p99` are jitter-prone (self-noise up to ~14%), so their tolerances sit above that floor (18% rolling / 30% floor) and a p99 fail should be confirmed with a re-run. The two-baseline design catches the blind spot of a fixed floor -- an engine that improves 1.4 -> 1.6 then regresses back to 1.4 levels still clears a 1.3 floor, but fails the rolling gate.
817
877
 
@@ -830,7 +890,7 @@ bash matrix.sh gate <candidate-version> # published candidate vs floor + rolli
830
890
  bash matrix.sh gate-self <label> <path> # current-tree candidate (engine path) vs floor + rolling
831
891
  node diff.mjs # diagnostic over committed baselines -> matrix-report.json
832
892
  node gate.mjs <label> # gate over already-captured baselines (exit 1 on regression)
833
- npm run gate # what prepublish runs -- gate-self against the current tree
893
+ npm run gate # run the regression gate against the current tree
834
894
  ```
835
895
 
836
896
  Committed median baselines live under `harness/VersionMatrix/baselines/<version>/*.json` (each carrying `env` metadata: CPU, node, date). These are the **public evidence surface** -- anyone can rerun and diff -- but the gate always re-captures floor / rolling / candidate in the same job so it never diffs across hosts. Details, including how to add a new version to the matrix, in [`harness/VersionMatrix/README.md`](./harness/VersionMatrix/README.md).
@@ -854,10 +914,18 @@ npm run test:harness
854
914
 
855
915
  The setup script pins specific package versions via tarball install so the harness can be re-run reproducibly without depending on whatever happens to be in the public registry on the day. Treat the setup as a one-time per-checkout cost.
856
916
 
917
+ > **This harness does not test the tree you are standing in.** `setup.sh` hard-pins `@zakkster/lite-signal@1.6.0-preview.2` from the registry and extracts it into the harness's own `node_modules`; nothing resolves to `../../Signal.js`. That is deliberate -- the point is to prove the contract holds **across the published package chain a consumer actually installs**, where `lite-profiler-signal` and `lite-devtools` meet an engine none of them were built against. It is emphatically *not* a gate on local changes. A green run here says nothing about uncommitted work in `Signal.js`, and because `npm run test:all` chains it, a passing `test:all` is **not** by itself clearance to publish.
918
+ >
919
+ > For the local engine, use `npm test` (in-tree, 405 tests), `npm run torture` (in-tree), and `npm run test:hardening` -- `test/ProfilerTests/` self-references in-tree and therefore *does* exercise the working copy.
920
+ >
921
+ > When the pinned version goes stale, bump it in `setup.sh` and re-check the two capability assertions in `harness.test.mjs` (`cap.owners`, `cap.mutationHook`), which are written against the 1.6 surface.
922
+
923
+ Last verified run (engine `1.6.0-preview.2`, devtools 1.2.0, profiler 1.2.0): 5/5 passing; `capabilities: {"floor":"1.1.5","owners":true,"mutationHook":true,"burst":true}`; 7-node / 6-edge telemetry DAG discovered; `activeNodes 22 -> 22` across 2,000 driven frames with `poolCap` flat at 1024 -- the zero-GC contract holding end-to-end across three packages.
924
+
857
925
  ### Notes
858
926
 
859
927
  - The hardening suite and the profiler integration do **not** run on `npm test` from the root. They opt in through the `test:hardening` / `test:harness` scripts (and `test:all`, which chains everything).
860
- - The **VersionMatrix gate**, by contrast, IS wired into `prepublishOnly` -- a regression on the four reference workloads blocks `npm publish`. Diagnostic runs (`node diff.mjs`) are opt-in from the harness directory.
928
+ - The **VersionMatrix gate** is run on demand via `npm run gate` -- it flags a regression on the four reference workloads against the current tree. The harness and its baselines are checked in; diagnostic runs (`node diff.mjs`) are opt-in from the harness directory.
861
929
  - All three subdirectories have their own `package.json` with local scripts, so you can also `cd` in and run `npm test` directly -- the root scripts are just shortcuts.
862
930
  - The `npm --prefix <dir> test` form used in the root scripts is the cross-platform replacement for `cd && npm test` -- works identically on Linux, macOS, and Windows.
863
931
 
@@ -914,7 +982,7 @@ The cross-framework reactivity suite agrees independently, re-run on **1.4.0** (
914
982
  - **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
915
983
  - **1.2.0** -- the **ownership hybrid**: an owner tree so nested effects/computeds auto-dispose with their parent (closes conformance #209 / #210, matching Solid's `createRoot` ergonomics). Plus three additive features built on the same internal split: pre-batch revert (`batch(() => { a.set(99); a.set(10); })` doesn't re-fire), multi-throw `AggregateError`, and scheduler-thunk caching with an ABA gen guard. *Shipped.*
916
984
  - **1.3.0** -- the **pool minor**: node and link pools become growable and incrementally populated. New `prealloc` config (`"eager"` default | `"lazy"`) chooses up-front vs on-demand construction; `onCapacityExceeded: "grow"` extends pools via chunked refill (runs of up to 1024 links / 256 nodes, ledger doubles) bounded by the 16x link ceiling; `maxFlushPasses` is now a public config. Internally the propagation mark phase moved to an intrusive linked-list stack (a `nextMark` field) -- the only node-shape change. The hot paths and public callable API are byte-identical to 1.2.2; steady-state zero-GC is unchanged. *Shipped.*
917
- - **1.4.0** -- the **observability minor**: `stats()` gains three cumulative lifecycle counters (`totalAllocations`, `totalDisposals`, `poolGrowths`), the surface reserved for it in the 1.2.x/1.3.0 notes. Monotonic over the registry's life, reset by `destroy()`, bumped on the existing acquire/dispose/grow edges -- no hot-path change, no public callable API change. This is what lite-devtools / lite-studio read to chart allocation rate, pool-reuse ratio, and graph churn. Also adds the `harness/VersionMatrix/` regression gate (cold-process, same-host, two baselines) as a `prepublish` step, so a release that regresses `frame.avg` on the four reference workloads (reactive-graph-mix, deep-chain, broadcast-fanout, dynamic-dep-churn) fails the publish. Drop-in over 1.3.0. *Shipped.*
985
+ - **1.4.0** -- the **observability minor**: `stats()` gains three cumulative lifecycle counters (`totalAllocations`, `totalDisposals`, `poolGrowths`), the surface reserved for it in the 1.2.x/1.3.0 notes. Monotonic over the registry's life, reset by `destroy()`, bumped on the existing acquire/dispose/grow edges -- no hot-path change, no public callable API change. This is what lite-devtools / lite-studio read to chart allocation rate, pool-reuse ratio, and graph churn. Also adds the `harness/VersionMatrix/` regression gate (cold-process, same-host, two baselines) and its checked-in baselines, run on demand via `npm run gate` to check whether a release regresses `frame.avg` on the four reference workloads (reactive-graph-mix, deep-chain, broadcast-fanout, dynamic-dep-churn). Drop-in over 1.3.0. *Shipped.*
918
986
  - **1.5** -- the `signalBox` / `computedBox` allocation-light handle API (staged in `test/24-signalbox`). The pull-mode recursion depth limit (~5,000 chained computeds) remains the main outstanding architectural item.
919
987
 
920
988
  > Note: the retracking rewrite that closes the dynamic-topology gap shipped in **1.1.4**, not a future release. The earlier roadmap that listed it under "v1.2" is superseded.
@@ -1163,11 +1231,14 @@ Yes, if your computeFn reads its deps in the same order each invocation. The `cu
1163
1231
  ## npm scripts
1164
1232
 
1165
1233
  ```bash
1166
- npm test # behavior suite, ~1.3s
1167
- npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1168
- npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1169
- npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
1170
- npm run verify # test + test:gc + sanity bench; gate for publish
1234
+ npm test # behavior suite, ~1.3s
1235
+ npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1236
+ npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1237
+ npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
1238
+ npm run torture # full torture suite, all 8 scenarios
1239
+ npm run torture:semantic # correctness scenarios only, ~10s
1240
+ npm run torture:soak # resource soaks only, wall-clock bound
1241
+ npm run verify # test + sanity bench; run before publishing
1171
1242
  ```
1172
1243
 
1173
1244
  ---
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.4.0
2
+ * @zakkster/lite-signal v1.4.1
3
3
  * --------------------
4
4
  * Hybrid Doubly-Linked-List Reactive Graph Engine -- decoupled (Signal1_3) base
5
5
  * with the two 1.1.3 performance fixes ported in:
@@ -380,6 +380,14 @@ export function createRegistry(config) {
380
380
  if (linkPool.length > currentLinkCapacity) {
381
381
  let doubled = currentLinkCapacity;
382
382
  while (doubled < linkPool.length) doubled *= 2;
383
+ // The `> maxLinkLimit` arm is provably unreachable, retained as a clamp.
384
+ // Proof: maxLinkLimit === initialLinkCapacity * 16, currentLinkCapacity is
385
+ // only ever assigned a power-of-2 multiple of that same initial capacity,
386
+ // so 16x is ON the doubling chain (m, 2m, 4m, 8m, 16m). The guard above
387
+ // (`linkPool.length >= maxLinkLimit -> CapacityError`) plus the chunk math
388
+ // (`chunk = limit - linkPool.length`) cap linkPool.length AT maxLinkLimit,
389
+ // so `doubled` terminates at exactly 16m and can never exceed it.
390
+ /* c8 ignore next -- unreachable clamp; see proof above + COVERAGE-NOTES.md */
383
391
  currentLinkCapacity = doubled > maxLinkLimit ? maxLinkLimit : doubled;
384
392
  statPoolGrowths++; // 1.4: link capacity ledger crossed
385
393
  }
@@ -412,7 +420,12 @@ export function createRegistry(config) {
412
420
 
413
421
  /** Return a link to the free pool and unlink it from the source's sub list. @private */
414
422
  function freeLink(link, target, source) {
415
- if (mutationHook !== null) mutationHook(4, link.source !== null ? link.source.id : -1, link.target !== null ? link.target.id : -1);
423
+ // Every caller (allocateLink sever, severTail, disposeNode dep-walk) passes a
424
+ // LIVE link: `source === link.source`, `target === link.target`. The 1.3.x
425
+ // `link.source !== null ? ... : -1` guards existed only to survive a cursor
426
+ // dangling at an already-freed link -- a state disposeNode's CURSOR REPAIR now
427
+ // makes unreachable. Reading the params directly is equivalent and branch-free.
428
+ if (mutationHook !== null) mutationHook(4, source.id, target.id);
416
429
  const pSub = link.prevSub;
417
430
  const nSub = link.nextSub;
418
431
  if (pSub !== null) pSub.nextSub = nSub; else source.headSub = nSub;
@@ -523,6 +536,17 @@ export function createRegistry(config) {
523
536
  if (pDep !== null) pDep.nextDep = nDep; else target.headDep = nDep;
524
537
  if (nDep !== null) nDep.prevDep = pDep; else target.tailDep = pDep;
525
538
 
539
+ // CURSOR REPAIR (1.4.0): `target` may be an observer that is MID-RUN with
540
+ // its re-tracking cursor parked on this very link -- it linked `source` on
541
+ // the previous run, has not reached that read yet on this one, and now
542
+ // disposes `source` from its own body. Splicing the link out and handing it
543
+ // to the free list would leave activeObserverCurrentDep dangling at a freed
544
+ // slot: severTail would then read a nulled prevDep, wipe target.headDep
545
+ // (orphaning every surviving dep), and double-free the link -- freeLink
546
+ // null-derefs on `source.headSub`. Advance the cursor to the next surviving
547
+ // dep instead. Disposal path only; no steady-state cost.
548
+ if (activeObserverCurrentDep === sLink) activeObserverCurrentDep = nDep;
549
+
526
550
  sLink.source = null;
527
551
  sLink.target = null;
528
552
  sLink.prevDep = null;
@@ -1238,6 +1262,10 @@ export function createRegistry(config) {
1238
1262
  function batch(fn) {
1239
1263
  if (batchDepth === 0) {
1240
1264
  batchEpoch = (batchEpoch + 1) | 0;
1265
+ // 2^32 wraparound sentinel: batchEpoch is bumped ONLY here (and reset to 1 by
1266
+ // destroy()), so reaching 0 costs 4,294,967,295 top-level batch() calls. Kept
1267
+ // because revertEpoch comparisons at 1071/1077 treat 0 as "no capture".
1268
+ /* c8 ignore next -- 2^32 wraparound; unreachable without ~4.3e9 batches */
1241
1269
  if (batchEpoch === 0) batchEpoch = 1;
1242
1270
  }
1243
1271
  batchDepth = (batchDepth + 1) | 0;
package/llms.txt CHANGED
@@ -50,7 +50,22 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
50
50
 
51
51
  ## Version notes
52
52
 
53
- - **1.4.0-beta** (current): the **observability minor**. `stats()` gains three
53
+ - **1.4.1** (current): the **verification-surface patch**. No engine change --
54
+ the only edit to `Signal.js` is the version string in its header banner, and
55
+ `Signal.d.ts` is untouched. `bench/torture/` gains five deterministic
56
+ correctness scenarios (`oracle-fuzzer`, `glitch-hunter`, `work-accounting`,
57
+ `concurrent-storm`, `scheduler-storm`), one runner (`bench/torture/run.mjs`)
58
+ with `semantic` / `soak` groups, and shared helpers. The three pre-existing
59
+ soaks assert only on liveness -- nothing threw, the pool came back -- and pass
60
+ green on an engine whose computeds return stale values; the semantic group
61
+ closes that gap. Mutation-verified: removing the `node.gen === gen` guard from
62
+ the cached scheduler thunk is caught by `scheduler-storm` and missed by all
63
+ 405 unit tests. Also fixes a reachable JIT-sink sentinel that printed
64
+ `impossible` to stdout on a healthy 1.4.0 soak run, and a pass line that
65
+ claimed the pool "returned to baseline" when the assertion was a leaf-only
66
+ floor. Nothing here ships: `files[]` excludes `bench/`.
67
+
68
+ - **1.4.0**: the **observability minor**. `stats()` gains three
54
69
  cumulative lifecycle counters -- `totalAllocations`, `totalDisposals`,
55
70
  `poolGrowths` -- the surface reserved for 1.4.0 in the 1.2.x/1.3.0 notes, now
56
71
  delivered. **The hot paths and public callable API are byte-identical to 1.3.0**;
@@ -68,10 +83,12 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
68
83
  rate (delta totalAllocations / delta t), pool-reuse ratio
69
84
  (1 - poolGrowths*initialCap/totalAllocations), and churn without the engine
70
85
  computing rates -- the series lite-devtools 1.2 / lite-studio 1.2 plot. **Tests:**
71
- 429 total, 419 pass, 0 fail, 10 skip (6 new counter tests in `test/03-pool_test.mjs`
86
+ 425 total, 415 pass, 0 fail, 10 skip (6 counter tests in `test/03-pool.test.mjs`
72
87
  cover the 11-key shape, the live invariant, poolGrowths firing on growth vs staying
73
- 0 on a sized eager pool, and destroy() reset). **Coverage:** `Signal.js` 100%
74
- statements / 98.26% branches / 100% functions / 100% lines; `Watch.js` 100%.
88
+ 0 on a sized eager pool, and destroy() reset; the 1.4.0-rc coverage pass added four
89
+ branch-closure tests to `test/12-coverage.test.mjs`). **Coverage:** `Signal.js` 100%
90
+ statements / 100% branches / 100% functions / 100% lines; `Watch.js` 100%
91
+ (re-verify against your own runner).
75
92
  **Test layout in 1.4.0:** the repo now ships three opt-in harness subdirectories
76
93
  -- `test/ProfilerTests/` (version-portable engine hardening, feature-gated, runs
77
94
  via `npm run test:hardening`), `harness/ProfilerTools/` (combined
@@ -80,8 +97,8 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
80
97
  `npm test` is scoped to `'test/*.test.mjs'` (Node 22 native glob) so subdirectory
81
98
  and out-of-tree test files are no longer swept in. Drop-in over 1.3.0.
82
99
  **VersionMatrix regression gate (`harness/VersionMatrix/`):** a same-host,
83
- cold-process performance gate wired into `prepublishOnly` -- a candidate that
84
- regresses beyond calibrated tolerances aborts `npm publish` before it starts.
100
+ cold-process performance gate run on demand via `npm run gate` -- a candidate that
101
+ regresses beyond calibrated tolerances is flagged against the current tree.
85
102
  Each version-x-workload is profiled in its own `node` invocation (V8 never
86
103
  carries inline caches or JIT state across versions), fed an identical LCG write
87
104
  sequence (delta = engine change, not input), and reduced to a per-metric
@@ -97,7 +114,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
97
114
  baselines under `harness/VersionMatrix/baselines/<version>/*.json` carry `env`
98
115
  metadata (CPU, node, date) as public evidence; the gate itself always
99
116
  re-captures floor / rolling / candidate in the same job so it never diffs
100
- across hosts. Commands: `npm run gate` (prepublish), `npm run calibrate`
117
+ across hosts. Commands: `npm run gate` (on-demand regression gate), `npm run calibrate`
101
118
  (measure self-noise), `bash matrix.sh gate <version>` (published candidate),
102
119
  `node diff.mjs` (diagnostic over committed baselines). Details in
103
120
  `harness/VersionMatrix/README.md`.
@@ -135,11 +152,12 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
135
152
  allocation counters (`totalAllocations` / `totalDisposals` / `poolGrowths`) remain
136
153
  reserved for 1.4.0 and are still absent. **Tests:** 423 total, 413 pass, 0 fail,
137
154
  10 skip (the 10 skips are 9 signalBox-staged-for-1.5.0 in
138
- `test/24-signalbox_test.mjs` plus 1 architecturally-N/A SSR case in
139
- `17-reactivity`); 4 new pool tests in `test/03-pool_test.mjs` cover the lazy
155
+ `test/24-signalbox.test.mjs` plus 1 architecturally-N/A SSR case in
156
+ `17-reactivity`); 4 new pool tests in `test/03-pool.test.mjs` cover the lazy
140
157
  on-demand / never-allocated-destroy / grow-extends-ledger / link-ceiling paths.
141
- **Coverage** (c8@11, Node 22): `Signal.js` 100% statements / 98.26% branches /
142
- 100% functions / 100% lines; `Watch.js` 100% across all four. Behavior-
158
+ **Coverage** (c8@11, Node 22): `Signal.js` 100% statements / 100% branches /
159
+ 100% functions / 100% lines; `Watch.js` 100% across all four (rc coverage pass;
160
+ reconfirm under codify). Behavior-
143
161
  preservation difftest: 20,000 direct + 10,000 batched writes vs the published
144
162
  1.1.5 reference, 0 disagreements -- pool growth, chunked refill, and the intrusive
145
163
  mark stack do not alter observable propagation. Drop-in over 1.2.2.
@@ -186,17 +204,17 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
186
204
  the `ReactiveNode` constructor initializes them to the same values on the
187
205
  fresh-pool-growth path -- so the redundant writes in `createNode` were
188
206
  defense against a state that cannot exist. **No public surface change, no
189
- semantic change.** New `test/26-free-list-invariant_test.mjs` (3 invariant
207
+ semantic change.** New `test/26-free-list-invariant.test.mjs` (3 invariant
190
208
  tests + 1 targeted coverage test for the swallow-on-self-dispose-then-throw
191
209
  branch in `pullComputed`) asserts the invariant directly by inspecting
192
210
  freshly-allocated nodes via the documented `describe()` -> `NODE_PTR`
193
- introspection protocol; new `test/25-devtools-real-boot_test.mjs` (10 tests)
211
+ introspection protocol; new `test/25-devtools-real-boot.test.mjs` (10 tests)
194
212
  boots the actual `Devtools.js` against the 1.2.2 engine and pins the 1.2.x
195
213
  introspection contract for downstream tooling, including the 8-key
196
214
  `stats()` shape (`signals`, `computeds`, `effects`, `activeNodes`,
197
215
  `activeLinks`, `pooledLinks`, `nodePoolCapacity`, `linkPoolCapacity`).
198
216
  408 tests total: 398 pass, 10 skip, 0 fail (the 10 skips are 9
199
- signalBox-staged-for-1.5.0 in `test/24-signalbox_test.mjs` plus 1
217
+ signalBox-staged-for-1.5.0 in `test/24-signalbox.test.mjs` plus 1
200
218
  architecturally-N/A SSR case in `17-reactivity`). Coverage on `Signal.js`:
201
219
  100% statements / 98.43% branches / 100% functions / 100% lines; `Watch.js`
202
220
  100% across all four (c8@11, Node 22) -- a branch-coverage gain over the
@@ -282,7 +300,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
282
300
  own `{ id, kind, value }` descriptor, **re-walkable** (pass it back into
283
301
  `forEachObserver`/`forEachSource` to walk the full DAG); `forEach*` descriptors now carry
284
302
  `id`. One SMI write at allocation, node shape kept monomorphic -- **zero steady-state
285
- cost**. Drop-in over 1.1.4, no breaking changes. New `test/18-identity_test.mjs` (5 tests); plus `14-lifecycle-teardown`, `16-alien-parity`, and the `17-reactivity` behavioral suite.
303
+ cost**. Drop-in over 1.1.4, no breaking changes. New `test/18-identity.test.mjs` (5 tests); plus `14-lifecycle-teardown`, `16-alien-parity`, and the `17-reactivity` behavioral suite.
286
304
 
287
305
  - **1.1.4**: combined release -- a retracking rewrite plus an observer-lifecycle
288
306
  introspection surface. Drop-in over 1.1.3. **Retracking:** version-stamped O(1)
@@ -293,7 +311,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
293
311
  wide dense` 5115ms->912ms (verified by `retracking.difftest.mjs`: 20k direct + 10k batched, 0
294
312
  disagreements; no regressions elsewhere). **Introspection:** `hasObservers`,
295
313
  `observeObservers`, `forEachObserver`, `forEachSource` (top-level + per-registry), gated by
296
- an internal counter so zero steady-state cost when unused. New `test/13-introspection_test.mjs`
314
+ an internal counter so zero steady-state cost when unused. New `test/13-introspection.test.mjs`
297
315
  (10 tests). Internally staged as 1.1.4 + 1.1.5; ships as a single 1.1.4.
298
316
 
299
317
  - **1.1.3**: adds `isTracking()` (top-level + per-registry). Returns true iff a
@@ -568,38 +586,39 @@ function dumpOwnerTree(handle, depth = 0) {
568
586
 
569
587
  - `Signal.js` -- full implementation, single file.
570
588
  - `Signal.d.ts` -- TypeScript declarations for all public API.
571
- - `test/01-core_test.mjs` -- signal/computed/effect basics, equality, untrack.
572
- - `test/02-topology_test.mjs` -- diamonds, chains, fan-out/in, cycle detection.
573
- - `test/03-pool_test.mjs` -- capacity errors, grow policy, pool reuse.
574
- - `test/04-zero-gc_test.mjs` -- heap retention (run with --expose-gc).
575
- - `test/05-scheduler_test.mjs` -- scheduler races, dispose, gen counter, version wrap.
576
- - `test/06-nested-objects_test.mjs` -- nested-object & reference-identity behaviours.
577
- - `test/07-dispose_test.mjs` -- universal disposal: registry.dispose(api).
578
- - `test/08-watch_test.mjs` -- new watch reactivity tests.
579
- - `test/09-conformance_test.mjs` -- johnsoncodehk/reactive-framework-test-suite conformance fixes tests.
580
- - `test/10-is-tracking_test.mjs` -- `isTracking()` across observer bodies, untracked windows, and outside any observer.
581
- - `test/11-adopted-reactive_test.mjs` -- engine-agnostic edge cases adopted from the wider ecosystem (alien-signals link-integrity #226-228, equality-predicate corners, `update()`/`peek()`/`subscribe` contracts).
582
- - `test/12-coverage_test.mjs` -- targeted public-surface + hot-path branch coverage (top-level routing, clean-read short-circuit, tail severance, scheduler ABA); owner-tree block capability-gated.
583
- - `test/13-introspection_test.mjs` -- observer-lifecycle surface: `hasObservers`, `observeObservers` auto-pause, `forEach*` enumeration (10 tests).
584
- - `test/14-lifecycle-teardown_test.mjs` -- effect-teardown guards: stopped effect doesn't re-subscribe to a signal read later in the same run, self-dispose leaves no orphan link, throwing setup leaves no live subscription (4 tests).
585
- - `test/15-owner-lazy-alloc_test.mjs` -- owner-adoption contract for the 1.2.0 owner tree (lazy signals never adopted; observers still auto-disposed); capability-gated, skipped on 1.1.x (4 tests).
586
- - `test/16-alien-parity_test.mjs` -- differential guards vs alien-signals@3.2.0 fixed-bug classes: cleanup reads create no deps, inner write doesn't block computed-chain propagation, dynamic dep-set correct under dirty-check (3 tests).
587
- - `test/17-reactivity_test.mjs` -- behavioral suite over universal signal-system bug classes (subscription lifecycle, cleanup ordering, stale-dep tracking, batching, equality, nested invalidation, memory, sync async-boundary, scheduler/loops, + differential-review additions); SSR is N/A (~30 tests).
588
- - `test/18-identity_test.mjs` -- node identity (1.1.5): `nodeId`/`describe`, descriptor `id`, re-walkable descriptors, non-perturbing (5 tests).
589
- - `test/19-v12-additions_test.mjs` -- 1.2.0 surface coverage: shared-peek, owner-adoption rule, pre-batch revert (24 tests).
590
- - `test/20-axis-stress_test.mjs` -- eight orthogonal stress axes (batch-under-exception, connect/disconnect re-entrancy, untrack vs owner cascade, etc.) (23 tests).
591
- - `test/21-perf-pins_test.mjs` -- 1.2.1 construction-shape + ABA-guard pins (6 tests).
592
- - `test/22-mutation-hook_test.mjs` -- 1.2.1 `onGraphMutation` registration + opcode emission (12 tests).
593
- - `test/23-owner-introspection_test.mjs` -- `ownerOf`, `forEachOwned`, gen-guarded introspection (14 tests).
594
- - `test/24-signalbox_test.mjs` -- staged for 1.5.0; all tests `{skip: true}` on 1.2.x.
595
- - `test/25-devtools-real-boot_test.mjs` -- 1.2.2: real `Devtools.js` boot against the engine, ghost-contract pin, `stats()` shape pin (10 tests).
596
- - `test/26-free-list-invariant_test.mjs` -- 1.2.2: the audit's clean-free-list invariant, asserted by inspecting freshly-allocated nodes (4 tests).
589
+ - `test/01-core.test.mjs` -- signal/computed/effect basics, equality, untrack.
590
+ - `test/02-topology.test.mjs` -- diamonds, chains, fan-out/in, cycle detection.
591
+ - `test/03-pool.test.mjs` -- capacity errors, grow policy, pool reuse.
592
+ - `test/04-zero-gc.test.mjs` -- heap retention (run with --expose-gc).
593
+ - `test/05-scheduler.test.mjs` -- scheduler races, dispose, gen counter, version wrap.
594
+ - `test/06-nested-objects.test.mjs` -- nested-object & reference-identity behaviours.
595
+ - `test/07-dispose.test.mjs` -- universal disposal: registry.dispose(api).
596
+ - `test/08-watch.test.mjs` -- new watch reactivity tests.
597
+ - `test/09-conformance.test.mjs` -- johnsoncodehk/reactive-framework-test-suite conformance fixes tests.
598
+ - `test/10-is-tracking.test.mjs` -- `isTracking()` across observer bodies, untracked windows, and outside any observer.
599
+ - `test/11-adopted-reactive.test.mjs` -- engine-agnostic edge cases adopted from the wider ecosystem (alien-signals link-integrity #226-228, equality-predicate corners, `update()`/`peek()`/`subscribe` contracts).
600
+ - `test/12-coverage.test.mjs` -- targeted public-surface + hot-path branch coverage (top-level routing, clean-read short-circuit, tail severance, scheduler ABA); owner-tree block capability-gated.
601
+ - `test/13-introspection.test.mjs` -- observer-lifecycle surface: `hasObservers`, `observeObservers` auto-pause, `forEach*` enumeration (10 tests).
602
+ - `test/14-lifecycle-teardown.test.mjs` -- effect-teardown guards: stopped effect doesn't re-subscribe to a signal read later in the same run, self-dispose leaves no orphan link, throwing setup leaves no live subscription (4 tests).
603
+ - `test/15-owner-lazy-alloc.test.mjs` -- owner-adoption contract for the 1.2.0 owner tree (lazy signals never adopted; observers still auto-disposed); capability-gated, skipped on 1.1.x (4 tests).
604
+ - `test/16-alien-parity.test.mjs` -- differential guards vs alien-signals@3.2.0 fixed-bug classes: cleanup reads create no deps, inner write doesn't block computed-chain propagation, dynamic dep-set correct under dirty-check (3 tests).
605
+ - `test/17-reactivity.test.mjs` -- behavioral suite over universal signal-system bug classes (subscription lifecycle, cleanup ordering, stale-dep tracking, batching, equality, nested invalidation, memory, sync async-boundary, scheduler/loops, + differential-review additions); SSR is N/A (~30 tests).
606
+ - `test/18-identity.test.mjs` -- node identity (1.1.5): `nodeId`/`describe`, descriptor `id`, re-walkable descriptors, non-perturbing (5 tests).
607
+ - `test/19-v12-additions.test.mjs` -- 1.2.0 surface coverage: shared-peek, owner-adoption rule, pre-batch revert (24 tests).
608
+ - `test/20-axis-stress.test.mjs` -- eight orthogonal stress axes (batch-under-exception, connect/disconnect re-entrancy, untrack vs owner cascade, etc.) (23 tests).
609
+ - `test/21-perf-pins.test.mjs` -- 1.2.1 construction-shape + ABA-guard pins (6 tests).
610
+ - `test/22-mutation-hook.test.mjs` -- 1.2.1 `onGraphMutation` registration + opcode emission (12 tests).
611
+ - `test/23-owner-introspection.test.mjs` -- `ownerOf`, `forEachOwned`, gen-guarded introspection (14 tests).
612
+ - `test/24-signalbox.test.mjs` -- staged for 1.5.0; all tests `{skip: true}` on 1.2.x.
613
+ - `test/25-devtools-real-boot.test.mjs` -- 1.2.2: real `Devtools.js` boot against the engine, ghost-contract pin, `stats()` shape pin (10 tests).
614
+ - `test/26-free-list-invariant.test.mjs` -- 1.2.2: the audit's clean-free-list invariant, asserted by inspecting freshly-allocated nodes (4 tests).
597
615
  - `test/ProfilerTests/` -- version-portable engine hardening suite. Own `package.json`, own `node:test`. Imports `@zakkster/lite-signal` as bare specifier; self-references in-tree, resolves to the installed version when run standalone. Feature-gated cases activate automatically as the engine gains APIs. Run via `npm run test:hardening` (in-tree) or `./run-matrix.sh` (standalone matrix vs published lines).
598
- - `harness/ProfilerTools/` -- combined integration harness: `@zakkster/lite-profiler-signal` + `@zakkster/lite-devtools` pointed at the same lite-signal registry. Verifies the cross-package zero-GC contract end-to-end (devtools inspects a profiler-driven graph non-perturbingly; the profiler allocates no new nodes in steady state). Own `package.json`, one-time setup via `bash setup.sh` (pins peer deps via tarball). Run via `npm run test:harness`. Both harnesses are opt-in: `npm test` from root is scoped to `'test/*.test.mjs'` and does NOT sweep them.
616
+ - `harness/ProfilerTools/` -- combined integration harness: `@zakkster/lite-profiler-signal` + `@zakkster/lite-devtools` pointed at the same lite-signal registry. Verifies the cross-package zero-GC contract end-to-end (devtools inspects a profiler-driven graph non-perturbingly; the profiler allocates no new nodes in steady state). Own `package.json`, one-time setup via `bash setup.sh`. IMPORTANT SCOPE NOTE: `setup.sh` hard-pins `@zakkster/lite-signal@1.6.0-preview.2` from the registry and extracts it into the harness's own `node_modules` -- nothing resolves to `../../Signal.js`, so this harness does NOT exercise the local working tree. It proves the cross-package contract across the PUBLISHED chain a consumer installs, not local changes; a green `npm run test:all` is therefore not by itself clearance to publish. For the local engine use `npm test`, `npm run torture`, and `npm run test:hardening` (`test/ProfilerTests/` self-references in-tree). Last verified: 5/5 passing, `activeNodes 22 -> 22` across 2,000 driven frames. The two capability assertions in `harness.test.mjs` (`cap.owners`, `cap.mutationHook`) are written against the 1.6 surface and must be rechecked when the pin is bumped. Run via `npm run test:harness`. Both harnesses are opt-in: `npm test` from root is scoped to `'test/*.test.mjs'` and does NOT sweep them.
599
617
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
600
618
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
601
619
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
602
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
620
+ - `bench/torture/` -- eight scenarios behind one runner (`run.mjs`), two groups. `semantic` (deterministic, fast, asserts on MEANING; run in CI): `oracle-fuzzer` (every computed vs an independent uncached reference evaluator, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeup counts), `work-accounting` (minimum body-execution counts over 10 topologies), `concurrent-storm` (8 reentrancy / flush-ordering contracts), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing scheduler containment). `soak` (wall-clock bound, asserts on RESOURCES; run nightly): `graph-fuzzer`, `scheduler-bench`, `torture-soak` -- exit 0 iff zero errors AND post-teardown pool at or below its leaf-only floor AND the JIT sink advanced. The runner spawns each scenario as a child process because several assert on global pool accounting, and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
621
+ - `bench/torture/helpers/index.mjs` -- shared torture infrastructure: seeded `mulberry32` (failures replay from their seed), `soakRegistry` / `fixedRegistry`, `createReport` (collects failures rather than throwing on the first), and `VALUE_POOL`, the adversarial value domain containing the pairs where candidate equality definitions disagree (`Object.is` vs `===` on NaN and -0/0; `===` vs `==` on 0/""/false/"0" and null/undefined). Dependency-free and side-effect-free by contract: importing it must not touch the default registry.
603
622
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
604
623
  - `demo/index.html` -- interactive visualization of the reactive graph.
605
624
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.4.0-rc.1",
3
+ "version": "1.4.1",
4
4
  "description": "Zero-GC reactive graph. Monomorphic object pool, versioned push-pull propagation, 32-bit modular versioning. Built for hot paths and long-running processes.",
5
5
  "author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "test": "node --test --test-reporter=spec 'test/*.test.mjs'",
30
30
  "test:gc": "node --expose-gc --test --test-reporter=spec 'test/*.test.mjs'",
31
31
  "test:coverage": "c8 node --test --test-reporter=spec 'test/*.test.mjs'",
32
+ "test:report": "c8 --reporter=lcov --reporter=text node --test --test-reporter=spec 'test/*.test.mjs'",
32
33
  "test:hardening": "npm --prefix test/ProfilerTests test",
33
34
  "test:hardening:gc": "npm --prefix test/ProfilerTests run test:gc",
34
35
  "test:harness": "npm --prefix harness/ProfilerTools test",
@@ -37,7 +38,9 @@
37
38
  "bench-reactive": "node --expose-gc bench/benchmarkReactive.mjs",
38
39
  "verify": "npm test && npm run bench",
39
40
  "gate": "node harness/VersionMatrix/pre-publish.mjs",
40
- "prepublishOnly": "node harness/VersionMatrix/pre-publish.mjs"
41
+ "torture": "node bench/torture/run.mjs",
42
+ "torture:semantic": "node bench/torture/run.mjs --group semantic",
43
+ "torture:soak": "node bench/torture/run.mjs --group soak"
41
44
  },
42
45
  "keywords": [
43
46
  "signal",
@@ -74,11 +77,12 @@
74
77
  },
75
78
  "sideEffects": false,
76
79
  "devDependencies": {
77
- "c8": "^11.0.0",
78
- "@zakkster/lite-devtools": "^1.1.0",
79
- "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
80
+ "@zakkster/lite-devtools": "^1.2.0",
80
81
  "@zakkster/lite-profiler": "^1.1.0",
81
- "@zakkster/lite-profiler-signal": "^1.2.0"
82
+ "@zakkster/lite-profiler-signal": "^1.2.0",
83
+ "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
84
+ "c8": "^11.0.0",
85
+ "coveralls-next": "^6.0.2"
82
86
  },
83
87
  "overrides": {
84
88
  "@zakkster/lite-time": {