@zakkster/lite-signal 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,80 @@ 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.4] -- 2026-08-03
8
+
9
+ The verification-surface patch, round four. **The engine is unchanged**: as in
10
+ 1.4.1/1.4.2/1.4.3, the only edit to `Signal.js` is the version string in its header
11
+ banner, and `Signal.d.ts` is untouched. Everything here lives in `bench/torture/`
12
+ and `test/`, neither of which ships the engine -- `files[]` excludes `bench/`. If
13
+ you consume the package, 1.4.4 is byte-for-byte 1.4.3 plus a version number.
14
+
15
+ 1.4.3 gated the zero-GC claim. This round closes the remaining gaps at the ERROR
16
+ edges -- the paths that only run when user code throws or a graph is pushed past a
17
+ structural limit -- and turns the three soaks from liveness-only into
18
+ value-correctness gates.
19
+
20
+ ### Added -- two semantic scenarios (suite now 22)
21
+
22
+ - `bench/torture/error-torture.mjs` -- throwing effect BODIES under flush.
23
+ `flushEffects` buffers each per-effect throw into a pre-allocated buffer, keeps
24
+ the remaining queued effects running, and only then surfaces what it caught:
25
+ a single throw is re-thrown UNWRAPPED (the original error), two-or-more become a
26
+ single `AggregateError` carrying EXACTLY those errors in order. This is a stress
27
+ scenario, not a unit duplicate of `test/09-conformance`: it asserts what the unit
28
+ tests do not -- that survivors in the same pass still run, and that the buffer
29
+ returns to baseline under 4096 throw/clean cycles so nothing bleeds between
30
+ flushes (a clean flush after a throwing one throws nothing, `stats()` never
31
+ drifts).
32
+ - `bench/torture/deep-chain-torture.mjs` -- `pullComputed` recursion, fail-closed.
33
+ `pullComputed` is call-stack recursive, so a deep computed chain read fails
34
+ CLOSED with a `RangeError` beyond the host stack rather than corrupting anything.
35
+ Depth is RAMPED, never pinned (the exact throwing depth is host-dependent): it
36
+ asserts only that some depth <= 100k throws a `RangeError`, then that the registry
37
+ that threw is STILL usable (a fresh small graph builds and evaluates correctly,
38
+ effects included) and that the iterative PUSH path -- an equally deep effect
39
+ cascade, flush-pass budget raised to match -- propagates end to end without
40
+ throwing, contrasting the heap-iterative scheduler against the stack-recursive
41
+ pull.
42
+
43
+ ### Added -- `test/27-throwing-equals.test.mjs`, a throwing user `equals`
44
+
45
+ `equals` is user code the engine calls on the hot write/recompute path and does
46
+ not sandbox. This file pins its behaviour at all three call sites: (a) the signal
47
+ `set` pre-check -- the original error propagates and the signal is left unmutated,
48
+ no downstream fires; (b) the batch revert check -- PINNED, not asserted-as-atomic:
49
+ the throw at that site happens after `node.value` was written but before the
50
+ version bump, so the net value is correct yet downstream FIRES (the throw stranded
51
+ the version bump, defeating the revert), documented exactly so a future move to an
52
+ atomic revert trips the pin; (c) computed re-eval -- caught, cached as
53
+ `FLAG_HAS_ERROR`, re-thrown on every read until a dep change re-evaluates cleanly
54
+ and clears it.
55
+
56
+ ### Changed -- capacity ceiling + soak value oracles
57
+
58
+ - `bench/torture/capacity-torture.mjs` gains the 16x link grow ceiling: under
59
+ `grow`, link growth is capped at `maxLinks * 16` and throws `CapacityError`
60
+ with `kind: "links"` and `capacity` equal to the ceiling AT the ceiling --
61
+ growth terminates exactly at `16x` (`linkPoolCapacity === 128` for `maxLinks: 8`,
62
+ not one chunk over) -- and the overflowed computed still re-throws on read
63
+ rather than leaking a partial sum. Every pre-existing case is intact.
64
+ - `graph-fuzzer.mjs`, `torture-soak.mjs`, `scheduler-bench.mjs` each gain a
65
+ value-correctness ORACLE. Each shadows its signals in a single `Int32Array`
66
+ allocated ONCE outside the churn loop, updated in lockstep with every write, and
67
+ asserts the engine's value equals the model on a rotating window each tick plus a
68
+ full sweep at teardown -- zero per-tick allocation, so the implicit pool-to-floor
69
+ gate is not regressed. All prior liveness assertions (0 errors, pool-to-floor,
70
+ JIT sink advanced) are preserved; the soaks now assert value-correctness, not
71
+ just liveness. Mutation-verified: corrupting one shadow write makes the soak exit
72
+ non-zero.
73
+
74
+ ### Verified -- full suite green on the 1.4.4 engine (Node 22, `--expose-gc`)
75
+
76
+ - **Torture:** 22/22 -- `error-torture` and `deep-chain-torture` PASS; the three
77
+ soaks report `value mismatches: 0`.
78
+ - The engine is byte-for-byte 1.4.3; the unit suite grows only by `test/27`
79
+ (7 new tests) and no prior test regressed.
80
+
7
81
  ## [1.4.3] -- 2026-08-02
