@zakkster/lite-signal 1.7.0-alpha.3 → 1.7.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 +115 -9
- package/README.md +66 -9
- package/Signal.js +2 -2
- package/llms.txt +26 -3
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,99 @@ 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.7.0-alpha.4] -- 2026-08-18
|
|
8
|
+
|
|
9
|
+
**Torture-suite and test parity with the shipped 1.4.4 canonical suite.** This is
|
|
10
|
+
a **verification-only** cut: `Signal.js` and `Signal.d.ts` are **UNCHANGED**
|
|
11
|
+
(shasum-identical to alpha.3). Nothing in the engine, the public surface, or the
|
|
12
|
+
runtime behaviour moved. Every number below was verified against the real 1.7.0
|
|
13
|
+
engine and pins its ACTUAL behaviour -- no assertion was softened, no budget
|
|
14
|
+
widened.
|
|
15
|
+
|
|
16
|
+
### Added -- five torture scenarios ported to full 1.4.4 parity (17 -> 22)
|
|
17
|
+
|
|
18
|
+
`bench/torture/` now carries the complete **22-scenario superset (19 semantic +
|
|
19
|
+
3 soak)**. The five ported scenarios all target primitives 1.7.0 already ships,
|
|
20
|
+
so they **run natively -- no SKIP**:
|
|
21
|
+
|
|
22
|
+
- `lifecycle-torture` -- `createRoot` detachment (detached children survive and
|
|
23
|
+
stay reactive, deps isolated) + `destroy` registry reset (stales every handle,
|
|
24
|
+
returns `stats().activeNodes` to 0). Both halves native.
|
|
25
|
+
- `owner-torture` -- `getOwner` / `runWithOwner` capture-restore via `createScope`:
|
|
26
|
+
live-owner adoption cascade-disposes, a STALE handle degrades to ROOTED, deps
|
|
27
|
+
stay isolated, plus a 300-seed capture/dispose/recycle/restore fuzz. Native.
|
|
28
|
+
- `error-torture` -- throwing effect bodies under flush: a single throw re-thrown
|
|
29
|
+
UNWRAPPED, 2+ aggregated into an `AggregateError` carrying EXACTLY those errors,
|
|
30
|
+
a survivor between two throwers still runs, and the error buffer drains flat
|
|
31
|
+
(`activeNodes`/`activeLinks` unchanged) over 4096 throw/clean cycles.
|
|
32
|
+
- `deep-chain-torture` -- `pullComputed` recursion fails CLOSED with a `RangeError`
|
|
33
|
+
beyond the stack budget (ramp 2000/2000/100000, depth never pinned) while the
|
|
34
|
+
iterative push path stays open; the registry that threw stays usable and the
|
|
35
|
+
re-throw is deterministic.
|
|
36
|
+
- `zerogc-torture` -- the zero-GC claim made falsifiable via `@zakkster/lite-gc-profiler`:
|
|
37
|
+
`measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc`
|
|
38
|
+
at `maxMajor: 0` / `maxPauseMs: 2` + engine `stats()` deltas across steady and
|
|
39
|
+
create/dispose churn, with the `churn-box` signalBox path active on 1.7.0 and a
|
|
40
|
+
`ZEROGC_BREAK=1` self-test that must fail the gate.
|
|
41
|
+
|
|
42
|
+
`run.mjs` registers all five in the 1.4.4 order (owner after scope; error +
|
|
43
|
+
deep-chain after capacity; zerogc after dispose; lifecycle after introspect).
|
|
44
|
+
`node bench/torture/run.mjs --list` -> 22.
|
|
45
|
+
|
|
46
|
+
### Added -- `test/30-throwing-equals.test.mjs`
|
|
47
|
+
|
|
48
|
+
Pins the behaviour of a user `equals` predicate that THROWS at all five engine
|
|
49
|
+
sites: the three callable sites (signal `set` pre-check, batch-revert check,
|
|
50
|
+
computed re-eval) and signalBox `boxSet`'s two (pre-check, revert). Includes the
|
|
51
|
+
CONTRAST anti-tautology test (a clean set-X-then-back suppresses the re-run,
|
|
52
|
+
proving the throw is the cause) plus the a-box / b-box cases.
|
|
53
|
+
|
|
54
|
+
### Changed -- capacity section 9, tighter introspection, soak value-oracles
|
|
55
|
+
|
|
56
|
+
- `capacity-torture` gains section 9: the 16x link-grow ceiling (`maxLinks * 16`),
|
|
57
|
+
pinning `err.kind === "links"`, `err.capacity === maxLinks * 16`, growth
|
|
58
|
+
terminating AT the ceiling, and a fail-closed re-throw. Sections 1-8 untouched.
|
|
59
|
+
- `introspect-torture`'s `forEachOwned` assertion tightened from `>= 2` to
|
|
60
|
+
EXACTLY 2 owned children (deterministic count).
|
|
61
|
+
- The three soaks (`graph-fuzzer`, `scheduler-bench`, `torture-soak`) gained a
|
|
62
|
+
once-allocated `Int32Array` shadow value-oracle -- a rotating fixed window per
|
|
63
|
+
tick with zero per-tick allocation and a full sweep at teardown; a mismatch
|
|
64
|
+
exits 1 with seed + index. The reachable magic-constant JIT sink was replaced
|
|
65
|
+
with a module-scoped int32 sink read under an `if (ops > 0 && sink === 0)`
|
|
66
|
+
teardown guard.
|
|
67
|
+
|
|
68
|
+
### Dev dependency
|
|
69
|
+
|
|
70
|
+
`@zakkster/lite-gc-profiler` (`^1.15.0`) added as a **dev-only** dependency for
|
|
71
|
+
`zerogc-torture`. `dependencies` stays empty; `package.json` `files[]` still
|
|
72
|
+
excludes `bench/`.
|
|
73
|
+
|
|
74
|
+
Verified green: torture **22/22** (20 execute + 2 later-version skips --
|
|
75
|
+
`cleanup-return-torture` 1.8.0, `dispose-torture` 1.9.0); unit **490 tests, 489
|
|
76
|
+
pass, 0 fail, 1 skip** (SSR N/A).
|
|
77
|
+
|
|
78
|
+
## [1.7.0-alpha.3] -- 2026-07-27
|
|
79
|
+
|
|
80
|
+
Rolls up the post-`1.7.0-alpha.0` changes into the `alpha.3` tag. The
|
|
81
|
+
flush-strategy feature (`flushStrategy` + `r.flush()`) and the forward-ported
|
|
82
|
+
`getOwner` / `runWithOwner` ship in alpha.0 and are unchanged here; what this cut
|
|
83
|
+
adds is the dangling-cursor crash fix (below), 100% branch coverage on
|
|
84
|
+
`Signal.js`, the completed torture surface for the flush feature, and a
|
|
85
|
+
test-directory cleanup.
|
|
86
|
+
|
|
87
|
+
### Added -- `flush-torture` now executes on the 1.7.0 engine
|
|
88
|
+
|
|
89
|
+
`bench/torture/`'s `flush-torture` scenario -- present but feature-skipped on the
|
|
90
|
+
1.5.x / 1.6.x lines -- now **runs**, since `flushStrategy` exists. It pins the
|
|
91
|
+
three modes by a cross-strategy differential (the same graph and op sequence
|
|
92
|
+
under `eager` / `sab` / `manual` must reach identical settled values once
|
|
93
|
+
drained -- they differ only in *when* draining happens), plus per-strategy
|
|
94
|
+
scheduling (eager flushes on `.set()`, sab only at batch exit, manual only on
|
|
95
|
+
`flush()`), re-entrant / empty `flush()`, and the `.subscribe()` contract under
|
|
96
|
+
each strategy. On the 1.7.0 engine the runner therefore executes **12 semantic**
|
|
97
|
+
scenarios and cleanly SKIPS the two later-version ones (`cleanup-return-torture`
|
|
98
|
+
1.8.0, `dispose-torture` 1.9.0); the suite total is unchanged at **17 (14
|
|
99
|
+
semantic + 3 soak)**.
|
|
8
100
|
|
|
9
101
|
### Changed -- bench protocol v3 (carried forward)
|
|
10
102
|
|
|
@@ -32,7 +124,7 @@ one-line cursor repair in `disposeNode` (advance the cursor to the next survivin
|
|
|
32
124
|
dep before the free); O(1), disposal path only, no steady-state cost. Pinned by a
|
|
33
125
|
regression test in `test/12-coverage.test.mjs`.
|
|
34
126
|
|
|
35
|
-
This also corrects the record on `freeLink`: the `link.source !== null ?
|
|
127
|
+
This also corrects the record on `freeLink`: the `link.source !== null ? ... : -1`
|
|
36
128
|
fallbacks were documented as "unreachable defensive code," but they were in fact
|
|
37
129
|
reachable -- and *only* reachable -- through this crash path. With the cursor
|
|
38
130
|
repaired they are genuinely dead, so they were removed (replaced by the passed
|
|
@@ -46,9 +138,23 @@ bodies are unchanged.
|
|
|
46
138
|
|
|
47
139
|
### Changed -- test file numbering
|
|
48
140
|
|
|
49
|
-
`test/28-scope.test.mjs` renamed to `test/29-scope.test.mjs` to resolve the
|
|
141
|
+
`test/28-scope.test.mjs` is renamed to `test/29-scope.test.mjs` to resolve the
|
|
50
142
|
duplicate `28-` prefix it shared with `28-run-with-owner.test.mjs`
|
|
51
|
-
(`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`).
|
|
143
|
+
(`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`). The
|
|
144
|
+
alpha.3 tree had carried *both* files -- the original `28-scope` and a
|
|
145
|
+
byte-identical `29-scope` copy -- so the scope suite was running twice; the stray
|
|
146
|
+
`28-scope.test.mjs` is deleted, leaving one `29-scope.test.mjs`.
|
|
147
|
+
|
|
148
|
+
### Verified -- full suite green on the 1.7.0 engine (Node 22, `--expose-gc`)
|
|
149
|
+
|
|
150
|
+
- **Torture:** 17/17 -- `torture:semantic` 14/14 (12 executed incl. `flush-torture`,
|
|
151
|
+
2 clean skips: `cleanup-return` 1.8.0, `dispose` 1.9.0), `torture:soak` 3/3
|
|
152
|
+
(zero errors, every pool back to its leaf-only floor).
|
|
153
|
+
- **Unit:** 485 tests, 465 pass, 0 fail, 1 skip (the architectural SSR N/A in
|
|
154
|
+
`17-reactivity`). The 1 skip aside, the only non-passes are the 19 in
|
|
155
|
+
`test/25-devtools-real-boot`, the real-rig that requires the sibling
|
|
156
|
+
`@zakkster/lite-devtools`; with that sibling resolvable the suite is 484 pass +
|
|
157
|
+
1 skip. (Engine-only, excluding `test/25`: 466 tests, 465 pass, 1 skip.)
|
|
52
158
|
|
|
53
159
|
## [1.7.0-alpha.0] -- 2026-07-14
|
|
54
160
|
|
|
@@ -161,7 +267,7 @@ const FLUSH_ON_BATCH_EXIT = (flushStrategy !== "manual");
|
|
|
161
267
|
They are immutable for the registry's lifetime, which gives V8's JIT the
|
|
162
268
|
constant-folding hook it needs: in `"eager"` mode the emitted code for `.set` is
|
|
163
269
|
byte-identical to 1.6.0's `if (batchDepth === 0) flushEffects()`; in
|
|
164
|
-
`"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE &&
|
|
270
|
+
`"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && ...` short-circuits on the const-false
|
|
165
271
|
and V8 elides the branch entirely after one tier-up. `signal()` additionally
|
|
166
272
|
selects between **two pre-built `.set` closures at construction time**, so the eager
|
|
167
273
|
body carries no extra load or branch at all. **Zero behavioural or performance
|
|
@@ -178,7 +284,7 @@ a closure-captured `const` boolean lives in a context slot, not as a literal in
|
|
|
178
284
|
bytecode, when the body is shared. Splitting the closure at *build* time is what
|
|
179
285
|
recovered parity. Both dead ends are recorded here so nobody re-derives them.
|
|
180
286
|
|
|
181
|
-
This is NOT ledger
|
|
287
|
+
This is NOT ledger S0b #6 (per-call closure-var load of a primitive V8 can't fold).
|
|
182
288
|
The literals are declared `const` and never reassigned, and the hot body is selected
|
|
183
289
|
before the first write.
|
|
184
290
|
|
|
@@ -213,7 +319,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
|
|
|
213
319
|
rather than papered over with an ignore pragma (which would have broken the
|
|
214
320
|
sha256 hot-path proof above for no behavioural gain):
|
|
215
321
|
|
|
216
|
-
1-2. `freeLink`'s `link.source !== null ?
|
|
322
|
+
1-2. `freeLink`'s `link.source !== null ? ... : -1` and `link.target !== null ? ... : -1`
|
|
217
323
|
fallbacks. All three call sites pass a link taken from a live dep/sub list;
|
|
218
324
|
both endpoints are always non-null.
|
|
219
325
|
3. The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth
|
|
@@ -285,7 +391,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
|
|
|
285
391
|
|
|
286
392
|
Real wins, but smaller than the gap to Reflex on the same shapes. The residual
|
|
287
393
|
gap is structural (per-write `gen` check, batch-revert epoch tracking, global
|
|
288
|
-
version bumping) -- design decisions accepted by
|
|
394
|
+
version bumping) -- design decisions accepted by S0b and not in scope here.
|
|
289
395
|
Modern V8's `try/finally` elision varies; expect higher absolute speedups on
|
|
290
396
|
production V8 than on this sandbox.
|
|
291
397
|
|
|
@@ -311,7 +417,7 @@ have a declaration.
|
|
|
311
417
|
### Fixed -- documentation had `runWithOwner` marked "not yet shipped"
|
|
312
418
|
|
|
313
419
|
Both `README.md` and `llms.txt` still carried the 1.5.0-era sentence *"the re-attach
|
|
314
|
-
companion `runWithOwner`
|
|
420
|
+
companion `runWithOwner` ... is not yet shipped"* while the engine exported it. Corrected
|
|
315
421
|
in both, and `flushStrategy` / `flush()` -- previously mentioned nowhere outside the
|
|
316
422
|
harness notes -- now have a full API-reference section in the README and a Core-concepts
|
|
317
423
|
entry in `llms.txt`.
|
package/README.md
CHANGED
|
@@ -841,7 +841,7 @@ npm run bench
|
|
|
841
841
|
|
|
842
842
|
## Testing strategy
|
|
843
843
|
|
|
844
|
-
Four tiers, all reproducible. The full suite is **
|
|
844
|
+
Four tiers, all reproducible. The full suite is **498 tests across 30 files**: 497 pass, 1 skipped (the architecturally-N/A SSR case in `17-reactivity` -- lite has no DOM layer), 0 failing. Plain `npm test` runs **490** of them; **8 are gated on `--expose-gc`** (3 in `04-zero-gc`, 4 in `09-conformance`, 1 in `11-adopted-reactive`) and need `npm run test:gc` or `npm run test:coverage`. Engine coverage under `c8` is **100% statements / 100% functions / 100% lines / 100% branches**; the two residual branch arms are provably unreachable defensive code carrying `/* c8 ignore */`, itemised at the end of this section.
|
|
845
845
|
|
|
846
846
|
### Tier 1 -- Behavior (unit tests, fast)
|
|
847
847
|
|
|
@@ -875,13 +875,14 @@ Four tiers, all reproducible. The full suite is **485 tests across 29 files**: 4
|
|
|
875
875
|
- **`27-create-root.test.mjs`** (7) -- `createRoot` (1.5.0), the ownership escape hatch. A watcher spawned inside a consumer effect via `createRoot` survives the consumer's re-run (the exact `lite-query` lazy-watcher pattern); the contrast case confirms an *unwrapped* spawn is cascade-disposed; `createRoot` returns `fn`'s value, detaches tracking in `fn`'s direct body while inner effect bodies still track, and composes with box handles. Includes the top-level-export binding case.
|
|
876
876
|
- **`28-run-with-owner.test.mjs`** (16) -- `getOwner` / `runWithOwner` (1.7.0). 7 basic-shape tests (capture inside an effect and inside a computed, `undefined` outside any body, adoption, tracking-observer nulling, return-value pass-through, state restoration on return *and* on throw, nested restore). 3 degradation tests (`null` / `undefined` / a signal handle all fall through to rooted execution). 3 **hazard pins**, run with allocation pressure applied so the ABA guard is genuinely exercised: **recycled-slot cascade** (a stale handle must not adopt into the recycled slot's new resident), **corpse adoption** (adopting into a dead-but-unrecycled owner must not send the next disposal walk into unbounded recursion), and the two composed. Both hazards fail against a raw-pointer sketch and pass on the shipped gen-guarded implementation.
|
|
877
877
|
- **`29-scope.test.mjs`** (4) -- `createScope` (1.6.0), the adopting counterpart to `createRoot`. 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; and `totalAllocations - totalDisposals === activeNodes` holds across the entire lifecycle.
|
|
878
|
+
- **`30-throwing-equals.test.mjs`** (9) -- a user `equals` predicate that THROWS, pinned at all five engine sites it is called from: the three callable sites (signal `set` pre-check, batch-revert check, computed re-eval) and `signalBox` `boxSet`'s two (pre-check, revert). A pre-check throw propagates the ORIGINAL error unwrapped and leaves the handle unmutated with no downstream firing; a batch-revert throw is PINNED to the engine's actual behaviour (net value written, version left bumped, downstream fires -- not an atomic rollback the engine never provided), with a CONTRAST anti-tautology test proving a clean set-X-then-back suppresses the re-run so the throw is the demonstrated cause; a computed re-eval throw is cached as an error and re-thrown until a dep change re-evaluates cleanly. The box cases (`a-box`/`b-box`) confirm `boxSet` behaves identically to `read.set`.
|
|
878
879
|
|
|
879
880
|
> **Known housekeeping:** `28-run-with-owner` and `29-scope` share the numeric prefix `28`. Both files are live and both run; one of them should be renumbered to `29-` on the next touch.
|
|
880
881
|
|
|
881
882
|
```bash
|
|
882
|
-
npm test #
|
|
883
|
-
npm run test:gc # all
|
|
884
|
-
npm run test:coverage # all
|
|
883
|
+
npm test # 490 tests, 30 files, ~5s (8 gc-gated tests skipped)
|
|
884
|
+
npm run test:gc # all 498 (497 pass) -- adds --expose-gc
|
|
885
|
+
npm run test:coverage # all 498 under c8
|
|
885
886
|
```
|
|
886
887
|
|
|
887
888
|
**Coverage (`c8`, engine files only):**
|
|
@@ -896,7 +897,7 @@ The two uncovered branch arms in `Signal.js` are **unreachable by construction**
|
|
|
896
897
|
- 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
898
|
- The `if (batchEpoch === 0) batchEpoch = 1;` 32-bit-wraparound guard in `batch()` (1 arm). Reaching it requires 2^32 batches in one registry.
|
|
898
899
|
|
|
899
|
-
> Historical note: earlier releases listed a third item here -- `freeLink`'s `link.source !== null ?
|
|
900
|
+
> 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
901
|
|
|
901
902
|
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
903
|
|
|
@@ -925,12 +926,68 @@ npm run test:gc
|
|
|
925
926
|
npm run bench
|
|
926
927
|
```
|
|
927
928
|
|
|
928
|
-
### Tier 4 -- Torture
|
|
929
|
+
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
929
930
|
|
|
930
|
-
`bench/torture/`
|
|
931
|
+
`bench/torture/` holds the complete **22-scenario superset (19 semantic + 3
|
|
932
|
+
soak)** -- at full parity with the shipped 1.4.4 canonical suite -- behind one
|
|
933
|
+
runner (`run.mjs`), the forward-compatible set through 1.9.
|
|
934
|
+
They are not perf benchmarks: the ops/sec figures reflect random workload
|
|
935
|
+
composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
|
|
936
|
+
perf harness. Every scenario feature-detects and **skips cleanly** below the
|
|
937
|
+
engine version that introduces its feature, so on the 1.7.0 engine the runner
|
|
938
|
+
executes **20 of the 22** (17 semantic + 3 soak, including `flush-torture` and the
|
|
939
|
+
four lifecycle scenarios that run natively) and reports a clean SKIP for the two
|
|
940
|
+
later-version ones (`cleanup-return-torture` 1.8.0, `dispose-torture` 1.9.0).
|
|
931
941
|
|
|
932
|
-
|
|
933
|
-
|
|
942
|
+
```bash
|
|
943
|
+
npm run torture # everything
|
|
944
|
+
npm run torture:semantic # correctness only, CI-shaped
|
|
945
|
+
npm run torture:soak # resource soaks only
|
|
946
|
+
node bench/torture/run.mjs --list
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
950
|
+
|
|
951
|
+
Run these on every commit. The untagged scenarios run on any 1.4.x+ engine;
|
|
952
|
+
`box-torture` (1.5.0), `lifecycle-torture` (1.5.0), `scope-torture` (1.6.0),
|
|
953
|
+
`owner-torture` (1.6.0), and `flush-torture` (1.7.0) run here because their
|
|
954
|
+
features exist; the two tagged `1.8.0+`/`1.9.0+` feature-detect and SKIP on this
|
|
955
|
+
engine.
|
|
956
|
+
|
|
957
|
+
| scenario | pins |
|
|
958
|
+
| -------- | ---- |
|
|
959
|
+
| `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
|
|
960
|
+
| `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
|
|
961
|
+
| `work-accounting` | minimum body-execution counts across 10 fixed topologies |
|
|
962
|
+
| `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
|
|
963
|
+
| `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 |
|
|
964
|
+
| `concurrent-storm` | eight reentrancy and flush-ordering contracts |
|
|
965
|
+
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
966
|
+
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
967
|
+
| `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 |
|
|
968
|
+
| `owner-torture` (1.6.0) | `getOwner`/`runWithOwner` capture-restore: live-owner adoption cascade-disposes, a STALE handle degrades to ROOTED, dep-isolation holds, + a 300-seed capture/dispose/recycle/restore fuzz |
|
|
969
|
+
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
970
|
+
| `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary, and the `maxLinks * 16` grow ceiling terminating AT the wall |
|
|
971
|
+
| `error-torture` | throwing effect bodies under flush: a single throw re-thrown UNWRAPPED, 2+ into an `AggregateError` carrying EXACTLY those errors, a survivor still runs, buffer drains flat over 4096 throw/clean cycles |
|
|
972
|
+
| `deep-chain-torture` | `pullComputed` recursion fails CLOSED with a `RangeError` beyond the stack budget while the iterative push path stays open; the registry stays usable, the re-throw is deterministic |
|
|
973
|
+
| `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 |
|
|
974
|
+
| `zerogc-torture` | the zero-GC claim made falsifiable via `@zakkster/lite-gc-profiler`: `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + engine `stats()` deltas across steady + churn, `churn-box` active, `ZEROGC_BREAK=1` self-test |
|
|
975
|
+
| `lifecycle-torture` (1.5.0) | `createRoot` detachment (children survive, deps isolated) + `destroy` registry reset (stales every handle, returns `stats().activeNodes` to 0) |
|
|
976
|
+
| `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard -- SKIP on 1.7.0 |
|
|
977
|
+
| `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.7.0 |
|
|
978
|
+
|
|
979
|
+
#### `soak` -- wall-clock bound, asserts on **resources**
|
|
980
|
+
|
|
981
|
+
Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
|
|
982
|
+
and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
|
|
983
|
+
effect rewires, nested-batch + untrack reads, and microtask-scheduled async
|
|
984
|
+
flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
|
|
985
|
+
failure:
|
|
986
|
+
|
|
987
|
+
- zero thrown exceptions during the run,
|
|
988
|
+
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn),
|
|
989
|
+
- **value-correctness** via a once-allocated `Int32Array` shadow oracle -- a rotating fixed window checked per tick (zero per-tick allocation, a scalar cursor) plus a full sweep at teardown; a mismatch exits 1 with the seed and index, and
|
|
990
|
+
- the module-scoped int32 JIT sink advanced (an `if (ops > 0 && sink === 0)` teardown guard proves the work loops were not optimised away).
|
|
934
991
|
|
|
935
992
|
```bash
|
|
936
993
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
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
|
-
*
|
|
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,31 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
59
59
|
|
|
60
60
|
## Version notes
|
|
61
61
|
|
|
62
|
-
- **1.7.0-alpha** (current):
|
|
63
|
-
|
|
62
|
+
- **1.7.0-alpha.4** (current): **torture-suite + test parity with the shipped 1.4.4
|
|
63
|
+
canonical suite** -- verification-only, the `Signal.js`/`Signal.d.ts` engine is
|
|
64
|
+
UNCHANGED (shasum-identical). Five scenarios were ported to bring `bench/torture/`
|
|
65
|
+
from 17 to **22** (19 semantic + 3 soak): `lifecycle-torture`, `owner-torture`,
|
|
66
|
+
`error-torture`, `deep-chain-torture`, `zerogc-torture` -- all four lifecycle
|
|
67
|
+
scenarios (`createRoot`, `createScope`, `getOwner`/`runWithOwner`, `destroy`) and
|
|
68
|
+
the flush scenario RUN NATIVELY on this engine, no SKIP; each was VERIFIED and
|
|
69
|
+
pins 1.7.0's actual behaviour, no assertion softened. `capacity-torture` gained a
|
|
70
|
+
section 9 pinning the 16x link-grow ceiling; `introspect-torture`'s `forEachOwned`
|
|
71
|
+
was tightened to assert EXACTLY 2 owned children; the three soaks (`graph-fuzzer`,
|
|
72
|
+
`scheduler-bench`, `torture-soak`) gained a once-allocated `Int32Array` shadow
|
|
73
|
+
value-oracle (zero per-tick allocation, full sweep at teardown) plus the int32 JIT
|
|
74
|
+
sink guard. A new `test/30-throwing-equals.test.mjs` pins all five engine `equals`
|
|
75
|
+
sites (3 callable + signalBox boxSet's 2). `@zakkster/lite-gc-profiler` is a
|
|
76
|
+
dev-only dependency for `zerogc-torture`; `files[]` still excludes `bench/`.
|
|
77
|
+
Verified green: torture **22/22** (20 execute + 2 later-version skips);
|
|
78
|
+
unit **490 tests, 489 pass, 0 fail, 1 skip** (SSR N/A).
|
|
79
|
+
- **1.7.0-alpha.3**: the **flush-strategy minor**. Two engine additions and
|
|
80
|
+
one large tooling correction (all shipped in alpha.0, below); `alpha.3` rolls up
|
|
81
|
+
the dangling-cursor crash fix (a one-line `disposeNode` cursor repair; the
|
|
82
|
+
`freeLink` `-1` fallbacks it made dead were removed and branch coverage on
|
|
83
|
+
`Signal.js` closed to **100%**), `flush-torture` now executing on this engine,
|
|
84
|
+
and the removal of a byte-identical
|
|
85
|
+
duplicate `test/28-scope.test.mjs` (the scope suite had been running twice; the
|
|
86
|
+
correctly-numbered `29-scope.test.mjs` remains).
|
|
64
87
|
|
|
65
88
|
**1) `flushStrategy` + `r.flush()`** -- per-registry control over *when* effects
|
|
66
89
|
deliver (`"eager"` default | `"sab"` | `"manual"`), plus an explicit `flush()` on
|
|
@@ -771,7 +794,7 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
771
794
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
772
795
|
- `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
796
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
774
|
-
- `bench/torture/` -- crash-
|
|
797
|
+
- `bench/torture/` -- the complete **22-scenario superset (19 semantic + 3 soak)** at FULL PARITY with the shipped 1.4.4 canonical suite, 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. On the 1.7.0 engine **20 of the 22 execute** (17 semantic + 3 soak) and **2 skip cleanly** as later-version features. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **17 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, `forEachOwned` pinned to EXACTLY 2 owned children), `concurrent-storm` (8 reentrancy / flush-ordering contracts), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing-scheduler containment), `box-torture` (1.5.0: signalBox/computedBox interop -- the oracle differential fuzz with every node realised as callable OR box), `scope-torture` (1.6.0: `createScope` adoption + disposal-crash fuzz + `runWithOwner` re-attachment), `owner-torture` (1.6.0: `getOwner`/`runWithOwner` capture-restore -- live-owner adoption cascade-disposes, a STALE handle degrades to ROOTED, dep-isolation holds, plus a 300-seed capture/dispose/recycle/restore fuzz; native on 1.7.0), `async-torture` (watch / when / whenAsync contracts + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary + `CapacityError` + the 16x link-grow ceiling, growth terminating AT `maxLinks * 16` with a fail-closed re-throw), `error-torture` (throwing effect bodies under flush -- a single throw re-thrown UNWRAPPED, 2+ aggregated into an `AggregateError` carrying EXACTLY those errors, a survivor between two throwers still runs, and the error buffer drains flat over 4096 throw/clean cycles), `deep-chain-torture` (`pullComputed` recursion fails CLOSED with a RangeError beyond the stack budget while the iterative push path stays open; the registry that threw stays usable and the re-throw is deterministic), `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), `zerogc-torture` (the zero-GC claim made falsifiable via `@zakkster/lite-gc-profiler`: `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + engine `stats()` deltas across steady + create/dispose churn, with the `churn-box` signalBox path active on 1.7.0 and a `ZEROGC_BREAK=1` self-test that must fail the gate), `lifecycle-torture` (1.5.0 `createRoot` detachment -- detached children survive and stay reactive, deps isolated -- + 1.4.0 `destroy` registry reset that stales every handle and returns `stats().activeNodes` to 0; native on 1.7.0); 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 AND value-correctness via a once-allocated `Int32Array` shadow oracle -- a rotating fixed window per tick with zero per-tick allocation, a full sweep at teardown, mismatch -> exit 1 with seed+index; nightly): `graph-fuzzer`, `scheduler-bench`, `torture-soak` -- exit 0 iff zero errors AND post-teardown pool at or below its leaf-only floor AND every shadowed value matched AND the JIT sink advanced. Runner spawns each scenario as a child process (several assert on global pool accounting) and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
775
798
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
776
799
|
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
777
800
|
- `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
|
+
"version": "1.7.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",
|
|
@@ -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",
|