@zakkster/lite-signal 1.8.0-alpha.4 → 1.8.0-alpha.5

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,41 @@ 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.8.0-alpha.4] -- 2026-07-27
8
+
9
+ Rolls up the post-`1.8.0-preview` changes into the `alpha.4` tag. The
10
+ effect-cleanup-return feature (an effect body may `return` a cleanup) ships in
11
+ the preview and is unchanged here; this cut carries the dangling-cursor crash fix
12
+ (below, now also exercised against the cleanup-return path), 100% coverage on
13
+ `Signal.js`, and the completed torture surface for the cleanup-return feature.
14
+
15
+ ### Added -- `cleanup-return-torture` now executes on the 1.8.0 engine
16
+
17
+ `bench/torture/`'s `cleanup-return-torture` scenario -- present but
18
+ feature-skipped on the 1.5.x-1.7.x lines -- now **runs** (400 seeds), since an
19
+ effect body returning a cleanup is a 1.8.0 primitive. It pins the timing (the
20
+ returned cleanup runs before each re-run and once on dispose, same points as
21
+ imperative `onCleanup`), the **compose order** (a returned cleanup is appended
22
+ after any `onCleanup` registered in the same body, so both fire in call order),
23
+ the self-dispose guard (a body that disposes itself registers nothing), and the
24
+ computed exclusion (a computed returning a function keeps it as the value, never
25
+ a cleanup). On the 1.8.0 engine the runner therefore executes **13 semantic**
26
+ scenarios and cleanly SKIPS the one remaining later-version scenario
27
+ (`dispose-torture` 1.9.0); the suite total is unchanged at **17 (14 semantic +
28
+ 3 soak)**.
29
+
30
+ ### Verified -- full suite green on the 1.8.0 engine (Node 22, `--expose-gc`)
31
+
32
+ - **Torture:** 17/17 -- `torture:semantic` 14/14 (13 executed incl.
33
+ `cleanup-return-torture`, 1 clean skip: `dispose` 1.9.0), `torture:soak` 3/3
34
+ (zero errors, every pool back to its leaf-only floor).
35
+ - **Unit (plain run):** 492 tests, 472 pass, 0 fail, 1 skip (the architectural
36
+ SSR N/A in `17-reactivity`). The only non-passes are the 19 in
37
+ `test/25-devtools-real-boot`, the real-rig that requires the sibling
38
+ `@zakkster/lite-devtools`; with that sibling resolvable the suite is 491 pass +
39
+ 1 skip. Engine-only, excluding `test/25`: 473 tests, 472 pass, 1 skip. (The c8
40
+ coverage run below reports a different count -- perf-smoke budgets skip under
41
+ instrumentation.)
8
42
 
9
43
  ### Changed -- bench protocol v3 (carried forward)
10
44
 
@@ -463,9 +497,9 @@ monomorphic targets and inlines the body. In "eager" mode the inlined body is
463
497
  byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
464
498
  -- **zero behavioral or performance regression** for any existing user.
465
499
 
466
- This is NOT ledger §0b #6 (per-call closure-var load of a primitive). It is a
500
+ This is NOT ledger S0b #6 (per-call closure-var load of a primitive). It is a
467
501
  hoisted function reference resolved once at registry build time and is a NEW
468
- mechanism by the v1 roadmap §0b line 100 definition.
502
+ mechanism by the v1 roadmap S0b line 100 definition.
469
503
 
470
504
  The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
471
505
  hot path. sha256 over the extracted function bodies of `pullComputed`,
@@ -510,7 +544,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
510
544
 
511
545
  Real wins, but smaller than the gap to Reflex on the same shapes. The residual
512
546
  gap is structural (per-write `gen` check, batch-revert epoch tracking, global
513
- version bumping) -- design decisions accepted by §0b and not in scope here.
547
+ version bumping) -- design decisions accepted by S0b and not in scope here.
514
548
  Modern V8's `try/finally` elision varies; expect higher absolute speedups on
515
549
  production V8 than on this sandbox.
516
550
 
package/README.md CHANGED
@@ -870,9 +870,56 @@ 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
+
875
+ `bench/torture/` holds the complete **17-scenario superset (14 semantic + 3
876
+ soak)** behind one runner (`run.mjs`), the forward-compatible set through 1.9.
877
+ They are not perf benchmarks: the ops/sec figures reflect random workload
878
+ composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
879
+ perf harness. Every scenario feature-detects and **skips cleanly** below the
880
+ engine version that introduces its feature, so on the 1.8.0 engine the runner
881
+ executes **13 semantic** scenarios (including `cleanup-return-torture`) and
882
+ reports a clean SKIP for the one remaining later-version scenario
883
+ (`dispose-torture` 1.9.0).
874
884
 
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:
885
+ ```bash
886
+ npm run torture # everything
887
+ npm run torture:semantic # correctness only, CI-shaped
888
+ npm run torture:soak # resource soaks only
889
+ node bench/torture/run.mjs --list
890
+ ```
891
+
892
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
893
+
894
+ Run these on every commit. The nine untagged scenarios run on any 1.4.x+ engine;
895
+ `box-torture` (1.5.0), `scope-torture` (1.6.0), `flush-torture` (1.7.0), and
896
+ `cleanup-return-torture` (1.8.0) run here because their features exist; the one
897
+ tagged `1.9.0+` scenario feature-detects and SKIPs on this engine.
898
+
899
+ | scenario | pins |
900
+ | -------- | ---- |
901
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
902
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
903
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies |
904
+ | `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
905
+ | `introspect-torture` (1.6.0) | the read-only introspection surface (`describe`/`nodeId`/`hasObservers`/`isTracking`/`forEach*`/`ownerOf`/`observeObservers`): walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors |
906
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts |
907
+ | `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
908
+ | `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
909
+ | `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 |
910
+ | `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 |
912
+ | `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
+ | `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 |
914
+ | `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.8.0 |
915
+
916
+ #### `soak` -- wall-clock bound, asserts on **resources**
917
+
918
+ Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
919
+ and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
920
+ effect rewires, nested-batch + untrack reads, and microtask-scheduled async
921
+ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
922
+ failure:
876
923
 
