@zakkster/lite-signal 1.8.0-alpha.5 → 1.8.0-alpha.6
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 +43 -0
- package/README.md +20 -7
- package/llms.txt +17 -5
- package/package.json +2 -1
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.8.0-alpha.5] -- 2026-08-18
|
|
8
|
+
|
|
9
|
+
Brings the `bench/torture/` suite and the throwing-`equals` unit test to **full
|
|
10
|
+
parity with the shipped 1.4.4 canon**. This is a **verification-only** cut: the
|
|
11
|
+
engine (`Signal.js` + `Signal.d.ts`) is **UNCHANGED, byte-identical** to
|
|
12
|
+
`alpha.4` -- every ported scenario was run against the 1.8.0 engine and pins its
|
|
13
|
+
**actual** behaviour; no assertion was softened and no budget widened.
|
|
14
|
+
|
|
15
|
+
### Added -- torture parity (17 -> 22 scenarios)
|
|
16
|
+
|
|
17
|
+
- Registered the already-present-and-passing `owner-torture` (`getOwner` /
|
|
18
|
+
`runWithOwner` capture-restore + ABA degradation, a 1.6.0 primitive).
|
|
19
|
+
- Ported four scenarios that all run **natively** on the 1.8.0 engine:
|
|
20
|
+
`lifecycle-torture` (`createRoot` detachment + `destroy` registry reset),
|
|
21
|
+
`error-torture` (throwing effect bodies: per-effect buffering, exact-order
|
|
22
|
+
`AggregateError`, buffer drain over 4096 cycles), `deep-chain-torture`
|
|
23
|
+
(`pullComputed` recursion fail-closed with a `RangeError` vs the heap-iterative
|
|
24
|
+
push path), and `zerogc-torture` (the falsifiable zero-GC gate via
|
|
25
|
+
`measureAllocs` / `measureOps` + `stats()` counters, with the `ZEROGC_BREAK`
|
|
26
|
+
self-test). None needed pinning to a divergent behaviour.
|
|
27
|
+
- `capacity-torture` gained section 9: the **16x grow-link ceiling** (multiplier
|
|
28
|
+
confirmed against `Signal.js:285`), fail-closed with a `links` `CapacityError`.
|
|
29
|
+
- The three soaks (`graph-fuzzer`, `scheduler-bench`, `torture-soak`) gained an
|
|
30
|
+
**Int32Array value-oracle** (a fixed shadow window over the writable signals,
|
|
31
|
+
allocated once, zero per-tick allocation, full sweep at teardown).
|
|
32
|
+
- New `test/30-throwing-equals.test.mjs` pins all **five** `equals()` invocation
|
|
33
|
+
sites -- 3 callable (signal set pre-check, batch revert, computed re-eval) plus
|
|
34
|
+
the 2 `signalBox` `boxSet` sites (pre-check, revert).
|
|
35
|
+
|
|
36
|
+
The `cleanup-return`, `owner`, `flush`, `scope` and `createRoot`-based scenarios
|
|
37
|
+
all run natively on this engine. On the 1.8.0 engine the runner now executes
|
|
38
|
+
**18 semantic** scenarios and cleanly SKIPS the one remaining later-version
|
|
39
|
+
scenario (`dispose-torture` 1.9.0); the suite total is **22 (19 semantic + 3
|
|
40
|
+
soak)**.
|
|
41
|
+
|
|
42
|
+
### Verified -- full suite green on the 1.8.0 engine (Node 22, `--expose-gc`)
|
|
43
|
+
|
|
44
|
+
- **Torture:** 22/22 (`torture:semantic` 19/19 -- 18 executed, 1 clean skip
|
|
45
|
+
`dispose` 1.9.0; `torture:soak` 3/3, value-oracle matched).
|
|
46
|
+
- **Unit (plain `npm test`):** 499 tests, 498 pass, 0 fail, 1 skip (the
|
|
47
|
+
architectural SSR N/A in `17-reactivity`).
|
|
48
|
+
- **Unit (`npm run test:gc`):** 507 tests, 506 pass, 0 fail, 1 skip.
|
|
49
|
+
|
|
7
50
|
## [1.8.0-alpha.4] -- 2026-07-27
|
|
8
51
|
|
|
9
52
|
Rolls up the post-`1.8.0-preview` changes into the `alpha.4` tag. The
|
package/README.md
CHANGED
|
@@ -809,7 +809,10 @@ npm run bench
|
|
|
809
809
|
|
|
810
810
|
## Testing strategy
|
|
811
811
|
|
|
812
|
-
|
|
812
|
+
Four tiers, all reproducible. The full suite is **507 tests across 31 files**:
|
|
813
|
+
506 pass, 1 skipped (the architecturally-N/A SSR case in `17-reactivity` -- lite
|
|
814
|
+
has no DOM layer), 0 failing. Plain `npm test` runs **499** of them; the rest are
|
|
815
|
+
gated on `--expose-gc` and need `npm run test:gc` or `npm run test:coverage`.
|
|
813
816
|
|
|
814
817
|
### Tier 1 -- Behavior (unit tests, fast)
|
|
815
818
|
|
|
@@ -840,6 +843,9 @@ Three tiers, all reproducible.
|
|
|
840
843
|
- **`24-signalbox.test.mjs`** -- the `signalBox` / `computedBox` allocation-light handle API, **activated in 1.5.0** (committed `{skip:true}` since 1.3.0, now running against the real implementation). 12 tests: box get/set/peek/update, `computedBox` derive + memoize, peek-does-not-track, subscribe fires-and-untracks, box<->callable interop both directions, batch coalescing (including set-then-revert net no-op), dispose with ABA-safety, the `equals` short-circuit, `computedBox.peek`, and the top-level helpers bound to the default registry.
|
|
841
844
|
- **`27-create-root.test.mjs`** -- `createRoot` (1.5.0), the ownership escape hatch. A watcher spawned inside a consumer effect via `createRoot` survives the consumer's re-run (the exact `lite-query` lazy-watcher pattern); the contrast case confirms an *unwrapped* spawn is cascade-disposed; `createRoot` returns `fn`'s value, detaches tracking in `fn`'s direct body while inner effect bodies still track, and composes with box handles. 7 tests, including a top-level-export binding case that closes the otherwise-uncovered top-level `createRoot` path.
|
|
842
845
|
- **`29-scope.test.mjs`** -- `createScope` (1.6.0), the adopting counterpart to `createRoot`. 4 tests: the scope owner runs exactly once on creation; direct-body signal reads in `fn` are untracked while inner effect/computed bodies track normally; `dispose()` cascade-disposes the owned subtree (effects + computeds) while a directly-allocated signal correctly survives (the engine never owner-adopts signals); a scope created inside a consumer effect SURVIVES that consumer's re-run -- the reconciler-critical detach property; `dispose()` is idempotent; the disposer is introspection-stamped to its owner effect (`describe(dispose).kind === "effect"`); and `totalAllocations - totalDisposals === activeNodes` holds across the entire lifecycle.
|
|
846
|
+
- **`28-run-with-owner.test.mjs`** -- `getOwner` / `runWithOwner` (1.7.0; 16 tests). Capture inside an effect and inside a computed, `undefined` outside any body, adoption, tracking-observer nulling, return-value pass-through, state restoration on return *and* on throw, nested restore; three degradation tests (`null` / `undefined` / a signal handle fall through to rooted execution); and three ABA hazard pins run under allocation pressure (recycled-slot cascade, corpse adoption, and the two composed).
|
|
847
|
+
- **`30-throwing-equals.test.mjs`** -- a user `equals` predicate that THROWS (9 tests), pinned at all **five** engine sites it is called from: the three callable sites (signal `set` pre-check, batch-revert check, computed re-eval) and `signalBox` `boxSet`'s two (pre-check, revert). A pre-check throw propagates the ORIGINAL error unwrapped and leaves the handle unmutated with no downstream firing; a batch-revert throw is PINNED to the engine's actual behaviour (net value written, version left bumped, downstream fires), with a CONTRAST anti-tautology test proving a clean set-X-then-back suppresses the re-run; a computed re-eval throw is cached and re-thrown until a dep change re-evaluates cleanly. The `a-box`/`b-box` cases confirm `boxSet` behaves identically to `read.set`.
|
|
848
|
+
- **`33-cleanup-return.test.mjs`** -- the 1.8.0 effect-cleanup-return contract: an effect body may `return` a cleanup that fires before each re-run and once on dispose, composes after any `onCleanup` from the same body in call order, is ignored for non-function returns, and is excluded for computeds (a returned function stays the VALUE).
|
|
843
849
|
- **`25-devtools-real-boot.test.mjs`** -- Devtools/Studio contract (10 tests). Boots the actual `Devtools.js` against the 1.5.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.
|
|
844
850
|
- **`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%).
|
|
845
851
|
|
|
@@ -872,13 +878,13 @@ npm run bench
|
|
|
872
878
|
|
|
873
879
|
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
874
880
|
|
|
875
|
-
`bench/torture/` holds the complete **
|
|
881
|
+
`bench/torture/` holds the complete **22-scenario superset (19 semantic + 3
|
|
876
882
|
soak)** behind one runner (`run.mjs`), the forward-compatible set through 1.9.
|
|
877
883
|
They are not perf benchmarks: the ops/sec figures reflect random workload
|
|
878
884
|
composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
|
|
879
885
|
perf harness. Every scenario feature-detects and **skips cleanly** below the
|
|
880
886
|
engine version that introduces its feature, so on the 1.8.0 engine the runner
|
|
881
|
-
executes **
|
|
887
|
+
executes **18 semantic** scenarios (including `cleanup-return-torture`) and
|
|
882
888
|
reports a clean SKIP for the one remaining later-version scenario
|
|
883
889
|
(`dispose-torture` 1.9.0).
|
|
884
890
|
|
|
@@ -891,8 +897,9 @@ node bench/torture/run.mjs --list
|
|
|
891
897
|
|
|
892
898
|
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
893
899
|
|
|
894
|
-
Run these on every commit.
|
|
895
|
-
`
|
|
900
|
+
Run these on every commit. Most scenarios run on any 1.4.x+ engine; `box-torture`
|
|
901
|
+
and `lifecycle-torture` (1.5.0), `scope-torture` / `owner-torture` /
|
|
902
|
+
`introspect-torture` (1.6.0), `flush-torture` (1.7.0), and
|
|
896
903
|
`cleanup-return-torture` (1.8.0) run here because their features exist; the one
|
|
897
904
|
tagged `1.9.0+` scenario feature-detects and SKIPs on this engine.
|
|
898
905
|
|
|
@@ -907,10 +914,15 @@ tagged `1.9.0+` scenario feature-detects and SKIPs on this engine.
|
|
|
907
914
|
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
908
915
|
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
909
916
|
| `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, `runWithOwner` re-attachment into a scope, pool balance over 200 rounds |
|
|
917
|
+
| `owner-torture` (1.6.0) | `getOwner`/`runWithOwner` capture-restore + ABA degradation under allocation pressure |
|
|
910
918
|
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
911
|
-
| `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
|
|
919
|
+
| `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary, and the 16x grow-link ceiling (section 9) |
|
|
920
|
+
| `error-torture` | throwing effect bodies: single throw re-thrown unwrapped, 2+ aggregate into an exact-order `AggregateError`, survivor still runs, buffer drains over 4096 cycles with `activeNodes`/`activeLinks` flat |
|
|
921
|
+
| `deep-chain-torture` | `pullComputed` recursion fail-closed (a `RangeError` at some depth <= the ceiling; registry stays usable, deterministic re-throw) vs the heap-iterative push cascade that completes |
|
|
912
922
|
| `flush-torture` (1.7.0) | the three `flushStrategy` modes by cross-strategy differential (same graph + op sequence under eager/sab/manual settling to identical values), per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each |
|
|
913
923
|
| `cleanup-return-torture` (1.8.0) | an effect's returned cleanup: timing at re-run/dispose, compose order (appended after `onCleanup` from the same body), the self-dispose guard, and the computed exclusion -- 400 seeds |
|
|
924
|
+
| `zerogc-torture` | the falsifiable zero-GC gate: retained bytes (`measureAllocs`/`checkAllocs`, `maxBytesPerCall: 0`), major/pause window (`measureOps`/`checkNoGc`, `maxMajor: 0`), and `stats()` counters across steady + churn scenarios; `ZEROGC_BREAK=1` self-test |
|
|
925
|
+
| `lifecycle-torture` (1.5.0) | `createRoot` detachment (children survive, deps isolated) + `destroy` full registry reset (handles stale, pool baseline restored) |
|
|
914
926
|
| `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.8.0 |
|
|
915
927
|
|
|
916
928
|
#### `soak` -- wall-clock bound, asserts on **resources**
|
|
@@ -922,7 +934,8 @@ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
|
|
|
922
934
|
failure:
|
|
923
935
|
|
|
924
936
|
- zero thrown exceptions during the run, and
|
|
925
|
-
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn)
|
|
937
|
+
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn), and
|
|
938
|
+
- an Int32Array value-oracle (a fixed shadow window over the writable signals, allocated once, zero per-tick allocation, swept in full at teardown) matched every read -- a wrong value fails the run, not just a crash.
|
|
926
939
|
|
|
927
940
|
```bash
|
|
928
941
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
package/llms.txt
CHANGED
|
@@ -65,10 +65,22 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
65
65
|
composes with the cleanup-return path; the dead `freeLink` `-1` arms removed) and
|
|
66
66
|
closes `Signal.js` to **100%** statements/branches/functions/lines. Torture: the
|
|
67
67
|
`cleanup-return-torture` scenario now **executes** (400 seeds: timing, compose
|
|
68
|
-
order, self-dispose guard, computed exclusion)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
order, self-dispose guard, computed exclusion). `alpha.5` brings the bench/torture
|
|
69
|
+
suite to **full parity with the shipped 1.4.4 canon** -- verification-only, engine
|
|
70
|
+
UNCHANGED (`Signal.js` byte-identical): registers the already-present-and-passing
|
|
71
|
+
`owner-torture` and ports four scenarios that run NATIVELY on the 1.8.0 engine
|
|
72
|
+
(`lifecycle-torture` createRoot detachment + destroy reset; `error-torture`
|
|
73
|
+
throwing-effect buffering + AggregateError + buffer drain; `deep-chain-torture`
|
|
74
|
+
pullComputed fail-closed RangeError vs the iterative push path; `zerogc-torture`
|
|
75
|
+
the falsifiable zero-GC gate). So the runner is now **22 scenarios (19 semantic +
|
|
76
|
+
3 soak)**, of which **18 semantic EXECUTE on the 1.8.0 engine** -- only
|
|
77
|
+
`dispose-torture` (1.9.0 `Symbol.dispose`) still self-skips. `capacity-torture`
|
|
78
|
+
gained section 9 (the 16x grow-link ceiling); the three soaks gained an
|
|
79
|
+
Int32Array value-oracle. New `test/30-throwing-equals.test.mjs` pins all five
|
|
80
|
+
`equals()` invocation sites (3 callable + 2 signalBox boxSet). Verified green:
|
|
81
|
+
torture 22/22; unit (plain `npm test`) **499 tests, 498 pass, 0 fail, 1 skip**
|
|
82
|
+
(the 1 skip is SSR N/A); `npm run test:gc` **507 tests, 506 pass, 0 fail, 1 skip**.
|
|
83
|
+
Drop-in over 1.7.0.
|
|
72
84
|
|
|
73
85
|
- **1.7.0**: the **flush-strategy minor**. `createRegistry({flushStrategy})` gives
|
|
74
86
|
per-registry control over *when* effects deliver (`"eager"` default | `"sab"` |
|
|
@@ -716,7 +728,7 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
716
728
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
717
729
|
- `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
|
|
718
730
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
719
|
-
- `bench/torture/` -- the complete **
|
|
731
|
+
- `bench/torture/` -- the complete **22-scenario superset (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, so the whole set is safe on the 1.8.0 engine and stays green from 1.4.x forward. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **18 that execute on 1.8.0**: `oracle-fuzzer` (every computed vs an independent uncached reference, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeups), `work-accounting` (minimum body-execution counts over 10 topologies), `op-accounting` (structural work from the `onGraphMutation` opcode lane, not wall-clock), `introspect-torture` (1.6.0: read-only introspection surface -- `describe`/`nodeId`/`hasObservers`/`isTracking`/`forEach*`/`ownerOf`/`observeObservers` -- walk-agreement + the ABA gen-stamp guard), `concurrent-storm` (8 reentrancy / flush-ordering contracts), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing-scheduler containment), `box-torture` (1.5.0: signalBox/computedBox interop -- the oracle differential fuzz with every node realised as callable OR box), `scope-torture` (1.6.0: `createScope` adoption + disposal-crash fuzz + `runWithOwner` re-attachment), `owner-torture` (1.6.0: `getOwner`/`runWithOwner` capture-restore + ABA degradation), `async-torture` (watch / when / whenAsync contracts + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary + `CapacityError` + the 16x grow-link ceiling), `error-torture` (throwing effect bodies: per-effect buffering, exact-order `AggregateError`, buffer drain over 4096 cycles), `deep-chain-torture` (`pullComputed` recursion fail-closed with a `RangeError` vs the heap-iterative push path), `flush-torture` (1.7.0: the three `flushStrategy` modes by cross-strategy differential + per-strategy scheduling + `.subscribe()`), `cleanup-return-torture` (1.8.0: an effect's returned cleanup -- timing at re-run/dispose, compose order appended after `onCleanup`, self-dispose guard, computed exclusion; 400 seeds), `zerogc-torture` (the falsifiable zero-GC gate: `measureAllocs`/`measureOps` + `stats()` counters, `ZEROGC_BREAK` self-test), `lifecycle-torture` (`createRoot` detachment + `destroy` registry reset); plus **1 that skips cleanly** as a later-version feature: `dispose-torture` (1.9.0 `Symbol.dispose`). `soak` (wall-clock bound, asserts on RESOURCES; nightly): `graph-fuzzer`, `scheduler-bench`, `torture-soak` -- each now carries an Int32Array value-oracle (a fixed shadow window over the writable signals, allocated once, zero per-tick alloc, full sweep at teardown) so a wrong value fails the run, not just a crash; exit 0 iff zero errors AND post-teardown pool at or below its leaf-only floor AND the value-oracle matched AND the JIT sink advanced. Runner spawns each scenario as a child process (several assert on global pool accounting) and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
720
732
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
721
733
|
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
722
734
|
- `harness/smoke.mjs` -- 1.7 flushStrategy semantics (eager/sab/manual) + `flush()`, and the 1.8 effect-cleanup-return contract (fires before re-run + on dispose, composes with onCleanup in call order, non-function returns ignored, computed-returning-a-function still yields the VALUE). ASSERTS, so it fails loudly on a regression. First in `harness:all` and `verify`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.8.0-alpha.
|
|
3
|
+
"version": "1.8.0-alpha.6",
|
|
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",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"sideEffects": false,
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@zakkster/lite-devtools": "^1.2.0",
|
|
89
|
+
"@zakkster/lite-gc-profiler": "^1.15.0",
|
|
89
90
|
"@zakkster/lite-profiler": "^1.1.0",
|
|
90
91
|
"@zakkster/lite-profiler-signal": "^1.2.0",
|
|
91
92
|
"@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
|