@zakkster/lite-signal 1.7.0-alpha.3 → 1.7.0-alpha.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,7 +4,28 @@ 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.7.0-alpha.3] -- 2026-07-27
8
+
9
+ Rolls up the post-`1.7.0-alpha.0` changes into the `alpha.3` tag. The
10
+ flush-strategy feature (`flushStrategy` + `r.flush()`) and the forward-ported
11
+ `getOwner` / `runWithOwner` ship in alpha.0 and are unchanged here; what this cut
12
+ adds is the dangling-cursor crash fix (below), 100% branch coverage on
13
+ `Signal.js`, the completed torture surface for the flush feature, and a
14
+ test-directory cleanup.
15
+
16
+ ### Added -- `flush-torture` now executes on the 1.7.0 engine
17
+
18
+ `bench/torture/`'s `flush-torture` scenario -- present but feature-skipped on the
19
+ 1.5.x / 1.6.x lines -- now **runs**, since `flushStrategy` exists. It pins the
20
+ three modes by a cross-strategy differential (the same graph and op sequence
21
+ under `eager` / `sab` / `manual` must reach identical settled values once
22
+ drained -- they differ only in *when* draining happens), plus per-strategy
23
+ scheduling (eager flushes on `.set()`, sab only at batch exit, manual only on
24
+ `flush()`), re-entrant / empty `flush()`, and the `.subscribe()` contract under
25
+ each strategy. On the 1.7.0 engine the runner therefore executes **12 semantic**
26
+ scenarios and cleanly SKIPS the two later-version ones (`cleanup-return-torture`
27
+ 1.8.0, `dispose-torture` 1.9.0); the suite total is unchanged at **17 (14
28
+ semantic + 3 soak)**.
8
29
 
9
30
  ### Changed -- bench protocol v3 (carried forward)
10
31
 
@@ -32,7 +53,7 @@ one-line cursor repair in `disposeNode` (advance the cursor to the next survivin
32
53
  dep before the free); O(1), disposal path only, no steady-state cost. Pinned by a
33
54
  regression test in `test/12-coverage.test.mjs`.
34
55
 
35
- This also corrects the record on `freeLink`: the `link.source !== null ? … : -1`
56
+ This also corrects the record on `freeLink`: the `link.source !== null ? ... : -1`
36
57
  fallbacks were documented as "unreachable defensive code," but they were in fact
37
58
  reachable -- and *only* reachable -- through this crash path. With the cursor
38
59
  repaired they are genuinely dead, so they were removed (replaced by the passed
@@ -46,9 +67,23 @@ bodies are unchanged.
46
67
 
47
68
  ### Changed -- test file numbering
48
69
 
49
- `test/28-scope.test.mjs` renamed to `test/29-scope.test.mjs` to resolve the
70
+ `test/28-scope.test.mjs` is renamed to `test/29-scope.test.mjs` to resolve the
50
71
  duplicate `28-` prefix it shared with `28-run-with-owner.test.mjs`
51
- (`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`).
72
+ (`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`). The
73
+ alpha.3 tree had carried *both* files -- the original `28-scope` and a
74
+ byte-identical `29-scope` copy -- so the scope suite was running twice; the stray
75
+ `28-scope.test.mjs` is deleted, leaving one `29-scope.test.mjs`.
76
+
77
+ ### Verified -- full suite green on the 1.7.0 engine (Node 22, `--expose-gc`)
78
+
79
+ - **Torture:** 17/17 -- `torture:semantic` 14/14 (12 executed incl. `flush-torture`,
80
+ 2 clean skips: `cleanup-return` 1.8.0, `dispose` 1.9.0), `torture:soak` 3/3
81
+ (zero errors, every pool back to its leaf-only floor).
82
+ - **Unit:** 485 tests, 465 pass, 0 fail, 1 skip (the architectural SSR N/A in
83
+ `17-reactivity`). The 1 skip aside, the only non-passes are the 19 in
84
+ `test/25-devtools-real-boot`, the real-rig that requires the sibling
85
+ `@zakkster/lite-devtools`; with that sibling resolvable the suite is 484 pass +
86
+ 1 skip. (Engine-only, excluding `test/25`: 466 tests, 465 pass, 1 skip.)
52
87
 
53
88
  ## [1.7.0-alpha.0] -- 2026-07-14
54
89
 
@@ -161,7 +196,7 @@ const FLUSH_ON_BATCH_EXIT = (flushStrategy !== "manual");
161
196
  They are immutable for the registry's lifetime, which gives V8's JIT the
162
197
  constant-folding hook it needs: in `"eager"` mode the emitted code for `.set` is
163
198
  byte-identical to 1.6.0's `if (batchDepth === 0) flushEffects()`; in
164
- `"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && …` short-circuits on the const-false
199
+ `"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && ...` short-circuits on the const-false
165
200
  and V8 elides the branch entirely after one tier-up. `signal()` additionally
166
201
  selects between **two pre-built `.set` closures at construction time**, so the eager
167
202
  body carries no extra load or branch at all. **Zero behavioural or performance
@@ -178,7 +213,7 @@ a closure-captured `const` boolean lives in a context slot, not as a literal in
178
213
  bytecode, when the body is shared. Splitting the closure at *build* time is what
179
214
  recovered parity. Both dead ends are recorded here so nobody re-derives them.
180
215
 
181
- This is NOT ledger §0b #6 (per-call closure-var load of a primitive V8 can't fold).
216
+ This is NOT ledger S0b #6 (per-call closure-var load of a primitive V8 can't fold).
182
217
  The literals are declared `const` and never reassigned, and the hot body is selected
183
218
  before the first write.
184
219
 
@@ -213,7 +248,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
213
248
  rather than papered over with an ignore pragma (which would have broken the
214
249
  sha256 hot-path proof above for no behavioural gain):
215
250
 
216
- 1-2. `freeLink`'s `link.source !== null ? … : -1` and `link.target !== null ? … : -1`
251
+ 1-2. `freeLink`'s `link.source !== null ? ... : -1` and `link.target !== null ? ... : -1`
217
252
  fallbacks. All three call sites pass a link taken from a live dep/sub list;
218
253
  both endpoints are always non-null.
219
254
  3. The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth
@@ -285,7 +320,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
285
320
 
286
321
  Real wins, but smaller than the gap to Reflex on the same shapes. The residual
287
322
  gap is structural (per-write `gen` check, batch-revert epoch tracking, global
288
- version bumping) -- design decisions accepted by §0b and not in scope here.
323
+ version bumping) -- design decisions accepted by S0b and not in scope here.
289
324
  Modern V8's `try/finally` elision varies; expect higher absolute speedups on