877
924
  - zero thrown exceptions during the run, and
878
925
  - 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.8.0-alpha.0 (ledger #18 corrected)
2
+ * @zakkster/lite-signal v1.8.0-alpha.4
3
3
  * Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
4
4
  * MIT License
5
5
  * --------------------
package/llms.txt CHANGED
@@ -53,7 +53,36 @@ 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.8.0-alpha.4** (current): the **effect-cleanup-return minor**. An EFFECT body
57
+ may now `return` a cleanup function (Solid/Vue/Reflex-compatible), run at the same
58
+ points as imperative `onCleanup` -- before each re-run and once on dispose -- and
59
+ APPENDED after any `onCleanup` from the same body, so both compose in call order.
60
+ Non-function returns are ignored; a self-disposed body registers nothing
61
+ (gen-guarded); computeds are excluded (a returned function stays the VALUE). Cost
62
+ is one `typeof` per effect run, off the mark/pull path; `executeEffect` is the only
63
+ hot body whose sha256 changed 1.7.0 -> 1.8.0. `alpha.4` also carries the
64
+ dangling-cursor crash fix (a one-line `disposeNode` cursor repair, which also
65
+ composes with the cleanup-return path; the dead `freeLink` `-1` arms removed) and
66
+ closes `Signal.js` to **100%** statements/branches/functions/lines. Torture: the
67
+ `cleanup-return-torture` scenario now **executes** (400 seeds: timing, compose
68
+ order, self-dispose guard, computed exclusion), so the 17-scenario runner runs
69
+ **13 semantic** + 1 skip (`dispose` 1.9.0). Verified green: torture 17/17; unit
70
+ **492 tests, 472 pass, 0 fail, 1 skip** (SSR N/A) -- 491 pass with the sibling
71
+ `@zakkster/lite-devtools` the 19-test `test/25` rig needs. Drop-in over 1.7.0.
72
+
73
+ - **1.7.0**: the **flush-strategy minor**. `createRegistry({flushStrategy})` gives
74
+ per-registry control over *when* effects deliver (`"eager"` default | `"sab"` |
75
+ `"manual"`), plus an explicit `r.flush()` on every registry; the lever resolves
76
+ once at init into two closure-captured `const` booleans, so the `"eager"` body is
77
+ byte-identical to 1.6.0. Also forward-ported `getOwner` / `runWithOwner` (the
78
+ gen-stamped capture-and-restore companion to `createRoot`) from 1.5.0-beta.2, and
79
+ fixed the propagation benchmark harness (every lite adapter had been built with
80
+ `flushStrategy: "sab"` while driving un-batched `.set` and never flushing, so
81
+ effects ran once at creation and never again -- every pre-1.7.0 number in
82
+ `bench/results.txt` is void). Torture added `flush-torture` (the three modes by
83
+ cross-strategy differential + `.subscribe()`).
84
+
85
+ - **1.6.0-preview**: the **observability-and-lifecycle minor**, shipping
57
86
  on the `preview` dist-tag while it settles. Two additions, both on existing
58
87
  hot-path-adjacent edges:
59
88
 
@@ -687,7 +716,7 @@ function dumpOwnerTree(handle, depth = 0) {
687
716
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
688
717
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
689
718
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
690
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
719
+ - `bench/torture/` -- the complete **17-scenario superset (14 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 **13 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), `async-torture` (watch / when / whenAsync contracts + 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 + 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); 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` -- 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 (several assert on global pool accounting) and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
691
720
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
692
721
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
693
722
  - `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.4",
3
+ "version": "1.8.0-alpha.5",
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",
@@ -45,7 +45,10 @@
45
45
  "profile:burst": "node --expose-gc harness/burst-dag.mjs ./Signal.js",
46
46
  "profile:pull": "node --expose-gc harness/pull-stress.mjs",
47
47
  "gate": "node harness/VersionMatrix/pre-publish.mjs",
48
- "verify": "npm test && npm run harness:smoke && npm run bench"
48
+ "verify": "npm test && npm run harness:smoke && npm run bench",
49
+ "torture": "node bench/torture/run.mjs",
50
+ "torture:semantic": "node bench/torture/run.mjs --group semantic",
51
+ "torture:soak": "node bench/torture/run.mjs --group soak"
49
52
  },
50
53
  "keywords": [
51
54
  "signal",