8
82
 
9
83
  The verification-surface patch, round three. **The engine is unchanged**: as in
package/README.md CHANGED
@@ -761,13 +761,13 @@ npm run bench
761
761
 
762
762
  ### Tier 4 -- Torture (correctness and resources under chaos)
763
763
 
764
- `bench/torture/` holds **20 scenarios (17 semantic + 3 soak)** in two groups,
764
+ `bench/torture/` holds **22 scenarios (19 semantic + 3 soak)** in two groups,
765
765
  behind one runner. They are not perf benchmarks: the ops/sec figures reflect
766
766
  random workload composition, not engine throughput -- `bench/benchmark.mjs`
767
767
  remains the canonical perf harness. Every scenario feature-detects and **skips
768
768
  cleanly** below the engine version that introduces its feature (`SKIP: <feature>
769
769
  requires <version>+`, exit 0), so the whole directory rides this 1.4.x base
770
- forward through 1.9. On the 1.4.x engine, **11 semantic scenarios execute and 6
770
+ forward through 1.9. On the 1.4.x engine, **13 semantic scenarios execute and 6
771
771
  self-skip**.
772
772
 
773
773
  ```bash
@@ -804,7 +804,9 @@ Run these on every commit. They pin values, wakeups, work and ordering.
804
804
  | `introspect-torture` | the read-only introspection surface (`describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers`): walk agreement vs the real edge set incl. dynamic rewiring, `hasObservers` transitions, and the ABA gen-stamp guard (a stale descriptor resolves to nothing, never a recycled resident) |
805
805
  | `lifecycle-torture` | `destroy` (1.4.0+) registry reset: handles staled via gen-bump, stale writes no-op, pool reusable, idempotent. Its `createRoot` half is 1.5.0+ and self-skips on this base |
806
806
  | `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
807
- | `capacity-torture` | the fail-closed pool boundary: exact node/link ceilings, `CapacityError`, `grow` mode crossing the boundary, no partial value escapes |
807
+ | `capacity-torture` | the fail-closed pool boundary: exact node/link ceilings, `CapacityError`, `grow` mode crossing the boundary AND its 16x link ceiling (`grow` throws at `maxLinks*16`, growth terminating exactly at the ceiling), no partial value escapes |
808
+ | `error-torture` | throwing effect BODIES under flush: a single throw re-thrown unwrapped, two-or-more into an `AggregateError` carrying exactly those errors, survivors in the same pass still run, and the error buffer drains to baseline over 4096 throw/clean cycles |
809
+ | `deep-chain-torture` | `pullComputed` recursion fails CLOSED with a `RangeError` at ramped depth (never pinned); the registry that threw stays usable, and the iterative effect-cascade PUSH path over an equally deep chain does not throw |
808
810
  | `zerogc-torture` | the zero-GC claim, gated by `@zakkster/lite-gc-profiler`: per-call **retained bytes** (`measureAllocs` at `maxBytesPerCall: 0`), **major-GC count + longest pause** (`measureOps`/`checkNoGc`, `stabilize: 'deep'`), and the engine's own `stats()` counters (`poolGrowths`/`totalAllocations` steady, `activeNodes` restored under churn) across five graph shapes. `ZEROGC_BREAK=1` plants a leak the gate must reject; `churn-box` self-skips below 1.5.0 |
