@zakkster/lite-signal 1.9.0-preview.2 → 1.9.0-preview.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 +116 -8
- package/LICENSE.txt +21 -0
- package/README.md +57 -5
- package/Signal.js +1 -1
- package/llms.txt +60 -2
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,114 @@ 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
|
-
## [
|
|
7
|
+
## [1.9.0-preview.3] -- 2026-08-18
|
|
8
|
+
|
|
9
|
+
Verification-only parity cut. **The engine is UNCHANGED** -- `Signal.js` (2209
|
|
10
|
+
lines) is byte-for-byte identical to `preview.2`; this cut only brings the
|
|
11
|
+
`bench/torture` suite and the unit tests to FULL PARITY with the shipped 1.4.4
|
|
12
|
+
canonical suite, then VERIFIES-then-PINS 1.9.0's actual behaviour (no assertion
|
|
13
|
+
softened, no budget widened).
|
|
14
|
+
|
|
15
|
+
### Added -- the last three torture scenarios + soak value-oracles + a throwing-equals pin
|
|
16
|
+
|
|
17
|
+
- **`error-torture`** -- throwing effect bodies under flush: a single throw is
|
|
18
|
+
re-thrown UNWRAPPED; two or more aggregate into one `AggregateError` carrying
|
|
19
|
+
EXACTLY those errors in order; the effect scheduled between two throwers still
|
|
20
|
+
runs; and the pre-allocated error buffer drains to a clean baseline over 4096
|
|
21
|
+
throw/clean cycles (`activeNodes` / `activeLinks` flat). Pinned against 1.9.0
|
|
22
|
+
`Signal.js` :928 (buffer append), :936-937 (finally clear), :941-951 (single
|
|
23
|
+
re-throw / AggregateError).
|
|
24
|
+
- **`deep-chain-torture`** -- `pullComputed` (1.9.0 :1092, recursing at :1113) is
|
|
25
|
+
call-stack recursive, so a computed chain ramped START 2000 / STEP 2000 /
|
|
26
|
+
CEILING 100000 fails CLOSED with a `RangeError` at some depth; the registry
|
|
27
|
+
stays usable, the re-read is deterministic, and the heap-iterative effect
|
|
28
|
+
cascade over an equally deep chain completes without throwing.
|
|
29
|
+
- **`zerogc-torture`** -- the zero-GC claim as a re-runnable gate via
|
|
30
|
+
`@zakkster/lite-gc-profiler` (added as a dev-only dependency): `measureAllocs` /
|
|
31
|
+
`checkAllocs` at `maxBytesPerCall: 0`, `measureOps` / `checkNoGc` at
|
|
32
|
+
`maxMajor: 0` / `maxPauseMs: 2`, and `stats()` poolGrowths/totalAllocations
|
|
33
|
+
deltas, over deep/wide/batch steady writes plus create/dispose churn on both the
|
|
34
|
+
callable form and `signalBox` (churn-box activates natively and reports a visible
|
|
35
|
+
"ok" verdict). `ZEROGC_BREAK=1` self-tests that the gate rejects a planted
|
|
36
|
+
allocation (exits non-zero).
|
|
37
|
+
- **`capacity-torture` section 9** -- the 16x link grow ceiling: `grow` mode still
|
|
38
|
+
fails closed at `maxLinks * 16` (confirmed 1.9.0 :312 / :471) with a `links`
|
|
39
|
+
`CapacityError`, growth terminating AT the ceiling, and a fail-closed re-throw
|
|
40
|
+
rather than a partial sum.
|
|
41
|
+
- **Soak value-oracles** -- `graph-fuzzer`, `scheduler-bench`, `torture-soak` now
|
|
42
|
+
assert VALUE-CORRECTNESS, not just resources: a single `Int32Array` shadow,
|
|
43
|
+
allocated ONCE before the loop, shadows every writable signal; a rotating fixed
|
|
44
|
+
window is checked per tick (no per-tick allocation) and a full sweep runs at
|
|
45
|
+
teardown; a mismatch exits 1 with the seed and index. The module-scoped int32
|
|
46
|
+
JIT sink replaces the former magic-constant "impossible" guard.
|
|
47
|
+
- **`test/30-throwing-equals.test.mjs`** -- a user `equals` that THROWS, pinned at
|
|
48
|
+
all five 1.9.0 sites: the three callable sites (signal set pre-check :1272, batch
|
|
49
|
+
revert :1279, computed re-eval :1143) with a CONTRAST anti-tautology test, and
|
|
50
|
+
the two `signalBox` `boxSet` sites (pre-check :1403, revert :1410).
|
|
51
|
+
|
|
52
|
+
### Changed -- introspect-torture forEachOwned pinned to an exact count
|
|
53
|
+
|
|
54
|
+
`introspect-torture` section 7 asserted `owned >= 2`; the owned count under one
|
|
55
|
+
scope owner (a computed + an effect) is DETERMINISTICALLY 2, so it is now pinned
|
|
56
|
+
`owned === 2`. No behavioural change -- a tightened assertion.
|
|
57
|
+
|
|
58
|
+
### Verified -- the whole superset runs natively on the 1.9.0 engine
|
|
59
|
+
|
|
60
|
+
`dispose`, `cleanup-return`, `owner`, `scope`, and `flush` all execute NATIVELY
|
|
61
|
+
here with zero feature-skips: 1.9.0 is the first engine to run the complete
|
|
62
|
+
torture superset.
|
|
63
|
+
|
|
64
|
+
- **Torture:** 22/22 -- `torture:semantic` 19/19 (all executed, zero skips),
|
|
65
|
+
`torture:soak` 3/3 (zero errors, value-oracle clean, every pool back to its
|
|
66
|
+
leaf-only floor).
|
|
67
|
+
- **Unit (`npm test`):** 512 tests, 511 pass, 0 fail, 1 skip.
|
|
68
|
+
- **Unit (`npm run test:gc`):** 520 tests, 519 pass, 0 fail, 1 skip.
|
|
69
|
+
|
|
70
|
+
## [1.9.0-preview.2] -- 2026-07-27
|
|
71
|
+
|
|
72
|
+
Rolls up the post-`1.9.0-preview` changes into the `preview.2` tag. The 1.9.0
|
|
73
|
+
feature (`using` / `Symbol.dispose` on lifecycle objects) ships in the preview and
|
|
74
|
+
is unchanged here; this cut adds two new torture scenarios from a consolidated
|
|
75
|
+
coverage audit, the crash fix inherited from the 1.8.0 base, 100% coverage, and
|
|
76
|
+
test-suite hygiene.
|
|
77
|
+
|
|
78
|
+
### Added -- torture suite reaches the zero-skip milestone (19 scenarios)
|
|
79
|
+
|
|
80
|
+
Two effects converge on the 1.9.0 engine. First, **`dispose-torture` now
|
|
81
|
+
executes**: 1.9.0 stamps `Symbol.dispose` at five sites (the registry -> destroy,
|
|
82
|
+
an effect's stop handle, a `createScope` disposer, a `createRoot` disposer, and
|
|
83
|
+
both box prototypes), so `using`-declared lifecycle objects dispose at block exit.
|
|
84
|
+
The scenario feature-detects via the box-prototype stamp and drives each site
|
|
85
|
+
through the TC39 `using` path, asserting idempotent disposal. Because it is a set
|
|
86
|
+
of stamped methods with **no new export**, it is exactly the profile the value /
|
|
87
|
+
introspection oracles cannot see. Second, the coverage audit added **two new
|
|
88
|
+
semantic scenarios** for exports no scenario exercised directly:
|
|
89
|
+
|
|
90
|
+
- **`owner-torture`** (1.6.0+) -- `getOwner` / `runWithOwner` capture-restore: the
|
|
91
|
+
gen-stamped owner handle, adoption of effects/computeds created inside
|
|
92
|
+
`runWithOwner`, and cascade-dispose when the captured owner is torn down.
|
|
93
|
+
- **`lifecycle-torture`** (createRoot 1.5.0+, destroy 1.4.0+) -- `createRoot`
|
|
94
|
+
detachment (an owned subtree that survives its enclosing scope) and the direct
|
|
95
|
+
`destroy` reset contract; `createRoot` had never been called by any scenario,
|
|
96
|
+
and `destroy` was only reached indirectly through a registry `Symbol.dispose`.
|
|
97
|
+
|
|
98
|
+
The suite is now **19 scenarios (16 semantic + 3 soak)**. On the 1.9.0 engine
|
|
99
|
+
**every semantic scenario executes -- zero feature-skips** -- the first engine
|
|
100
|
+
version to run the complete superset, since `dispose` was the last remaining
|
|
101
|
+
feature gate (box 1.5.0, scope/owner/introspect 1.6.0, flush 1.7.0,
|
|
102
|
+
cleanup-return 1.8.0, dispose 1.9.0 are all satisfied).
|
|
103
|
+
|
|
104
|
+
### Verified -- full suite green on the 1.9.0 engine (Node 22, `--expose-gc`)
|
|
105
|
+
|
|
106
|
+
- **Torture:** 19/19 -- `torture:semantic` 16/16 (all executed, zero skips),
|
|
107
|
+
`torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
|
|
108
|
+
- **Unit (plain run):** 499 tests, 479 pass, 0 fail, 1 skip (the architectural
|
|
109
|
+
SSR N/A in `17-reactivity`). The only non-passes are the 19 in
|
|
110
|
+
`test/25-devtools-real-boot`, the real-rig that requires the sibling
|
|
111
|
+
`@zakkster/lite-devtools`; with that sibling resolvable the suite is 498 pass +
|
|
112
|
+
1 skip. Engine-only, excluding `test/25`: 480 tests, 479 pass, 1 skip. (The c8
|
|
113
|
+
coverage run below reports a different count -- perf-smoke budgets skip under
|
|
114
|
+
instrumentation.)
|
|
8
115
|
|
|
9
116
|
### Changed -- bench protocol v3 (carried forward)
|
|
10
117
|
|
|
@@ -43,8 +150,11 @@ cleanup-return array-append arm (carried in via `33-cleanup-return`). Three prov
|
|
|
43
150
|
|
|
44
151
|
Test-suite hygiene: `33-computed-selfdirty-prev-owner.test.mjs` renamed to `34-`
|
|
45
152
|
(the `33-` slot belongs to `33-cleanup-return`, which carries forward from 1.8.0
|
|
46
|
-
because this line inherits effect cleanup-return)
|
|
47
|
-
|
|
153
|
+
because this line inherits effect cleanup-return) -- the rename had left a
|
|
154
|
+
byte-identical `33-` copy behind, so the scope suite's `28-`/`29-` pattern
|
|
155
|
+
repeated here; the stray `33-computed-selfdirty-prev-owner.test.mjs` is deleted,
|
|
156
|
+
leaving one `34-`. The duplicate `28-scope.test.mjs` was likewise dropped in
|
|
157
|
+
favour of `29-scope.test.mjs` (both were byte-identical).
|
|
48
158
|
|
|
49
159
|
**Hot-path parity note:** the fix touches `disposeNode` and `freeLink`; re-baseline
|
|
50
160
|
the VersionMatrix engine sha256 on the next publish.
|
|
@@ -455,8 +565,6 @@ cascade forward from every prior 1.x line without semantic change.
|
|
|
455
565
|
|
|
456
566
|
## [1.8.0-preview] -- 2026-07-XX
|
|
457
567
|
|
|
458
|
-
## [1.8.0-preview] -- 2026-07-XX
|
|
459
|
-
|
|
460
568
|
The **effect cleanup return** minor -- Reflex-study pattern A. One additive
|
|
461
569
|
hot-path change: an effect body may now `return` a cleanup function, which
|
|
462
570
|
runs before the next re-run and on dispose, composing with imperative
|
|
@@ -755,9 +863,9 @@ monomorphic targets and inlines the body. In "eager" mode the inlined body is
|
|
|
755
863
|
byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
|
|
756
864
|
-- **zero behavioral or performance regression** for any existing user.
|
|
757
865
|
|
|
758
|
-
This is NOT ledger
|
|
866
|
+
This is NOT ledger S0b #6 (per-call closure-var load of a primitive). It is a
|
|
759
867
|
hoisted function reference resolved once at registry build time and is a NEW
|
|
760
|
-
mechanism by the v1 roadmap
|
|
868
|
+
mechanism by the v1 roadmap S0b line 100 definition.
|
|
761
869
|
|
|
762
870
|
The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
|
|
763
871
|
hot path. sha256 over the extracted function bodies of `pullComputed`,
|
|
@@ -802,7 +910,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
|
|
|
802
910
|
|
|
803
911
|
Real wins, but smaller than the gap to Reflex on the same shapes. The residual
|
|
804
912
|
gap is structural (per-write `gen` check, batch-revert epoch tracking, global
|
|
805
|
-
version bumping) -- design decisions accepted by
|
|
913
|
+
version bumping) -- design decisions accepted by S0b and not in scope here.
|
|
806
914
|
Modern V8's `try/finally` elision varies; expect higher absolute speedups on
|
|
807
915
|
production V8 than on this sandbox.
|
|
808
916
|
|
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
|
@@ -813,7 +813,9 @@ Three tiers, all reproducible.
|
|
|
813
813
|
|
|
814
814
|
### Tier 1 -- Behavior (unit tests, fast)
|
|
815
815
|
|
|
816
|
-
`npm test`
|
|
816
|
+
On the 1.9.0 engine `npm test` reports **512 tests, 511 pass, 0 fail, 1 skip**, and
|
|
817
|
+
`npm run test:gc` (Tier 2, `--expose-gc`) reports **520 tests, 519 pass, 0 fail, 1
|
|
818
|
+
skip**. `npm test` runs the suite in `test/`, covering:
|
|
817
819
|
|
|
818
820
|
- **`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.
|
|
819
821
|
- **`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`).
|
|
@@ -842,6 +844,7 @@ Three tiers, all reproducible.
|
|
|
842
844
|
- **`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.
|
|
843
845
|
- **`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
846
|
- **`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%).
|
|
847
|
+
- **`30-throwing-equals.test.mjs`** -- a user `equals` that THROWS, pinned at all five 1.9.0 invocation sites (9 tests): the three callable sites (signal set pre-check, batch revert, computed re-eval -- with a CONTRAST anti-tautology test proving the batch-revert pin is caused by the throw, not the set-then-back shape) and the two `signalBox` `boxSet` sites (pre-check leaves the box unmutated; batch-revert strands the version bump so the net value fires downstream).
|
|
845
848
|
|
|
846
849
|
```bash
|
|
847
850
|
npm test
|
|
@@ -870,12 +873,61 @@ npm run test:gc
|
|
|
870
873
|
npm run bench
|
|
871
874
|
```
|
|
872
875
|
|
|
873
|
-
### Tier 4 -- Torture
|
|
876
|
+
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
874
877
|
|
|
875
|
-
`bench/torture/`
|
|
878
|
+
`bench/torture/` holds the complete **22-scenario suite (19 semantic + 3 soak)**
|
|
879
|
+
behind one runner (`run.mjs`). They are not perf benchmarks: the ops/sec figures
|
|
880
|
+
reflect random workload composition, not engine throughput -- `bench/benchmark.mjs`
|
|
881
|
+
remains the canonical perf harness. Every scenario feature-detects and skips
|
|
882
|
+
cleanly below the engine version that introduces its feature; on the **1.9.0
|
|
883
|
+
engine all 19 semantic scenarios execute with zero feature-skips** -- the first
|
|
884
|
+
engine version to run the complete superset, since `dispose` was the last gate.
|
|
876
885
|
|
|
877
|
-
|
|
878
|
-
|
|
886
|
+
```bash
|
|
887
|
+
npm run torture # everything
|
|
888
|
+
npm run torture:semantic # correctness only, CI-shaped
|
|
889
|
+
npm run torture:soak # resource soaks only
|
|
890
|
+
node bench/torture/run.mjs --list
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
894
|
+
|
|
895
|
+
Run these on every commit.
|
|
896
|
+
|
|
897
|
+
| scenario | pins |
|
|
898
|
+
| -------- | ---- |
|
|
899
|
+
| `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
|
|
900
|
+
| `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
|
|
901
|
+
| `work-accounting` | minimum body-execution counts across 10 fixed topologies |
|
|
902
|
+
| `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
|
|
903
|
+
| `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 |
|
|
904
|
+
| `concurrent-storm` | eight reentrancy and flush-ordering contracts |
|
|
905
|
+
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
906
|
+
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
907
|
+
| `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, pool balance over 200 rounds |
|
|
908
|
+
| `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 |
|
|
909
|
+
| `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 |
|
|
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, and the 16x link grow ceiling (`maxLinks * 16`) that fails closed too |
|
|
912
|
+
| `error-torture` | throwing effect bodies under flush: a single throw re-thrown unwrapped, 2+ aggregated into an `AggregateError` carrying exactly those errors, the survivor still runs, and the error buffer drains to baseline over 4096 throw/clean cycles |
|
|
913
|
+
| `deep-chain-torture` | `pullComputed` recursion fails closed with a `RangeError` at a ramped depth (<= 100000) while the heap-iterative effect-cascade push path stays open at the same depth |
|
|
914
|
+
| `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 |
|
|
915
|
+
| `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 |
|
|
916
|
+
| `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 |
|
|
917
|
+
| `zerogc-torture` | the zero-GC claim as a gate via `@zakkster/lite-gc-profiler`: `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + `stats()` deltas over steady + create/dispose churn (callable and `signalBox`); `ZEROGC_BREAK=1` self-tests that the gate rejects a planted allocation |
|
|
918
|
+
|
|
919
|
+
#### `soak` -- wall-clock bound, asserts on **resources**
|
|
920
|
+
|
|
921
|
+
Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
|
|
922
|
+
and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
|
|
923
|
+
effect rewires, nested-batch + untrack reads, and microtask-scheduled async
|
|
924
|
+
flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
|
|
925
|
+
failure:
|
|
926
|
+
|
|
927
|
+
- zero thrown exceptions during the run,
|
|
928
|
+
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn),
|
|
929
|
+
- a module-scoped int32 JIT sink advanced (the work loops were not optimised away), and
|
|
930
|
+
- **value-correctness**: a single `Int32Array` shadow oracle -- allocated ONCE before the loop, a rotating fixed window checked per tick (no per-tick allocation) plus a full sweep at teardown -- confirms every writable signal read back its last written value.
|
|
879
931
|
|
|
880
932
|
```bash
|
|
881
933
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
package/Signal.js
CHANGED
package/llms.txt
CHANGED
|
@@ -53,7 +53,65 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
53
53
|
|
|
54
54
|
## Version notes
|
|
55
55
|
|
|
56
|
-
- **1.
|
|
56
|
+
- **1.9.0-preview.3** (current): the **verification-surface parity cut**. No engine
|
|
57
|
+
change from preview.2 -- `Signal.js` is byte-identical (its header banner still
|
|
58
|
+
reads `preview.2`) and `bench/torture/` stays out of `files[]`; for consumers
|
|
59
|
+
preview.3 is preview.2 plus a version number. It brings the torture suite to full
|
|
60
|
+
parity with the shipped 1.4.4 canonical: a parity port of the last three scenarios
|
|
61
|
+
-- `error-torture` (throwing effect bodies: single re-thrown unwrapped, two-or-more
|
|
62
|
+
aggregated into an `AggregateError` carrying exactly those errors, survivors still
|
|
63
|
+
run, buffer drains over 4096 cycles), `deep-chain-torture` (`pullComputed`
|
|
64
|
+
recursion fails closed with a `RangeError` at ramped depth while the iterative push
|
|
65
|
+
path stays open), and `zerogc-torture` (the zero-GC gate via
|
|
66
|
+
`@zakkster/lite-gc-profiler` at `maxBytesPerCall: 0` / `maxMajor: 0` /
|
|
67
|
+
`maxPauseMs: 2` plus exact `stats()` deltas and an activating `churn-box`,
|
|
68
|
+
mutation-verified by `ZEROGC_BREAK=1`) -- a `grow-ceiling` section on
|
|
69
|
+
`capacity-torture` (the 16x link ceiling terminating exactly at `maxLinks*16`), an
|
|
70
|
+
`Int32Array` value-oracle added to all three soaks (so they assert value-correctness,
|
|
71
|
+
not just resources, at zero per-tick allocation), and a new
|
|
72
|
+
`test/30-throwing-equals.test.mjs` pinning a throwing user `equals` at all five
|
|
73
|
+
invocation sites (3 callable + 2 signalBox `boxSet`). This takes the suite to **22
|
|
74
|
+
scenarios (19 semantic + 3 soak)**, all 19 semantic executing on this engine with
|
|
75
|
+
no feature-skips (the first engine to run the complete superset). Verified green:
|
|
76
|
+
torture 22/22; unit **512 tests, 511 pass, 0 fail, 1 skip** under `npm test` and
|
|
77
|
+
**520 tests, 519 pass, 0 fail, 1 skip** under `npm run test:gc` (with the sibling
|
|
78
|
+
`@zakkster/lite-devtools` the `test/25` rig needs). Drop-in over preview.2.
|
|
79
|
+
|
|
80
|
+
- **1.9.0-preview.2**: the **explicit-resource-management minor**. A
|
|
81
|
+
single-feature engine cut: `Symbol.dispose` is stamped at five sites -- the
|
|
82
|
+
registry (-> `destroy`), an effect's stop handle (-> `stop`), a `createScope`
|
|
83
|
+
disposer, a `createRoot` disposer, and both box prototypes (-> `dispose`) -- so
|
|
84
|
+
every lifecycle object works with the TC39 `using` declaration and disposes at
|
|
85
|
+
block exit. No new export; existence-guarded, so manual `[Symbol.dispose]()`
|
|
86
|
+
works on Node 20+ and the `: null` arm covers older runtimes. `preview.2` also
|
|
87
|
+
carries the dangling-cursor crash fix inherited from the 1.8.0 base (one-line
|
|
88
|
+
`disposeNode` cursor repair) and closes `Signal.js` to **100%**. Torture reaches
|
|
89
|
+
the **zero-skip milestone**: `dispose-torture` now executes, and a coverage audit
|
|
90
|
+
added two semantic scenarios -- `owner-torture` (`getOwner`/`runWithOwner`
|
|
91
|
+
capture-restore) and `lifecycle-torture` (`createRoot` detachment + the direct
|
|
92
|
+
`destroy` reset, both previously unexercised) -- bringing the suite to **19
|
|
93
|
+
scenarios (16 semantic + 3 soak)**. Drop-in over 1.8.0.
|
|
94
|
+
|
|
95
|
+
- **1.8.0**: the **effect-cleanup-return minor**. An EFFECT body may `return` a
|
|
96
|
+
cleanup function (Solid/Vue/Reflex-compatible), run at the same points as
|
|
97
|
+
`onCleanup` -- before each re-run and once on dispose -- and APPENDED after any
|
|
98
|
+
`onCleanup` from the same body, so both compose in call order. Non-function
|
|
99
|
+
returns ignored; self-disposed body registers nothing; computeds excluded (a
|
|
100
|
+
returned function stays the VALUE). Cost is one `typeof` per effect run;
|
|
101
|
+
`executeEffect` is the only hot body whose sha256 changed 1.7.0 -> 1.8.0. Torture
|
|
102
|
+
added `cleanup-return-torture` (timing, compose order, self-dispose guard,
|
|
103
|
+
computed exclusion).
|
|
104
|
+
|
|
105
|
+
- **1.7.0**: the **flush-strategy minor**. `createRegistry({flushStrategy})` gives
|
|
106
|
+
per-registry control over *when* effects deliver (`"eager"` default | `"sab"` |
|
|
107
|
+
`"manual"`), plus an explicit `r.flush()`; the lever resolves once at init into
|
|
108
|
+
two closure-captured `const` booleans, so the `"eager"` body is byte-identical to
|
|
109
|
+
1.6.0. Also forward-ported `getOwner` / `runWithOwner` from 1.5.0-beta.2 and fixed
|
|
110
|
+
the propagation benchmark harness (every pre-1.7.0 number in `bench/results.txt`
|
|
111
|
+
is void). Torture added `flush-torture` (the three modes by cross-strategy
|
|
112
|
+
differential + `.subscribe()`).
|
|
113
|
+
|
|
114
|
+
- **1.6.0-preview**: the **observability-and-lifecycle minor**, shipping
|
|
57
115
|
on the `preview` dist-tag while it settles. Two additions, both on existing
|
|
58
116
|
hot-path-adjacent edges:
|
|
59
117
|
|
|
@@ -690,7 +748,7 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
690
748
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
691
749
|
- `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
|
|
692
750
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
693
|
-
- `bench/torture/` -- crash-
|
|
751
|
+
- `bench/torture/` -- the complete **22-scenario suite (19 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 19 semantic execute with zero skips** -- the first engine to run the whole superset (`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, `forEachOwned` pinned to an exact owned count), `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 + CapacityError + the 16x grow ceiling), `error-torture` (throwing effect bodies under flush: a single throw re-thrown unwrapped, 2+ aggregated into an AggregateError carrying exactly those errors, the survivor still runs, and the pre-allocated error buffer drains to baseline over 4096 throw/clean cycles), `deep-chain-torture` (pullComputed recursion fails closed with a RangeError at a ramped depth <= 100000 while the heap-iterative effect-cascade push path stays open at the same depth), `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), `zerogc-torture` (the zero-GC claim as a re-runnable gate via @zakkster/lite-gc-profiler -- measureAllocs/checkAllocs at `maxBytesPerCall: 0` + measureOps/checkNoGc at `maxMajor: 0`/`maxPauseMs: 2` + `stats()` poolGrowths/totalAllocations deltas, plus create/dispose churn on both callable and signalBox; the `ZEROGC_BREAK=1` self-test proves the gate rejects a planted allocation). `soak` (wall-clock bound, asserts on RESOURCES AND VALUE-CORRECTNESS; 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 (a module-scoped int32) advanced AND a once-allocated `Int32Array` shadow oracle (rotating fixed window per tick, full sweep at teardown) confirms every writable signal read back its last written value. Runner spawns each scenario as a child process and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
694
752
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
695
753
|
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
696
754
|
- `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.
|
|
3
|
+
"version": "1.9.0-preview.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",
|
|
@@ -83,6 +86,7 @@
|
|
|
83
86
|
"sideEffects": false,
|
|
84
87
|
"devDependencies": {
|
|
85
88
|
"@zakkster/lite-devtools": "^1.2.0",
|
|
89
|
+
"@zakkster/lite-gc-profiler": "^1.15.0",
|
|
86
90
|
"@zakkster/lite-profiler": "^1.1.0",
|
|
87
91
|
"@zakkster/lite-profiler-signal": "^1.2.0",
|
|
88
92
|
"@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
|