@zakkster/lite-signal 1.5.1 → 1.5.2

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,49 @@ 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.5.2] -- 2026-09-19
8
+
9
+ Dev-only session: a standing, self-validating zero-GC judge. `Signal.js` is
10
+ byte-identical to 1.5.1 except the version banner comment; no API change, no
11
+ behavior change, no engine logic moved. `Watch.js`, `bench/`, `harness/`, and
12
+ `conformance/` are untouched.
13
+
14
+ ### Added -- perf-gate lane (dev-only, engine-frozen)
15
+
16
+ `@zakkster/lite-perf-gate` (`^1.4.2`, devDependency only -- runtime `dependencies`
17
+ stay empty) joins as the standing verdict on lite-signal's headline zero-GC
18
+ claim. New file `test/32-perf-gate.test.mjs` wires `zgcSuite()` over seven
19
+ claimed-zero steady-state paths, each anchored to its `llms.txt` "Performance
20
+ characteristics" claim and warmed inside `setup()` so the measurement window
21
+ sees only steady state: `set-propagate` (1 signal -> 8 computeds -> 1 effect,
22
+ synchronous flush), `computed-cache-hit`, `computed-recompute-stable`,
23
+ `effect-rerun-stable`, `peek`, `batch-flush` (3 sets/batch), and
24
+ `box-set-propagate` (the 1.5.0 `signalBox`/`computedBox` surface). Five signals
25
+ judge every run -- scavenges, engine counters (`totalAllocations` /
26
+ `totalDisposals` / `poolGrowths`, all budgeted to 0 via per-scenario
27
+ `statsOf`), retained heap, old-gen, and external/arrayBuffers -- at two scales
28
+ (N and k*N), with positive/negative/large detector controls validated on every
29
+ invocation. Two permanent negative controls keep the gate honest: a per-op
30
+ object allocator and a per-op `signal()`+`dispose` churn (the documented
31
+ 264 B/op creation path); both MUST trip the gate.
32
+
33
+ New script `test:gate` (`node --expose-gc --max-semi-space-size=4 --test
34
+ test/32-perf-gate.test.mjs`) runs the gate for real; it is appended to
35
+ `test:all`. The gate file guards on `--expose-gc` AND `--max-semi-space-size=4`
36
+ and otherwise emits ONE loud named skip, so plain `npm test` stays green: this
37
+ lane adds exactly one loud named skip over 1.5.1 (pass count unchanged; the
38
+ other skip is the architecturally-N/A SSR case). `node:test`'s absolute leaf
39
+ tally is node-version-sensitive -- on node v26.8.2 `npm test` reports 513 pass /
40
+ 2 skip. The 16MB `test:gc` lane never produces a false red. Thresholds are lite-perf-gate
41
+ defaults, untouched.
42
+
43
+ ### Docs
44
+
45
+ `llms.txt` gains the perf-gate version note and the fixed 13-key `RegistryStats`
46
+ interface block (`nodePoolPopulation` / `linkPoolPopulation` were described in
47
+ prose since 1.5.0 but missing from the interface listing). README Testing
48
+ strategy gains the gate lane.
49
+
7
50
  ## [1.5.1] -- 2026-09-05
8
51
 
9
52
  Docs + verification patch. `Signal.js` is byte-identical to 1.5.0 except the
package/README.md CHANGED
@@ -559,7 +559,7 @@ Default sizing for a Twitch-extension-style budget:
559
559
  | Heavy dashboard (variable scale) | 2048 | 16384 | `"eager"` | `"grow"` |
560
560
  | Per-viewer sandbox / short-lived | 512 | 2048 | `"lazy"` | `"throw"` |
561
561
 