809
811
  | `box-torture` (1.5.0+) | `signalBox`/`computedBox` interop + surface -- SKIP on 1.4.x |
810
812
  | `scope-torture` (1.6.0+) | `createScope` adoption + the disposal-crash fuzz -- SKIP on 1.4.x |
@@ -813,12 +815,15 @@ Run these on every commit. They pin values, wakeups, work and ordering.
813
815
  | `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard, computed exclusion -- SKIP on 1.4.x |
814
816
  | `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects (five stamp sites) -- SKIP on 1.4.x |
815
817
 
816
- Why this group exists: the resource soaks below pass green on an engine whose
817
- computeds return stale values. Flipping the clean short-circuit in `pullComputed`
818
- from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws nothing --
819
- `oracle-fuzzer` catches it on 400/400 seeds, and all three soaks report PASS.
820
- Separately, removing the `node.gen === gen` guard from the cached scheduler thunk
821
- is caught by `scheduler-storm` and **missed by all 405 unit tests**.
818
+ Why this group exists: the resource soaks below once passed green on an engine
819
+ whose computeds return stale values. Flipping the clean short-circuit in
820
+ `pullComputed` from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws
821
+ nothing -- `oracle-fuzzer` catches it on 400/400 seeds, and the soaks' *liveness*
822
+ assertions all still reported PASS. As of 1.4.4 each soak also carries a
823
+ value-correctness oracle (below), so a stale-value engine is now caught in the
824
+ soak group too. Separately, removing the `node.gen === gen` guard from the cached
825
+ scheduler thunk is caught by `scheduler-storm` and **missed by all 405 unit
826
+ tests**.
822
827
 
823
828
  Where no contract is documented, these files pin the *observed* behaviour and say
824
829
  so at the scenario, rather than asserting an invented one.
@@ -832,8 +837,13 @@ exits non-zero unless:
832
837
 
833
838
  - zero exceptions were thrown during the run,
834
839
  - after teardown `activeNodes` is at or below its leaf-only floor and
835
- `activeLinks` is exactly `0`, and
836
- - the JIT sink advanced -- proving the accumulator loops were not optimised away.
840
+ `activeLinks` is exactly `0`,
841
+ - the JIT sink advanced -- proving the accumulator loops were not optimised away, and
842
+ - (1.4.4+) the value oracle agrees: a once-allocated `Int32Array` shadow model,
843
+ updated in lockstep with every write and sampled on a rotating window each tick
844
+ plus a full sweep at teardown, matches every signal's value. It adds no per-tick
845
+ allocation, so the implicit pool-to-floor gate is untouched. The soaks now assert
846
+ value-correctness, not just liveness.
837
847
 
