@zakkster/lite-signal 1.9.0-preview.2 → 1.9.0-preview.3

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,7 +4,51 @@ 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
- ## [Unreleased]
7
+ ## [1.9.0-preview.2] -- 2026-07-27
8
+
9
+ Rolls up the post-`1.9.0-preview` changes into the `preview.2` tag. The 1.9.0
10
+ feature (`using` / `Symbol.dispose` on lifecycle objects) ships in the preview and
11
+ is unchanged here; this cut adds two new torture scenarios from a consolidated
12
+ coverage audit, the crash fix inherited from the 1.8.0 base, 100% coverage, and
13
+ test-suite hygiene.
14
+
15
+ ### Added -- torture suite reaches the zero-skip milestone (19 scenarios)
16
+
17
+ Two effects converge on the 1.9.0 engine. First, **`dispose-torture` now
18
+ executes**: 1.9.0 stamps `Symbol.dispose` at five sites (the registry -> destroy,
19
+ an effect's stop handle, a `createScope` disposer, a `createRoot` disposer, and
20
+ both box prototypes), so `using`-declared lifecycle objects dispose at block exit.
21
+ The scenario feature-detects via the box-prototype stamp and drives each site
22
+ through the TC39 `using` path, asserting idempotent disposal. Because it is a set
23
+ of stamped methods with **no new export**, it is exactly the profile the value /
24
+ introspection oracles cannot see. Second, the coverage audit added **two new
25
+ semantic scenarios** for exports no scenario exercised directly:
26
+
27
+ - **`owner-torture`** (1.6.0+) -- `getOwner` / `runWithOwner` capture-restore: the
28
+ gen-stamped owner handle, adoption of effects/computeds created inside
29
+ `runWithOwner`, and cascade-dispose when the captured owner is torn down.
30
+ - **`lifecycle-torture`** (createRoot 1.5.0+, destroy 1.4.0+) -- `createRoot`
31
+ detachment (an owned subtree that survives its enclosing scope) and the direct
32
+ `destroy` reset contract; `createRoot` had never been called by any scenario,
33
+ and `destroy` was only reached indirectly through a registry `Symbol.dispose`.
34
+
35
+ The suite is now **19 scenarios (16 semantic + 3 soak)**. On the 1.9.0 engine
36
+ **every semantic scenario executes -- zero feature-skips** -- the first engine
37
+ version to run the complete superset, since `dispose` was the last remaining
38
+ feature gate (box 1.5.0, scope/owner/introspect 1.6.0, flush 1.7.0,
39
+ cleanup-return 1.8.0, dispose 1.9.0 are all satisfied).
40
+
41
+ ### Verified -- full suite green on the 1.9.0 engine (Node 22, `--expose-gc`)
42
+
43
+ - **Torture:** 19/19 -- `torture:semantic` 16/16 (all executed, zero skips),
44
+ `torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
45
+ - **Unit (plain run):** 499 tests, 479 pass, 0 fail, 1 skip (the architectural
46
+ SSR N/A in `17-reactivity`). The only non-passes are the 19 in
47
+ `test/25-devtools-real-boot`, the real-rig that requires the sibling
48
+ `@zakkster/lite-devtools`; with that sibling resolvable the suite is 498 pass +
49
+ 1 skip. Engine-only, excluding `test/25`: 480 tests, 479 pass, 1 skip. (The c8
50
+ coverage run below reports a different count -- perf-smoke budgets skip under
51
+ instrumentation.)
8
52
 
9
53
  ### Changed -- bench protocol v3 (carried forward)
10
54
 
@@ -43,8 +87,11 @@ cleanup-return array-append arm (carried in via `33-cleanup-return`). Three prov
43
87
 
44
88
  Test-suite hygiene: `33-computed-selfdirty-prev-owner.test.mjs` renamed to `34-`
45
89
  (the `33-` slot belongs to `33-cleanup-return`, which carries forward from 1.8.0
46
- because this line inherits effect cleanup-return); the duplicate `28-scope.test.mjs`
47
- dropped in favour of `29-scope.test.mjs` (both were byte-identical).
90
+ because this line inherits effect cleanup-return) -- the rename had left a
91
+ byte-identical `33-` copy behind, so the scope suite's `28-`/`29-` pattern
92
+ repeated here; the stray `33-computed-selfdirty-prev-owner.test.mjs` is deleted,
93
+ leaving one `34-`. The duplicate `28-scope.test.mjs` was likewise dropped in
94
+ favour of `29-scope.test.mjs` (both were byte-identical).
48
95
 
49
96
  **Hot-path parity note:** the fix touches `disposeNode` and `freeLink`; re-baseline
50
97
  the VersionMatrix engine sha256 on the next publish.
@@ -455,8 +502,6 @@ cascade forward from every prior 1.x line without semantic change.
455
502
 
456
503
  ## [1.8.0-preview] -- 2026-07-XX
457
504
 
458
- ## [1.8.0-preview] -- 2026-07-XX
459
-
460
505
  The **effect cleanup return** minor -- Reflex-study pattern A. One additive
461
506
  hot-path change: an effect body may now `return` a cleanup function, which
462
507
  runs before the next re-run and on dispose, composing with imperative
@@ -755,9 +800,9 @@ monomorphic targets and inlines the body. In "eager" mode the inlined body is
755
800
  byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
756
801
  -- **zero behavioral or performance regression** for any existing user.
757
802
 
758
- This is NOT ledger §0b #6 (per-call closure-var load of a primitive). It is a
803
+ This is NOT ledger S0b #6 (per-call closure-var load of a primitive). It is a
759
804
  hoisted function reference resolved once at registry build time and is a NEW
760
- mechanism by the v1 roadmap §0b line 100 definition.
805
+ mechanism by the v1 roadmap S0b line 100 definition.
761
806
 
762
807
  The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
763
808
  hot path. sha256 over the extracted function bodies of `pullComputed`,
@@ -802,7 +847,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
802
847
 
803
848
  Real wins, but smaller than the gap to Reflex on the same shapes. The residual
804
849
  gap is structural (per-write `gen` check, batch-revert epoch tracking, global
805
- version bumping) -- design decisions accepted by §0b and not in scope here.
850
+ version bumping) -- design decisions accepted by S0b and not in scope here.
806
851
  Modern V8's `try/finally` elision varies; expect higher absolute speedups on
807
852
  production V8 than on this sandbox.
808
853
 
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zahary Shinikchiev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -870,9 +870,53 @@ npm run test:gc
870
870
  npm run bench
871
871
  ```