562
- `stats()` reports 11 keys: eight live gauges -- `signals`, `computeds`, `effects`, `activeNodes`, `activeLinks`, `pooledLinks`, `nodePoolCapacity`, `linkPoolCapacity` (the capacity keys are ledgers under `"lazy"`) -- plus three cumulative lifecycle counters added in **1.4.0**: `totalAllocations`, `totalDisposals`, and `poolGrowths` (monotonic over the registry's life, reset only by `destroy()`). Sample them over time to chart allocation rate, pool-reuse ratio, and graph churn; in a quiescent registry `totalAllocations - totalDisposals === activeNodes`. Drop it on screen for live observability.
562
+ `stats()` reports 13 keys: ten live gauges -- `signals`, `computeds`, `effects`, `activeNodes`, `activeLinks`, `pooledLinks`, `nodePoolCapacity`, `linkPoolCapacity` (the capacity keys are ledgers under `"lazy"`), plus `nodePoolPopulation` / `linkPoolPopulation` (**1.5.0**: the true constructed-object counts, distinct from the capacity ledgers) -- plus three cumulative lifecycle counters added in **1.4.0**: `totalAllocations`, `totalDisposals`, and `poolGrowths` (monotonic over the registry's life, reset only by `destroy()`). Sample them over time to chart allocation rate, pool-reuse ratio, and graph churn; in a quiescent registry `totalAllocations - totalDisposals === activeNodes`. Drop it on screen for live observability.
563
563
 
564
564
  </details>
565
565
 
@@ -767,7 +767,7 @@ Four tiers, all reproducible.
767
767
 
768
768
  - **`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.
769
769
  - **`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`).
770
- - **`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.
770
+ - **`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 13-key shape (1.5.0 adds `nodePoolPopulation` / `linkPoolPopulation`), `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.
771
771
  - **`05-scheduler.test.mjs`** -- scheduler-deferred effects, dispose-during-schedule races, microtask integration, 32-bit version wrap (simulated), `setDefaultRegistry`, `onCleanup` inside computeds.
772
772
  - **`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.
773
773
  - **`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.
@@ -813,6 +813,47 @@ If these fail, something allocates in the hot path and we want to find it before
813
813
  npm run test:gc
814
814
  ```
815
815
 
816
+ ### Tier 2b -- Perf gate (self-validating zero-GC judge)
817
+
818
+ `npm run test:gate` runs `test/32-perf-gate.test.mjs` through
819
+ [`@zakkster/lite-perf-gate`](https://www.npmjs.com/package/@zakkster/lite-perf-gate)
820
+ (a **dev-only** dependency; runtime `dependencies` stay empty). Where Tier 2
821
+ observes retained heap with hand-written bounds, this lane is the standing
822
+ **verdict**: it measures each hot path at two scales (N and k*N) and judges
823
+ **five signals** every run --
824
+
825
+ 1. **scavenges** -- transient young-gen allocation (the reliable detector);
826
+ 2. **engine counters** -- `stats().totalAllocations` / `totalDisposals` /
827
+ `poolGrowths`, all budgeted to **0** via a per-scenario `statsOf`;
828
+ 3. **retained heap** delta;
829
+ 4. **old-gen** GC activity;
830
+ 5. **external / arrayBuffers** delta.
831
+
832
+ Seven claimed-zero steady-state paths are gated, each warmed inside `setup()`
833
+ so the window sees only steady state, and each anchored to its Performance-
834
+ characteristics claim (see the [Allocation profile](#allocation-profile) and
835
+ `llms.txt`): `set-propagate` (1 signal -> 8 computeds -> 1 effect, synchronous flush),
836
+ `computed-cache-hit`, `computed-recompute-stable`, `effect-rerun-stable`,
837
+ `peek`, `batch-flush` (3 sets/batch), and `box-set-propagate` (the 1.5.0
838
+ `signalBox`/`computedBox` surface, which shares the read/write hot path). The
839
+ gate is self-validating: positive, negative, and large detector controls run on
840
+ every invocation, and two permanent **mustFail** controls -- a per-op object
841
+ allocator and the documented 264 B/op `signal()`+`dispose` churn -- MUST trip
842
+ the gate, so a lane that has gone blind fails loudly instead of passing.
843
+
844
+ The file guards on **both** `--expose-gc` and `--max-semi-space-size=4`; without
845
+ them it emits one loud named skip. This lane adds **exactly one loud named skip
846
+ over 1.5.1 (pass count unchanged)** -- `node:test`'s absolute leaf tally is
847
+ node-version-sensitive, so on node v26.8.2 plain `npm test` reports **513 pass /
848
+ 2 skip** (the second skip is the architecturally-N/A SSR case). The 16MB
849
+ `npm run test:gc` lane never false-reds on the control floor. Thresholds are
850
+ lite-perf-gate defaults, untouched -- a claimed-zero path that cannot meet them
851
+ is a finding, not a config knob.
852
+
853
+ ```bash
854
+ npm run test:gate
855
+ ```
856
+
816
857
  ### Tier 3 -- Performance (comparative benchmark)
817
858
 
818
859
  `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes; the aggregate output is [`bench/rb.txt`](bench/rb.txt) (four engines: lite, alien, preact, solid). Cross-framework standing comes from the **mirror** (`node --expose-gc bench/mirror.mjs --self-verify` then `bench/sweep.mjs`), which runs Andrii's canonical adapter verbatim so rows diff 1:1 against his log; the aggregate output is [`bench/r.txt`](bench/r.txt) (lite vs alien, all 47 shapes). Every output carries a machine-generated `#STAMP` (engine + harness sha256, the live registry config, host, node), so a header can never disagree with the code that ran. The pre-v3 five-framework reactivity suite is retained one release as `bench-reactive-legacy` (**deprecated -- removed after 1.5.1**). Full methodology: [`bench/README.md`](./bench/README.md).
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.5.1
2
+ * @zakkster/lite-signal v1.5.2
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
@@ -53,7 +53,31 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
53
53
 
54
54
  ## Version notes
55
55
 
56
- - **1.5.1** (current): docs + verification patch -- engine byte-identical to 1.5.0
56
+ - **1.5.2** (current): dev-only perf-gate lane -- engine byte-identical to 1.5.1
57
+ past the version banner; no API or behavior change, no engine logic moved.
58
+ Adds `@zakkster/lite-perf-gate` (`^1.4.2`, devDependency only; runtime deps stay
59
+ empty) as the standing zero-GC judge, wired in `test/32-perf-gate.test.mjs` via
60
+ `zgcSuite()` over seven claimed-zero steady-state paths (`set-propagate`,
61
+ `computed-cache-hit`, `computed-recompute-stable`, `effect-rerun-stable`,
62
+ `peek`, `batch-flush`, `box-set-propagate`), each warmed inside `setup()` and
63
+ anchored to its Performance-characteristics claim. Five signals judge every
64
+ run (scavenges / engine counters `totalAllocations`+`totalDisposals`+
65
+ `poolGrowths` all budgeted to 0 via per-scenario `statsOf` / retained heap /
66
+ old-gen / arrayBuffers) at two scales (N and k*N), with positive+negative+large
67
+ detector controls on every invocation and two permanent mustFail controls (a
68
+ per-op object allocator and the documented 264 B/op `signal()`+`dispose`
69
+ churn). New script `test:gate` (`node --expose-gc --max-semi-space-size=4
70
+ --test test/32-perf-gate.test.mjs`) runs it for real and is appended to
71
+ `test:all`; the file guards on `--expose-gc` AND `--max-semi-space-size=4`,
72
+ emitting ONE loud named skip otherwise, so plain `npm test` stays green: this
73
+ lane adds **exactly one loud named skip over 1.5.1, pass count unchanged** (the
74
+ SSR N/A is the other skip). `node:test`'s absolute leaf tally is
75
+ node-version-sensitive; on node v26.8.2 `npm test` reports **513 pass / 2 skip**
76
+ and `test:gc` **521 pass / 2 skip**. The 16MB `test:gc` lane never false-reds on
77
+ the control floor. Thresholds are
78
+ lite-perf-gate defaults, untouched. devDeps: perf-gate ^1.4.2, devtools ^1.3.1,
79
+ gc-profiler ^1.16.0. See CHANGELOG `[1.5.2]`.
80
+ - **1.5.1**: docs + verification patch -- engine byte-identical to 1.5.0
57
81
  past the version banner; no API or behavior change. Adds the mint-cycle allocation
58
82
  anatomy probe (`node harness/run.mjs mint [--verify]`) and ships the corrected
59
83
  creation economics it measured (callable mint+dispose 264 B/op all-space,
@@ -183,8 +207,10 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
183
207
  allocation-light primitives -- `signalBox(initial, opts?)` returning
184
208
  `{ get, set, peek, update, subscribe }` and `computedBox(fn, opts?)` returning
185
209
  `{ get, peek, subscribe }` -- land alongside the callable `signal` / `computed`,
186
- plus **`createRoot(fn)`** as the ownership escape hatch. **The callable API, hot
187
- paths, and `stats()` shape (11 keys) are unchanged from 1.4.0**; this is an
210
+ plus **`createRoot(fn)`** as the ownership escape hatch. **The callable API and
211
+ hot paths are unchanged from 1.4.0**; `stats()` grows to **13 keys** -- adds
212
+ `nodePoolPopulation` / `linkPoolPopulation` (the true constructed-object counts,
213
+ distinct from the `*Capacity` ledgers). This is an
188
214
  additive surface, not a second engine. Boxes wrap the same `ReactiveNode` and
189
215
  interoperate freely with callables in one graph (verified both directions);
190
216
  ownership, batching, glitch-freedom, and introspection apply uniformly, and box
@@ -280,7 +306,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
280
306
  (1 - poolGrowths*initialCap/totalAllocations), and churn without the engine
281
307
  computing rates -- the series lite-devtools 1.2 / lite-studio 1.2 plot. **Tests:**
282
308
  429 total, 419 pass, 0 fail, 10 skip (6 new counter tests in `test/03-pool.test.mjs`
283
- cover the 11-key shape, the live invariant, poolGrowths firing on growth vs staying
309
+ cover the 13-key shape (1.5.0: +nodePoolPopulation/+linkPoolPopulation), the live invariant, poolGrowths firing on growth vs staying
284
310
  0 on a sized eager pool, and destroy() reset). **Coverage:** `Signal.js` 100%
285
311
  statements / 98.26% branches / 100% functions / 100% lines; `Watch.js` 100%.
286
312
  Drop-in over 1.3.0.
@@ -576,7 +602,7 @@ interface RegistryConfig {
576
602
  onCapacityExceeded?: "throw" | "grow"; // default "throw"; "grow" = chunked refill, ledger doubles, 16x link ceiling
577
603
  }
578
604
 
579
- interface RegistryStats { // 11 keys as of 1.4.0
605
+ interface RegistryStats { // 13 keys as of 1.5.0
580
606
  signals: number;
581
607
  computeds: number;
582
608
  effects: number;
@@ -584,6 +610,8 @@ interface RegistryStats { // 11 keys as of 1.4.0
584
610
  pooledLinks: number;
585
611
  linkPoolCapacity: number; // ledger; doubles under "grow"
586
612
  nodePoolCapacity: number; // ledger; doubles under "grow"
613
+ nodePoolPopulation: number; // 1.5.0: TRUE constructed node count (nodePool.length); 0 under lazy prealloc
614
+ linkPoolPopulation: number; // 1.5.0: TRUE constructed link count (linkPool.length); 0 under lazy prealloc
587
615
  activeNodes: number; // live gauge
588
616
  totalAllocations: number; // 1.4.0: cumulative node acquires; reset by destroy()
589
617
  totalDisposals: number; // 1.4.0: cumulative node disposals; totalAllocations - totalDisposals === activeNodes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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",
@@ -28,12 +28,13 @@
28
28
  "scripts": {
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
+ "test:gate": "node --expose-gc --max-semi-space-size=4 --test test/32-perf-gate.test.mjs",
31
32
  "test:coverage": "c8 node --test --test-reporter=spec 'test/*.test.mjs'",
32
33
  "test:report": "c8 --reporter=lcov --reporter=text node --test --test-reporter=spec 'test/*.test.mjs'",
33
34
  "test:hardening": "npm --prefix test/ProfilerTests test",
34
35
  "test:hardening:gc": "npm --prefix test/ProfilerTests run test:gc",
35
36
  "test:harness": "npm --prefix harness/ProfilerTools test",
36
- "test:all": "npm test && npm run test:hardening && npm run test:harness",
37
+ "test:all": "npm test && npm run test:hardening && npm run test:harness && npm run test:gate",
37
38
  "bench": "node --expose-gc bench/benchmark.mjs",
38
39
  "bench-reactive": "node --expose-gc bench/benchmarkReactive.mjs",
39
40
  "harness": "node harness/run.mjs",
@@ -86,6 +87,7 @@
86
87
  "devDependencies": {
87
88
  "@zakkster/lite-devtools": "^1.3.1",
88
89
  "@zakkster/lite-gc-profiler": "^1.16.0",
90
+ "@zakkster/lite-perf-gate": "^1.4.2",
89
91
  "@zakkster/lite-profiler": "^1.1.0",
90
92
  "@zakkster/lite-profiler-signal": "^1.2.0",
91
93
  "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",