838
848
  ```bash
839
849
  node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
@@ -1252,7 +1262,7 @@ npm test # behavior suite, ~1.3s
1252
1262
  npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1253
1263
  npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1254
1264
  npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
1255
- npm run torture # full torture suite, all 20 scenarios
1265
+ npm run torture # full torture suite, all 22 scenarios
1256
1266
  npm run torture:semantic # correctness scenarios only, ~10s
1257
1267
  npm run torture:soak # resource soaks only, wall-clock bound
1258
1268
  npm run verify # test + sanity bench; run before publishing
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.4.3
2
+ * @zakkster/lite-signal v1.4.4
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:
package/llms.txt CHANGED
@@ -50,7 +50,31 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
50
50
 
51
51
  ## Version notes
52
52
 
53
- - **1.4.3** (current): the **verification-surface patch, round three**. No engine
53
+ - **1.4.4** (current): the **verification-surface patch, round four**. No engine
54
+ change -- as in 1.4.1/1.4.2/1.4.3, the only edit to `Signal.js` is the banner
55
+ version string, `Signal.d.ts` is untouched, and `bench/torture/` stays out of
56
+ `files[]`; for consumers 1.4.4 is byte-for-byte 1.4.3 plus a version number. It
57
+ adds **two** semantic torture scenarios -- `error-torture.mjs` (throwing effect
58
+ BODIES under flush: `flushEffects` buffers each per-effect throw, re-throws a
59
+ single one unwrapped, aggregates two-or-more into an `AggregateError` carrying
60
+ exactly those errors, keeps surviving effects running, and drains the buffer to
61
+ a clean baseline over many cycles) and `deep-chain-torture.mjs` (`pullComputed`
62
+ is call-stack recursive, so a deep computed chain fails CLOSED with a RangeError
63
+ beyond the host stack, ramped never pinned; the registry stays usable afterwards
64
+ and the iterative PUSH path -- an equally deep effect cascade -- does not throw)
65
+ -- taking the suite to **22 scenarios (19 semantic + 3 soak); 13 execute on the
66
+ 1.4.x engine**. It also extends `capacity-torture` with the 16x link grow ceiling
67
+ (`grow` throws `CapacityError("links", maxLinks*16)` AT the ceiling, terminating
68
+ the pool exactly at 16x, read edge still fail-closed) and adds a value-correctness
69
+ ORACLE to all three soaks: each now shadows its signals in a once-allocated
70
+ `Int32Array` and asserts the engine's values equal the model on a sampled window
71
+ each tick plus a full final sweep -- so the soaks assert value-correctness, not
72
+ just liveness, with zero per-tick allocation. A new unit file `test/27-throwing-equals`
73
+ pins a throwing user `equals` at its three call sites (signal set pre-check,
74
+ batch revert check, computed re-eval). Verified green: torture 22/22, engine
75
+ byte-identical to 1.4.3, so the unit suite is unaffected (only its count grows).
76
+
77
+ - **1.4.3**: the **verification-surface patch, round three**. No engine
54
78
  change -- as in 1.4.1 and 1.4.2, the only edit to `Signal.js` is the banner
55
79
  version string, `Signal.d.ts` is untouched, and `bench/torture/` stays out of
56
80
  `files[]`; for consumers 1.4.3 is byte-for-byte 1.4.2 plus a version number. It
@@ -657,7 +681,7 @@ function dumpOwnerTree(handle, depth = 0) {
657
681
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
658
682
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
659
683
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
660
- - `bench/torture/` -- **20 scenarios (17 semantic + 3 soak)** behind one runner (`run.mjs`), two groups, forward-compatible through 1.9. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature (`SKIP: <feature> requires <version>+`, exit 0), so the whole directory rides this 1.4.x base forward. `semantic` (deterministic, fast, asserts on MEANING; run in CI) -- the **11 that execute on the 1.4.x engine**: `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), `op-accounting` (structural work via the `onGraphMutation` opcode lane -- op5 identity, equality cutoff, link/node balance, 400-seed differential), `introspect-torture` (the read-only `describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers` surface: walk agreement vs the real edge set incl. dynamic rewiring, and the ABA gen-stamp guard), `lifecycle-torture` (`destroy` 1.4.0+ registry reset -- gen-bump staling, no-op stale writes, pool reuse, idempotence; its `createRoot` half is 1.5.0+ and self-skips), `concurrent-storm` (8 reentrancy / flush-ordering contracts, `CycleError` via `maxFlushPasses`), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing scheduler containment), `async-torture` (`watch`/`when`/`whenAsync` + a 300-seed storm), `capacity-torture` (the fail-closed pool boundary, `CapacityError`, `grow` crossing it, no partial value escapes), `zerogc-torture` (the zero-GC gate -- steady-state writes retain 0 bytes and force 0 major GCs, node churn leaks nothing, via `@zakkster/lite-gc-profiler`'s `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + exact `stats()` deltas, mutation-verified by `ZEROGC_BREAK=1`; its `churn-box` witness self-skips below 1.5.0); plus **6 that self-skip** until their feature exists: `box-torture` (1.5.0), `scope-torture` (1.6.0), `owner-torture` (1.6.0), `flush-torture` (1.7.0), `cleanup-return-torture` (1.8.0), `dispose-torture` (1.9.0). `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. `zerogc-torture` and the soaks require `--expose-gc` (the runner supplies it). Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
684
+ - `bench/torture/` -- **22 scenarios (19 semantic + 3 soak)** behind one runner (`run.mjs`), two groups, forward-compatible through 1.9. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature (`SKIP: <feature> requires <version>+`, exit 0), so the whole directory rides this 1.4.x base forward. `semantic` (deterministic, fast, asserts on MEANING; run in CI) -- the **13 that execute on the 1.4.x engine**: `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), `op-accounting` (structural work via the `onGraphMutation` opcode lane -- op5 identity, equality cutoff, link/node balance, 400-seed differential), `introspect-torture` (the read-only `describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers` surface: walk agreement vs the real edge set incl. dynamic rewiring, and the ABA gen-stamp guard), `lifecycle-torture` (`destroy` 1.4.0+ registry reset -- gen-bump staling, no-op stale writes, pool reuse, idempotence; its `createRoot` half is 1.5.0+ and self-skips), `concurrent-storm` (8 reentrancy / flush-ordering contracts, `CycleError` via `maxFlushPasses`), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing scheduler containment), `async-torture` (`watch`/`when`/`whenAsync` + a 300-seed storm), `capacity-torture` (the fail-closed pool boundary, `CapacityError`, `grow` crossing it AND its 16x link ceiling terminating exactly at `maxLinks*16`, no partial value escapes), `error-torture` (throwing effect bodies under flush: single-throw re-thrown unwrapped, two-or-more into an `AggregateError` carrying exactly those errors, survivors still run, buffer drains to baseline over 4096 cycles), `deep-chain-torture` (`pullComputed` recursion fails closed with a RangeError at ramped depth, registry stays usable, the iterative effect-cascade push path over an equally deep chain does not throw), `zerogc-torture` (the zero-GC gate -- steady-state writes retain 0 bytes and force 0 major GCs, node churn leaks nothing, via `@zakkster/lite-gc-profiler`'s `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + exact `stats()` deltas, mutation-verified by `ZEROGC_BREAK=1`; its `churn-box` witness self-skips below 1.5.0); plus **6 that self-skip** until their feature exists: `box-torture` (1.5.0), `scope-torture` (1.6.0), `owner-torture` (1.6.0), `flush-torture` (1.7.0), `cleanup-return-torture` (1.8.0), `dispose-torture` (1.9.0). `soak` (wall-clock bound, asserts on RESOURCES and now on VALUE-CORRECTNESS; 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 AND a once-allocated `Int32Array` shadow model (sampled on a rotating window each tick, full sweep at teardown, zero per-tick allocation) agrees with every signal value. The runner spawns each scenario as a child process because several assert on global pool accounting, and passes `--expose-gc` unconditionally. `zerogc-torture` and the soaks require `--expose-gc` (the runner supplies it). Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
661
685
  - `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.
662
686
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
663
687
  - `demo/index.html` -- interactive visualization of the reactive graph.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
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",