872
872
 
873
- ### Tier 4 -- Torture soaks (crash detection under chaos)
873
+ ### Tier 4 -- Torture (correctness and resources under chaos)
874
874
 
875
- `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:
875
+ `bench/torture/` holds the complete **19-scenario suite (16 semantic + 3 soak)**
876
+ behind one runner (`run.mjs`). They are not perf benchmarks: the ops/sec figures
877
+ reflect random workload composition, not engine throughput -- `bench/benchmark.mjs`
878
+ remains the canonical perf harness. Every scenario feature-detects and skips
879
+ cleanly below the engine version that introduces its feature; on the **1.9.0
880
+ engine all 16 semantic scenarios execute with zero feature-skips** -- the first
881
+ engine version to run the complete superset, since `dispose` was the last gate.
882
+
883
+ ```bash
884
+ npm run torture # everything
885
+ npm run torture:semantic # correctness only, CI-shaped
886
+ npm run torture:soak # resource soaks only
887
+ node bench/torture/run.mjs --list
888
+ ```
889
+
890
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
891
+
892
+ Run these on every commit.
893
+
894
+ | scenario | pins |
895
+ | -------- | ---- |
896
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
897
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
898
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies |
899
+ | `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
900
+ | `introspect-torture` (1.6.0) | the read-only introspection surface: walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors |
901
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts |
902
+ | `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
903
+ | `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
904
+ | `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, pool balance over 200 rounds |
905
+ | `owner-torture` (1.6.0) | `getOwner`/`runWithOwner` capture-restore: the gen-stamped owner handle, adoption of nodes created inside `runWithOwner`, cascade-dispose when the captured owner is torn down |
906
+ | `lifecycle-torture` | `createRoot` (1.5.0+) detachment of an owned subtree, and the direct `destroy` (1.4.0+) reset contract -- both previously unexercised by any scenario |
907
+ | `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
908
+ | `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
909
+ | `flush-torture` (1.7.0) | the three `flushStrategy` modes by cross-strategy differential, per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each |
910
+ | `cleanup-return-torture` (1.8.0) | an effect's returned cleanup: timing at re-run/dispose, compose order after `onCleanup`, the self-dispose guard, and the computed exclusion |
911
+ | `dispose-torture` (1.9.0) | `Symbol.dispose` stamped at five sites (registry, effect stop handle, scope/root disposers, both box prototypes) driven through the TC39 `using` path; idempotent disposal, feature-detected via the box-prototype stamp |
912
+
913
+ #### `soak` -- wall-clock bound, asserts on **resources**
914
+
915
+ Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
916
+ and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
917
+ effect rewires, nested-batch + untrack reads, and microtask-scheduled async
918
+ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
919
+ failure:
876
920
 
877
921
  - zero thrown exceptions during the run, and
878
922
  - after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.9.0-canary.1 (ledger #18 corrected)
2
+ * @zakkster/lite-signal v1.9.0-preview.2
3
3
  * Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
4
4
  * MIT License
5
5
  * --------------------
package/llms.txt CHANGED
@@ -53,7 +53,45 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
53
53
 
54
54
  ## Version notes
55
55
 
56
- - **1.6.0-preview** (current): the **observability-and-lifecycle minor**, shipping
56
+ - **1.9.0-preview.2** (current): the **explicit-resource-management minor**. A
57
+ single-feature engine cut: `Symbol.dispose` is stamped at five sites -- the
58
+ registry (-> `destroy`), an effect's stop handle (-> `stop`), a `createScope`
59
+ disposer, a `createRoot` disposer, and both box prototypes (-> `dispose`) -- so
60
+ every lifecycle object works with the TC39 `using` declaration and disposes at
61
+ block exit. No new export; existence-guarded, so manual `[Symbol.dispose]()`
62
+ works on Node 20+ and the `: null` arm covers older runtimes. `preview.2` also
63
+ carries the dangling-cursor crash fix inherited from the 1.8.0 base (one-line
64
+ `disposeNode` cursor repair) and closes `Signal.js` to **100%**. Torture reaches
65
+ the **zero-skip milestone**: `dispose-torture` now executes, and a coverage audit
66
+ added two semantic scenarios -- `owner-torture` (`getOwner`/`runWithOwner`
67
+ capture-restore) and `lifecycle-torture` (`createRoot` detachment + the direct
68
+ `destroy` reset, both previously unexercised) -- bringing the suite to **19
69
+ scenarios (16 semantic + 3 soak)**, all 16 semantic executing on this engine with
70
+ no feature-skips (the first engine to run the complete superset). Verified green:
71
+ torture 19/19; unit **499 tests, 479 pass, 0 fail, 1 skip** (SSR N/A) -- 498 pass
72
+ with the sibling `@zakkster/lite-devtools` the 19-test `test/25` rig needs.
73
+ Drop-in over 1.8.0.
74
+
75
+ - **1.8.0**: the **effect-cleanup-return minor**. An EFFECT body may `return` a
76
+ cleanup function (Solid/Vue/Reflex-compatible), run at the same points as
77
+ `onCleanup` -- before each re-run and once on dispose -- and APPENDED after any
78
+ `onCleanup` from the same body, so both compose in call order. Non-function
79
+ returns ignored; self-disposed body registers nothing; computeds excluded (a
80
+ returned function stays the VALUE). Cost is one `typeof` per effect run;
81
+ `executeEffect` is the only hot body whose sha256 changed 1.7.0 -> 1.8.0. Torture
82
+ added `cleanup-return-torture` (timing, compose order, self-dispose guard,
83
+ computed exclusion).
84
+
85
+ - **1.7.0**: the **flush-strategy minor**. `createRegistry({flushStrategy})` gives
86
+ per-registry control over *when* effects deliver (`"eager"` default | `"sab"` |
87
+ `"manual"`), plus an explicit `r.flush()`; the lever resolves once at init into
88
+ two closure-captured `const` booleans, so the `"eager"` body is byte-identical to
89
+ 1.6.0. Also forward-ported `getOwner` / `runWithOwner` from 1.5.0-beta.2 and fixed
90
+ the propagation benchmark harness (every pre-1.7.0 number in `bench/results.txt`
91
+ is void). Torture added `flush-torture` (the three modes by cross-strategy
92
+ differential + `.subscribe()`).
93
+
94
+ - **1.6.0-preview**: the **observability-and-lifecycle minor**, shipping
57
95
  on the `preview` dist-tag while it settles. Two additions, both on existing
58
96
  hot-path-adjacent edges:
59
97
 
@@ -690,7 +728,7 @@ function dumpOwnerTree(handle, depth = 0) {
690
728
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
691
729
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
692
730
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
693
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
731
+ - `bench/torture/` -- the complete **19-scenario suite (16 semantic + 3 soak)** behind one runner (`run.mjs`), two groups. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature; on the **1.9.0 engine all 16 semantic execute with zero skips** -- the first engine to run the whole superset, since `dispose` was the last feature gate. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit): `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), `introspect-torture` (1.6.0: read-only introspection surface -- walk-agreement + 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 via oracle differential fuzz), `scope-torture` (1.6.0: `createScope` adoption + disposal-crash fuzz), `owner-torture` (1.6.0: `getOwner`/`runWithOwner` capture-restore -- gen-stamped handle, adoption inside `runWithOwner`, cascade-dispose), `lifecycle-torture` (`createRoot` 1.5.0+ detachment + the direct `destroy` 1.4.0+ reset -- both previously unexercised by any scenario), `async-torture` (watch/when/whenAsync + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary), `flush-torture` (1.7.0: the three `flushStrategy` modes by cross-strategy differential + `.subscribe()`), `cleanup-return-torture` (1.8.0: an effect's returned cleanup -- timing, compose order, self-dispose guard, computed exclusion), `dispose-torture` (1.9.0: `Symbol.dispose` stamped at five sites driven through the TC39 `using` path, idempotent disposal, feature-detected via the box-prototype stamp). `soak` (wall-clock bound, asserts on RESOURCES; 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. Runner spawns each scenario as a child process and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
694
732
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
695
733
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
696
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.9.0-preview.2",
3
+ "version": "1.9.0-preview.3",
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",