290
325
  production V8 than on this sandbox.
291
326
 
@@ -311,7 +346,7 @@ have a declaration.
311
346
  ### Fixed -- documentation had `runWithOwner` marked "not yet shipped"
312
347
 
313
348
  Both `README.md` and `llms.txt` still carried the 1.5.0-era sentence *"the re-attach
314
- companion `runWithOwner` … is not yet shipped"* while the engine exported it. Corrected
349
+ companion `runWithOwner` ... is not yet shipped"* while the engine exported it. Corrected
315
350
  in both, and `flushStrategy` / `flush()` -- previously mentioned nowhere outside the
316
351
  harness notes -- now have a full API-reference section in the README and a Core-concepts
317
352
  entry in `llms.txt`.
package/README.md CHANGED
@@ -896,7 +896,7 @@ The two uncovered branch arms in `Signal.js` are **unreachable by construction**
896
896
  - The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth ledger (1 arm). `maxLinkLimit` is `maxLinks * 16` and the ledger only ever doubles from `maxLinks`, so the doubling sequence lands *exactly* on the ceiling and can never overshoot it. The ceiling is still a real wall -- `26`/`12-coverage` prove the `CapacityError` -- it is only the *clamp* that is dead.
897
897
  - The `if (batchEpoch === 0) batchEpoch = 1;` 32-bit-wraparound guard in `batch()` (1 arm). Reaching it requires 2^32 batches in one registry.
898
898
 
899
- > Historical note: earlier releases listed a third item here -- `freeLink`'s `link.source !== null ? … : -1` fallbacks -- as "pure defensive code, unreachable by construction." That was wrong. Those arms *were* reachable, and only reachable, through a crash: disposing a source from inside an observer whose re-tracking cursor was still parked on that source's link left `disposeNode` freeing a link the cursor pointed at, and `severTail` then null-dereferenced in `freeLink`. Fixed with a one-line cursor repair in `disposeNode`; the fallbacks are now genuinely dead and were removed (replaced by the always-live `source.id` / `target.id`). The crash path is pinned by a regression test in `12-coverage`.
899
+ > Historical note: earlier releases listed a third item here -- `freeLink`'s `link.source !== null ? ... : -1` fallbacks -- as "pure defensive code, unreachable by construction." That was wrong. Those arms *were* reachable, and only reachable, through a crash: disposing a source from inside an observer whose re-tracking cursor was still parked on that source's link left `disposeNode` freeing a link the cursor pointed at, and `severTail` then null-dereferenced in `freeLink`. Fixed with a one-line cursor repair in `disposeNode`; the fallbacks are now genuinely dead and were removed (replaced by the always-live `source.id` / `target.id`). The crash path is pinned by a regression test in `12-coverage`.
900
900
 
901
901
  Rather than papering over these with an ignore pragma, they are listed here. `Signal.js` is sha256-pinned across the 1.6 -> 1.7 boundary on eleven hot-path function bodies; adding coverage pragmas to it would have broken that proof for no behavioural gain.
902
902
 
@@ -925,9 +925,56 @@ npm run test:gc
925
925
  npm run bench
926
926
  ```
927
927
 
928
- ### Tier 4 -- Torture soaks (crash detection under chaos)
928
+ ### Tier 4 -- Torture (correctness and resources under chaos)
929
929
 
930
- `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:
930
+ `bench/torture/` holds the complete **17-scenario superset (14 semantic + 3
931
+ soak)** behind one runner (`run.mjs`), the forward-compatible set through 1.9.
932
+ They are not perf benchmarks: the ops/sec figures reflect random workload
933
+ composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
934
+ perf harness. Every scenario feature-detects and **skips cleanly** below the
935
+ engine version that introduces its feature, so on the 1.7.0 engine the runner
936
+ executes **12 semantic** scenarios (including `flush-torture`) and reports a clean
937
+ SKIP for the two later-version ones (`cleanup-return-torture` 1.8.0,
938
+ `dispose-torture` 1.9.0).
939
+
940
+ ```bash
941
+ npm run torture # everything
942
+ npm run torture:semantic # correctness only, CI-shaped
943
+ npm run torture:soak # resource soaks only
944
+ node bench/torture/run.mjs --list
945
+ ```
946
+
947
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
948
+
949
+ Run these on every commit. The nine untagged scenarios run on any 1.4.x+ engine;
950
+ `box-torture` (1.5.0), `scope-torture` (1.6.0), and `flush-torture` (1.7.0) run
951
+ here because their features exist; the two tagged `1.8.0+`/`1.9.0+` feature-detect
952
+ and SKIP on this engine.
953
+
954
+ | scenario | pins |
955
+ | -------- | ---- |
956
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
957
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
958
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies |
959
+ | `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
960
+ | `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 |
961
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts |
962
+ | `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
963
+ | `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
964
+ | `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 |
965
+ | `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
966
+ | `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
967
+ | `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 |
968
+ | `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard -- SKIP on 1.7.0 |
969
+ | `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.7.0 |
970
+
971
+ #### `soak` -- wall-clock bound, asserts on **resources**
972
+
973
+ Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
974
+ and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
975
+ effect rewires, nested-batch + untrack reads, and microtask-scheduled async
976
+ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
977
+ failure:
931
978
 
932
979
  - zero thrown exceptions during the run, and
933
980
  - 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.7.0
2
+ * @zakkster/lite-signal v1.7.0-alpha.3
3
3
  * --------------------
4
4
  * 1.7.0 -- flushStrategy: registry-level effect-delivery policy.
5
5
  *
@@ -23,7 +23,7 @@
23
23
  * closure captures a constant function reference for its lifetime; V8 inlines the
24
24
  * monomorphic target. In "eager" mode the inlined body is byte-identical to the
25
25
  * 1.6.0 inline check (`if (batchDepth === 0) flushEffects()`), preserving the
26
- * §0b ledger #6 verdict (per-call closure-var loads are forbidden -- a hoisted
26
+ * S0b ledger #6 verdict (per-call closure-var loads are forbidden -- a hoisted
27
27
  * function reference + monomorphic inlining is not the same mechanism).
28
28
  *
29
29
  * Original 1.6.0 header follows.
package/llms.txt CHANGED
@@ -59,8 +59,17 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
59
59
 
60
60
  ## Version notes
61
61
 
62
- - **1.7.0-alpha** (current): the **flush-strategy minor**. Two engine additions and
63
- one large tooling correction.
62
+ - **1.7.0-alpha.3** (current): the **flush-strategy minor**. Two engine additions and
63
+ one large tooling correction (all shipped in alpha.0, below); `alpha.3` rolls up
64
+ the dangling-cursor crash fix (a one-line `disposeNode` cursor repair; the
65
+ `freeLink` `-1` fallbacks it made dead were removed and branch coverage on
66
+ `Signal.js` closed to **100%**), `flush-torture` now executing on this engine
67
+ (so the runner runs **12 semantic** + 2 skip -- `cleanup-return` 1.8.0,
68
+ `dispose` 1.9.0 -- of the 17-scenario suite), and the removal of a byte-identical
69
+ duplicate `test/28-scope.test.mjs` (the scope suite had been running twice; the
70
+ correctly-numbered `29-scope.test.mjs` remains). Verified green: torture 17/17;
71
+ unit **485 tests, 465 pass, 0 fail, 1 skip** (SSR N/A) -- 484 pass with the
72
+ sibling `@zakkster/lite-devtools` the 19-test `test/25` rig needs.
64
73
 
65
74
  **1) `flushStrategy` + `r.flush()`** -- per-registry control over *when* effects
66
75
  deliver (`"eager"` default | `"sab"` | `"manual"`), plus an explicit `flush()` on
@@ -771,7 +780,7 @@ function dumpOwnerTree(handle, depth = 0) {
771
780
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
772
781
  - `bench/mirror.mjs` + `bench/sweep.mjs` -- Andrii's canonical adapter verbatim, cross-framework rows diffing 1:1 against his log; aggregate output `rb.txt` (lite vs alien across 47 shapes, isolated-per-row).
773
782
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
774
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
783
+ - `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.7.0 engine and stays green from 1.4.x forward. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **12 that execute on 1.7.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 -- same graph + op sequence under eager/sab/manual reaching identical settled values -- plus per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each); plus **2 that skip cleanly** as later-version features: `cleanup-return-torture` (1.8.0 effect-return cleanup), `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`.
775
784
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
776
785
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
777
786
  - `harness/smoke.mjs` -- 1.7 flushStrategy semantics (eager/sab/manual) + `flush()`; 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.7.0-alpha.3",
3
+ "version": "1.7.0-alpha.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",
@@ -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",