@zakkster/lite-signal 1.4.3 → 1.4.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 +135 -0
- package/README.md +22 -12
- package/Signal.d.ts +9 -0
- package/Signal.js +182 -9
- package/llms.txt +53 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,141 @@ 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
|
+
## [1.4.5] -- 2026-08-18
|
|
8
|
+
|
|
9
|
+
The createRegistry validation patch. Until now `createRegistry(config)` read five
|
|
10
|
+
options and validated none of them -- 20 of 25 malformed configs built without a
|
|
11
|
+
word and the rest failed later, deep in the node allocator, naming an internal
|
|
12
|
+
`nextFree` field rather than the option you got wrong. This closes the door. All
|
|
13
|
+
of it is constructor-cold: **the engine's hot path is byte-for-byte unchanged and
|
|
14
|
+
the zero-GC steady state does not move** (read/set/flush allocate 0 B/op as before).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`prealloc:"eager"` with an absurd capacity no longer kills the process.**
|
|
19
|
+
`{maxNodes: Infinity}` and `{maxNodes: 1e9}` (a plausible typo for `1e5`) used to
|
|
20
|
+
run an unbounded construction loop and SIGABRT the process with an uncatchable
|
|
21
|
+
"Ineffective mark-compacts near heap limit" -- not a throw, so `try/catch` could
|
|
22
|
+
not see it and a supervisor got a crashed worker instead of an error. Eager
|
|
23
|
+
construction now refuses by name above a `(maxNodes + maxLinks) > (1 << 24)`
|
|
24
|
+
ceiling, throwing a `TypeError` prefixed `createRegistry: "maxNodes"` (or
|
|
25
|
+
`"maxLinks"`) that suggests `prealloc:"lazy"` for an unbounded on-demand ledger.
|
|
26
|
+
- **Fractional and non-positive capacities are rejected at construction.**
|
|
27
|
+
`{maxNodes: -1}`, `0`, `null`, `NaN` used to build a registry that died on first
|
|
28
|
+
use with `TypeError: Cannot read properties of undefined (reading 'nextFree')`;
|
|
29
|
+
`{maxNodes: 1.5}` was accepted and surfaced later as a `CapacityError`. All now
|
|
30
|
+
throw `createRegistry: "maxNodes"` (finite integer >= 1) at the call that made
|
|
31
|
+
the mistake.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **Every option is validated by name.** `maxNodes` / `maxLinks` / `maxFlushPasses`
|
|
36
|
+
must be finite integers >= 1; `prealloc` exactly `"eager"` or `"lazy"`;
|
|
37
|
+
`onCapacityExceeded` exactly `"throw"` or `"grow"`; `config` itself a plain object
|
|
38
|
+
or `undefined` (`null`, `42`, `"eager"` are rejected). A bad value throws a
|
|
39
|
+
`TypeError` prefixed `createRegistry: "<option>"`.
|
|
40
|
+
- **Unknown keys throw with a did-you-mean hint.** `{maxNods: 32}` and
|
|
41
|
+
`{preAlloc: "lazy"}` used to build a default registry and run -- the misspelled
|
|
42
|
+
key silently ignored, so the capacity or the population strategy you asked for
|
|
43
|
+
never took effect. They now throw and suggest the intended key. If you had a typo,
|
|
44
|
+
you will now hear about it at construction instead of debugging it as production
|
|
45
|
+
jitter. A one-character `prealloc` typo in particular used to flip an eager pool
|
|
46
|
+
to lazy silently, selling back the zero-GC latency contract eager exists to buy.
|
|
47
|
+
- **`stats()` returns 13 keys** (was 11): adds `nodePoolPopulation` and
|
|
48
|
+
`linkPoolPopulation`, the PHYSICAL count of constructed pool objects, distinct
|
|
49
|
+
from the `*Capacity` ledgers. Under `"eager"` population equals capacity; under
|
|
50
|
+
`"lazy"` it starts at 0 and grows on demand. This is the instrument that lets a
|
|
51
|
+
caller confirm an eager pool actually preallocated -- previously `stats()`
|
|
52
|
+
reported only the ledger and was blind to a `prealloc` typo. No existing key
|
|
53
|
+
removed or changed; two free array-length reads, no allocation.
|
|
54
|
+
|
|
55
|
+
### Tests
|
|
56
|
+
|
|
57
|
+
- `test/28-config-validation.test.mjs` -- the full 25-config matrix: every
|
|
58
|
+
malformed row throws a `TypeError` naming the option (never reaching the internal
|
|
59
|
+
`nextFree` path), every accepted row is explicitly listed, plus the retained
|
|
60
|
+
heap-delta / population check that `"eager"` at `maxNodes:200000` retains >20 MB
|
|
61
|
+
with `nodePoolPopulation === 200000` and `"lazy"` retains ~0 with
|
|
62
|
+
`nodePoolPopulation === 0`.
|
|
63
|
+
- `test/28-config-oom.child.mjs` -- the three OOM rows (`maxNodes:Infinity`,
|
|
64
|
+
`maxNodes:1e9`, `maxLinks:Infinity`) run as isolated child processes under
|
|
65
|
+
`--max-old-space-size=256`, each asserting a caught named `TypeError` and a clean
|
|
66
|
+
exit (the fix must not SIGABRT).
|
|
67
|
+
|
|
68
|
+
## [1.4.4] -- 2026-08-03
|
|
69
|
+
|
|
70
|
+
The verification-surface patch, round four. **The engine is unchanged**: as in
|
|
71
|
+
1.4.1/1.4.2/1.4.3, the only edit to `Signal.js` is the version string in its header
|
|
72
|
+
banner, and `Signal.d.ts` is untouched. Everything here lives in `bench/torture/`
|
|
73
|
+
and `test/`, neither of which ships the engine -- `files[]` excludes `bench/`. If
|
|
74
|
+
you consume the package, 1.4.4 is byte-for-byte 1.4.3 plus a version number.
|
|
75
|
+
|
|
76
|
+
1.4.3 gated the zero-GC claim. This round closes the remaining gaps at the ERROR
|
|
77
|
+
edges -- the paths that only run when user code throws or a graph is pushed past a
|
|
78
|
+
structural limit -- and turns the three soaks from liveness-only into
|
|
79
|
+
value-correctness gates.
|
|
80
|
+
|
|
81
|
+
### Added -- two semantic scenarios (suite now 22)
|
|
82
|
+
|
|
83
|
+
- `bench/torture/error-torture.mjs` -- throwing effect BODIES under flush.
|
|
84
|
+
`flushEffects` buffers each per-effect throw into a pre-allocated buffer, keeps
|
|
85
|
+
the remaining queued effects running, and only then surfaces what it caught:
|
|
86
|
+
a single throw is re-thrown UNWRAPPED (the original error), two-or-more become a
|
|
87
|
+
single `AggregateError` carrying EXACTLY those errors in order. This is a stress
|
|
88
|
+
scenario, not a unit duplicate of `test/09-conformance`: it asserts what the unit
|
|
89
|
+
tests do not -- that survivors in the same pass still run, and that the buffer
|
|
90
|
+
returns to baseline under 4096 throw/clean cycles so nothing bleeds between
|
|
91
|
+
flushes (a clean flush after a throwing one throws nothing, `stats()` never
|
|
92
|
+
drifts).
|
|
93
|
+
- `bench/torture/deep-chain-torture.mjs` -- `pullComputed` recursion, fail-closed.
|
|
94
|
+
`pullComputed` is call-stack recursive, so a deep computed chain read fails
|
|
95
|
+
CLOSED with a `RangeError` beyond the host stack rather than corrupting anything.
|
|
96
|
+
Depth is RAMPED, never pinned (the exact throwing depth is host-dependent): it
|
|
97
|
+
asserts only that some depth <= 100k throws a `RangeError`, then that the registry
|
|
98
|
+
that threw is STILL usable (a fresh small graph builds and evaluates correctly,
|
|
99
|
+
effects included) and that the iterative PUSH path -- an equally deep effect
|
|
100
|
+
cascade, flush-pass budget raised to match -- propagates end to end without
|
|
101
|
+
throwing, contrasting the heap-iterative scheduler against the stack-recursive
|
|
102
|
+
pull.
|
|
103
|
+
|
|
104
|
+
### Added -- `test/27-throwing-equals.test.mjs`, a throwing user `equals`
|
|
105
|
+
|
|
106
|
+
`equals` is user code the engine calls on the hot write/recompute path and does
|
|
107
|
+
not sandbox. This file pins its behaviour at all three call sites: (a) the signal
|
|
108
|
+
`set` pre-check -- the original error propagates and the signal is left unmutated,
|
|
109
|
+
no downstream fires; (b) the batch revert check -- PINNED, not asserted-as-atomic:
|
|
110
|
+
the throw at that site happens after `node.value` was written but before the
|
|
111
|
+
version bump, so the net value is correct yet downstream FIRES (the throw stranded
|
|
112
|
+
the version bump, defeating the revert), documented exactly so a future move to an
|
|
113
|
+
atomic revert trips the pin; (c) computed re-eval -- caught, cached as
|
|
114
|
+
`FLAG_HAS_ERROR`, re-thrown on every read until a dep change re-evaluates cleanly
|
|
115
|
+
and clears it.
|
|
116
|
+
|
|
117
|
+
### Changed -- capacity ceiling + soak value oracles
|
|
118
|
+
|
|
119
|
+
- `bench/torture/capacity-torture.mjs` gains the 16x link grow ceiling: under
|
|
120
|
+
`grow`, link growth is capped at `maxLinks * 16` and throws `CapacityError`
|
|
121
|
+
with `kind: "links"` and `capacity` equal to the ceiling AT the ceiling --
|
|
122
|
+
growth terminates exactly at `16x` (`linkPoolCapacity === 128` for `maxLinks: 8`,
|
|
123
|
+
not one chunk over) -- and the overflowed computed still re-throws on read
|
|
124
|
+
rather than leaking a partial sum. Every pre-existing case is intact.
|
|
125
|
+
- `graph-fuzzer.mjs`, `torture-soak.mjs`, `scheduler-bench.mjs` each gain a
|
|
126
|
+
value-correctness ORACLE. Each shadows its signals in a single `Int32Array`
|
|
127
|
+
allocated ONCE outside the churn loop, updated in lockstep with every write, and
|
|
128
|
+
asserts the engine's value equals the model on a rotating window each tick plus a
|
|
129
|
+
full sweep at teardown -- zero per-tick allocation, so the implicit pool-to-floor
|
|
130
|
+
gate is not regressed. All prior liveness assertions (0 errors, pool-to-floor,
|
|
131
|
+
JIT sink advanced) are preserved; the soaks now assert value-correctness, not
|
|
132
|
+
just liveness. Mutation-verified: corrupting one shadow write makes the soak exit
|
|
133
|
+
non-zero.
|
|
134
|
+
|
|
135
|
+
### Verified -- full suite green on the 1.4.4 engine (Node 22, `--expose-gc`)
|
|
136
|
+
|
|
137
|
+
- **Torture:** 22/22 -- `error-torture` and `deep-chain-torture` PASS; the three
|
|
138
|
+
soaks report `value mismatches: 0`.
|
|
139
|
+
- The engine is byte-for-byte 1.4.3; the unit suite grows only by `test/27`
|
|
140
|
+
(7 new tests) and no prior test regressed.
|
|
141
|
+
|
|
7
142
|
## [1.4.3] -- 2026-08-02
|
|
8
143
|
|
|
9
144
|
The verification-surface patch, round three. **The engine is unchanged**: as in
|
package/README.md
CHANGED
|
@@ -761,13 +761,13 @@ npm run bench
|
|
|
761
761
|
|
|
762
762
|
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
763
763
|
|
|
764
|
-
`bench/torture/` holds **
|
|
764
|
+
`bench/torture/` holds **22 scenarios (19 semantic + 3 soak)** in two groups,
|
|
765
765
|
behind one runner. They are not perf benchmarks: the ops/sec figures reflect
|
|
766
766
|
random workload composition, not engine throughput -- `bench/benchmark.mjs`
|
|
767
767
|
remains the canonical perf harness. Every scenario feature-detects and **skips
|
|
768
768
|
cleanly** below the engine version that introduces its feature (`SKIP: <feature>
|
|
769
769
|
requires <version>+`, exit 0), so the whole directory rides this 1.4.x base
|
|
770
|
-
forward through 1.9. On the 1.4.x engine, **
|
|
770
|
+
forward through 1.9. On the 1.4.x engine, **13 semantic scenarios execute and 6
|
|
771
771
|
self-skip**.
|
|
772
772
|
|
|
773
773
|
```bash
|
|
@@ -804,7 +804,9 @@ Run these on every commit. They pin values, wakeups, work and ordering.
|
|
|
804
804
|
| `introspect-torture` | the read-only introspection surface (`describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers`): walk agreement vs the real edge set incl. dynamic rewiring, `hasObservers` transitions, and the ABA gen-stamp guard (a stale descriptor resolves to nothing, never a recycled resident) |
|
|
805
805
|
| `lifecycle-torture` | `destroy` (1.4.0+) registry reset: handles staled via gen-bump, stale writes no-op, pool reusable, idempotent. Its `createRoot` half is 1.5.0+ and self-skips on this base |
|
|
806
806
|
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
807
|
-
| `capacity-torture` | the fail-closed pool boundary: exact node/link ceilings, `CapacityError`, `grow` mode crossing the boundary, no partial value escapes |
|
|
807
|
+
| `capacity-torture` | the fail-closed pool boundary: exact node/link ceilings, `CapacityError`, `grow` mode crossing the boundary AND its 16x link ceiling (`grow` throws at `maxLinks*16`, growth terminating exactly at the ceiling), no partial value escapes |
|
|
808
|
+
| `error-torture` | throwing effect BODIES under flush: a single throw re-thrown unwrapped, two-or-more into an `AggregateError` carrying exactly those errors, survivors in the same pass still run, and the error buffer drains to baseline over 4096 throw/clean cycles |
|
|
809
|
+
| `deep-chain-torture` | `pullComputed` recursion fails CLOSED with a `RangeError` at ramped depth (never pinned); the registry that threw stays usable, and the iterative effect-cascade PUSH path over an equally deep chain does not throw |
|
|
808
810
|
| `zerogc-torture` | the zero-GC claim, gated by `@zakkster/lite-gc-profiler`: per-call **retained bytes** (`measureAllocs` at `maxBytesPerCall: 0`), **major-GC count + longest pause** (`measureOps`/`checkNoGc`, `stabilize: 'deep'`), and the engine's own `stats()` counters (`poolGrowths`/`totalAllocations` steady, `activeNodes` restored under churn) across five graph shapes. `ZEROGC_BREAK=1` plants a leak the gate must reject; `churn-box` self-skips below 1.5.0 |
|
|
809
811
|
| `box-torture` (1.5.0+) | `signalBox`/`computedBox` interop + surface -- SKIP on 1.4.x |
|
|
810
812
|
| `scope-torture` (1.6.0+) | `createScope` adoption + the disposal-crash fuzz -- SKIP on 1.4.x |
|
|
@@ -813,12 +815,15 @@ Run these on every commit. They pin values, wakeups, work and ordering.
|
|
|
813
815
|
| `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard, computed exclusion -- SKIP on 1.4.x |
|
|
814
816
|
| `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects (five stamp sites) -- SKIP on 1.4.x |
|
|
815
817
|
|
|
816
|
-
Why this group exists: the resource soaks below
|
|
817
|
-
computeds return stale values. Flipping the clean short-circuit in
|
|
818
|
-
from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws
|
|
819
|
-
`oracle-fuzzer` catches it on 400/400 seeds, and
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
Why this group exists: the resource soaks below once passed green on an engine
|
|
819
|
+
whose computeds return stale values. Flipping the clean short-circuit in
|
|
820
|
+
`pullComputed` from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws
|
|
821
|
+
nothing -- `oracle-fuzzer` catches it on 400/400 seeds, and the soaks' *liveness*
|
|
822
|
+
assertions all still reported PASS. As of 1.4.4 each soak also carries a
|
|
823
|
+
value-correctness oracle (below), so a stale-value engine is now caught in the
|
|
824
|
+
soak group too. Separately, removing the `node.gen === gen` guard from the cached
|
|
825
|
+
scheduler thunk is caught by `scheduler-storm` and **missed by all 405 unit
|
|
826
|
+
tests**.
|
|
822
827
|
|
|
823
828
|
Where no contract is documented, these files pin the *observed* behaviour and say
|
|
824
829
|
so at the scenario, rather than asserting an invented one.
|
|
@@ -832,8 +837,13 @@ exits non-zero unless:
|
|
|
832
837
|
|
|
833
838
|
- zero exceptions were thrown during the run,
|
|
834
839
|
- after teardown `activeNodes` is at or below its leaf-only floor and
|
|
835
|
-
`activeLinks` is exactly `0`,
|
|
836
|
-
- the JIT sink advanced -- proving the accumulator loops were not optimised away
|
|
840
|
+
`activeLinks` is exactly `0`,
|
|
841
|
+
- the JIT sink advanced -- proving the accumulator loops were not optimised away, and
|
|
842
|
+
- (1.4.4+) the value oracle agrees: a once-allocated `Int32Array` shadow model,
|
|
843
|
+
updated in lockstep with every write and sampled on a rotating window each tick
|
|
844
|
+
plus a full sweep at teardown, matches every signal's value. It adds no per-tick
|
|
845
|
+
allocation, so the implicit pool-to-floor gate is untouched. The soaks now assert
|
|
846
|
+
value-correctness, not just liveness.
|
|
837
847
|
|
|
838
848
|
```bash
|
|
839
849
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
|
@@ -1252,7 +1262,7 @@ npm test # behavior suite, ~1.3s
|
|
|
1252
1262
|
npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
|
|
1253
1263
|
npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
|
|
1254
1264
|
npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
|
|
1255
|
-
npm run torture # full torture suite, all
|
|
1265
|
+
npm run torture # full torture suite, all 22 scenarios
|
|
1256
1266
|
npm run torture:semantic # correctness scenarios only, ~10s
|
|
1257
1267
|
npm run torture:soak # resource soaks only, wall-clock bound
|
|
1258
1268
|
npm run verify # test + sanity bench; run before publishing
|
package/Signal.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export interface RegistryStats {
|
|
|
90
90
|
/** Node-pool capacity ledger. Doubles under the `"grow"` policy; under `"lazy"`
|
|
91
91
|
* prealloc it may exceed the count of physically constructed nodes. */
|
|
92
92
|
nodePoolCapacity: number;
|
|
93
|
+
/** Physical count of node objects actually constructed in this registry (1.4.5).
|
|
94
|
+
* Under `"eager"` this equals `nodePoolCapacity`; under `"lazy"` it starts at 0
|
|
95
|
+
* and grows on demand. Distinguishes a real eager pool from a `prealloc` typo
|
|
96
|
+
* that silently fell through to lazy. */
|
|
97
|
+
nodePoolPopulation: number;
|
|
98
|
+
/** Physical count of link objects actually constructed in this registry (1.4.5).
|
|
99
|
+
* Under `"eager"` this equals `linkPoolCapacity`; under `"lazy"` it starts at 0
|
|
100
|
+
* and grows on demand. */
|
|
101
|
+
linkPoolPopulation: number;
|
|
93
102
|
/** Number of nodes currently allocated (signals + computeds + alive effects). */
|
|
94
103
|
activeNodes: number;
|
|
95
104
|
/**
|
package/Signal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zakkster/lite-signal v1.4.
|
|
2
|
+
* @zakkster/lite-signal v1.4.5
|
|
3
3
|
* --------------------
|
|
4
4
|
* Hybrid Doubly-Linked-List Reactive Graph Engine -- decoupled (Signal1_3) base
|
|
5
5
|
* with the two 1.1.3 performance fixes ported in:
|
|
@@ -173,6 +173,88 @@ export class CapacityError extends Error {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/** The only config keys {@link createRegistry} recognizes. Anything else is
|
|
177
|
+
* rejected at construction with a did-you-mean hint (fail closed on an
|
|
178
|
+
* unverified state -- an unknown key is an error, never a silent ignore). */
|
|
179
|
+
const ALLOWED_KEYS = ["maxNodes", "maxLinks", "prealloc", "onCapacityExceeded", "maxFlushPasses"];
|
|
180
|
+
|
|
181
|
+
/** Ceiling on eager pool construction: `(maxNodes + maxLinks)` objects. A finite
|
|
182
|
+
* but absurd `maxNodes` (e.g. `1e9`, a plausible typo for `1e5`) that would
|
|
183
|
+
* otherwise OOM the process is refused BY NAME at construction rather than
|
|
184
|
+
* allocating forever. Only the `"eager"` path is bounded; `"lazy"` keeps its
|
|
185
|
+
* unbounded ledger. `1 << 24` == 16777216. */
|
|
186
|
+
const EAGER_CONSTRUCT_CEILING = 1 << 24;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Levenshtein edit distance between two short strings. Cold: called only on the
|
|
190
|
+
* constructor error path, over the five known option names, so its per-call
|
|
191
|
+
* array allocation never touches any hot path.
|
|
192
|
+
* @param {string} a
|
|
193
|
+
* @param {string} b
|
|
194
|
+
* @returns {number}
|
|
195
|
+
*/
|
|
196
|
+
function editDistance(a, b) {
|
|
197
|
+
const m = a.length;
|
|
198
|
+
const n = b.length;
|
|
199
|
+
const prev = new Array(n + 1);
|
|
200
|
+
const cur = new Array(n + 1);
|
|
201
|
+
for (let j = 0; j <= n; j++) prev[j] = j;
|
|
202
|
+
for (let i = 1; i <= m; i++) {
|
|
203
|
+
cur[0] = i;
|
|
204
|
+
for (let j = 1; j <= n; j++) {
|
|
205
|
+
const cost = a.charCodeAt(i - 1) === b.charCodeAt(j - 1) ? 0 : 1;
|
|
206
|
+
let min = prev[j] + 1;
|
|
207
|
+
if (cur[j - 1] + 1 < min) min = cur[j - 1] + 1;
|
|
208
|
+
if (prev[j - 1] + cost < min) min = prev[j - 1] + cost;
|
|
209
|
+
cur[j] = min;
|
|
210
|
+
}
|
|
211
|
+
for (let j = 0; j <= n; j++) prev[j] = cur[j];
|
|
212
|
+
}
|
|
213
|
+
return prev[n];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The closest known config key to `key` within edit distance 2 (case-folded so
|
|
218
|
+
* `preAlloc`/`MAXNODES` resolve), or null when nothing is close. Cold path only.
|
|
219
|
+
* @param {string} key
|
|
220
|
+
* @returns {string|null}
|
|
221
|
+
*/
|
|
222
|
+
function suggestKey(key) {
|
|
223
|
+
const lk = key.toLowerCase();
|
|
224
|
+
let best = null;
|
|
225
|
+
let bestD = 3;
|
|
226
|
+
for (let i = 0; i < ALLOWED_KEYS.length; i++) {
|
|
227
|
+
const d = editDistance(lk, ALLOWED_KEYS[i].toLowerCase());
|
|
228
|
+
if (d < bestD) { bestD = d; best = ALLOWED_KEYS[i]; }
|
|
229
|
+
}
|
|
230
|
+
return bestD <= 2 ? best : null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Render a rejected value for an error message, e.g. `42 (number)`.
|
|
235
|
+
* Cold: this runs only on a throw path, never on any hot path. `String(symbol)`
|
|
236
|
+
* throws, so symbols are stringified defensively.
|
|
237
|
+
* @param {*} v
|
|
238
|
+
* @returns {string}
|
|
239
|
+
*/
|
|
240
|
+
function received(v) {
|
|
241
|
+
return (typeof v === "symbol" ? v.toString() : String(v)) + " (" + typeof v + ")";
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Validate that a numeric option is a finite integer >= 1. Cold: constructor
|
|
246
|
+
* error path only. Throws a {@link TypeError} prefixed `createRegistry: "<name>"`.
|
|
247
|
+
* @param {*} v
|
|
248
|
+
* @param {string} name
|
|
249
|
+
*/
|
|
250
|
+
function requirePositiveInt(v, name) {
|
|
251
|
+
if (!Number.isInteger(v) || v < 1) {
|
|
252
|
+
throw new TypeError(
|
|
253
|
+
'createRegistry: "' + name + '" must be a finite integer >= 1, received ' + received(v) + '.'
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
176
258
|
/**
|
|
177
259
|
* Create an isolated reactive registry.
|
|
178
260
|
*
|
|
@@ -211,18 +293,96 @@ export function createRegistry(config) {
|
|
|
211
293
|
const NODE_PTR = Symbol("node_ptr");
|
|
212
294
|
const NODE_GEN = Symbol("node_gen");
|
|
213
295
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
296
|
+
// Config-shape gate (cold). Accept `undefined` or a non-null, non-array
|
|
297
|
+
// object; reject `null`, `42`, `"eager"`, arrays and every other non-object
|
|
298
|
+
// BY NAME rather than dying later on `config.maxNodes` / an internal
|
|
299
|
+
// `nextFree` read.
|
|
300
|
+
if (config !== undefined && (config === null || typeof config !== "object" || Array.isArray(config))) {
|
|
301
|
+
throw new TypeError(
|
|
302
|
+
'createRegistry: "config" must be a plain object or undefined, received ' + received(config) + '.'
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Per-option validation (cold). Each option is validated BY NAME so a bad
|
|
307
|
+
// value throws `createRegistry: "<option>"` at construction, not a delayed
|
|
308
|
+
// internal TypeError on first use. All of this is constructor-cold: zero
|
|
309
|
+
// hot-path bytes.
|
|
310
|
+
let currentNodesCapacity = 1024;
|
|
311
|
+
let currentLinkCapacity;
|
|
312
|
+
let policy = "throw";
|
|
313
|
+
let maxFlushPasses = 100;
|
|
314
|
+
let prealloc = "eager";
|
|
315
|
+
if (config !== undefined) {
|
|
316
|
+
if (config.maxNodes !== undefined) {
|
|
317
|
+
requirePositiveInt(config.maxNodes, "maxNodes");
|
|
318
|
+
currentNodesCapacity = config.maxNodes;
|
|
319
|
+
}
|
|
320
|
+
currentLinkCapacity = currentNodesCapacity * 4;
|
|
321
|
+
if (config.maxLinks !== undefined) {
|
|
322
|
+
requirePositiveInt(config.maxLinks, "maxLinks");
|
|
323
|
+
currentLinkCapacity = config.maxLinks;
|
|
324
|
+
}
|
|
325
|
+
if (config.maxFlushPasses !== undefined) {
|
|
326
|
+
requirePositiveInt(config.maxFlushPasses, "maxFlushPasses");
|
|
327
|
+
maxFlushPasses = config.maxFlushPasses;
|
|
328
|
+
}
|
|
329
|
+
if (config.prealloc !== undefined) {
|
|
330
|
+
if (config.prealloc !== "eager" && config.prealloc !== "lazy") {
|
|
331
|
+
throw new TypeError(
|
|
332
|
+
'createRegistry: "prealloc" must be "eager" or "lazy", received ' + received(config.prealloc) + '.'
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
prealloc = config.prealloc;
|
|
336
|
+
}
|
|
337
|
+
if (config.onCapacityExceeded !== undefined) {
|
|
338
|
+
if (config.onCapacityExceeded !== "throw" && config.onCapacityExceeded !== "grow") {
|
|
339
|
+
throw new TypeError(
|
|
340
|
+
'createRegistry: "onCapacityExceeded" must be "throw" or "grow", received ' + received(config.onCapacityExceeded) + '.'
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
policy = config.onCapacityExceeded;
|
|
344
|
+
}
|
|
345
|
+
// Unknown-key rejection with a did-you-mean hint (`preAlloc` -> `prealloc`,
|
|
346
|
+
// `maxNods` -> `maxNodes`). Own enumerable keys only; cold path.
|
|
347
|
+
const keys = Object.keys(config);
|
|
348
|
+
for (let i = 0; i < keys.length; i++) {
|
|
349
|
+
const k = keys[i];
|
|
350
|
+
if (ALLOWED_KEYS.indexOf(k) === -1) {
|
|
351
|
+
const hint = suggestKey(k);
|
|
352
|
+
throw new TypeError(
|
|
353
|
+
'createRegistry: "' + k + '" is not a recognized option' +
|
|
354
|
+
(hint !== null ? ' (did you mean "' + hint + '"?)' : '') +
|
|
355
|
+
'. Allowed: ' + ALLOWED_KEYS.join(", ") + '.'
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
currentLinkCapacity = currentNodesCapacity * 4;
|
|
361
|
+
}
|
|
218
362
|
const maxLinkLimit = currentLinkCapacity * 16;
|
|
219
363
|
|
|
364
|
+
// Eager-construction ceiling (cold). `"eager"` builds `(maxNodes + maxLinks)`
|
|
365
|
+
// objects up front; a finite-but-absurd capacity (e.g. `1e9`) would OOM the
|
|
366
|
+
// process with an uncatchable SIGABRT, not a throw. Refuse BY NAME before
|
|
367
|
+
// allocating. Named for the larger driver so the message satisfies the
|
|
368
|
+
// per-option regex. `"lazy"` keeps its unbounded ledger (untouched).
|
|
369
|
+
if (prealloc === "eager" && (currentNodesCapacity + currentLinkCapacity) > EAGER_CONSTRUCT_CEILING) {
|
|
370
|
+
const driver = currentLinkCapacity > currentNodesCapacity ? "maxLinks" : "maxNodes";
|
|
371
|
+
throw new TypeError(
|
|
372
|
+
'createRegistry: "' + driver + '" eager construction of ' +
|
|
373
|
+
(currentNodesCapacity + currentLinkCapacity) + ' objects (maxNodes ' +
|
|
374
|
+
currentNodesCapacity + ' + maxLinks ' + currentLinkCapacity + ') exceeds the ceiling of ' +
|
|
375
|
+
EAGER_CONSTRUCT_CEILING + '. Use prealloc:"lazy" for an unbounded on-demand ledger, ' +
|
|
376
|
+
'or lower the capacity.'
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
220
380
|
// Lazy pool population (P1): maxNodes / maxLinks are capacity ledgers,
|
|
221
381
|
// not eager construction counts. Nodes/links are constructed on first
|
|
222
382
|
// demand and recycled through the free lists thereafter -- the zero-GC
|
|
223
383
|
// steady state is identical after warm-up, but the heap no longer carries
|
|
224
384
|
// never-used live objects for every major GC to mark.
|
|
225
|
-
|
|
385
|
+
// `prealloc` was validated and resolved above (config-cold).
|
|
226
386
|
const nodePool = [];
|
|
227
387
|
let freeNodeHead = null;
|
|
228
388
|
const linkPool = [];
|
|
@@ -1331,10 +1491,14 @@ export function createRegistry(config) {
|
|
|
1331
1491
|
* Snapshot of registry counters. Useful for diagnostics and tests --
|
|
1332
1492
|
* e.g. asserting that `activeNodes` returns to a baseline after teardown.
|
|
1333
1493
|
*
|
|
1334
|
-
* Returns
|
|
1494
|
+
* Returns 13 keys: ten live gauges (`signals`, `computeds`, `effects`,
|
|
1335
1495
|
* `activeNodes`, `activeLinks`, `pooledLinks`, `nodePoolCapacity`,
|
|
1336
|
-
* `linkPoolCapacity
|
|
1337
|
-
*
|
|
1496
|
+
* `linkPoolCapacity`, plus `nodePoolPopulation` / `linkPoolPopulation` added
|
|
1497
|
+
* in 1.4.5 -- the PHYSICAL count of constructed pool objects, which under
|
|
1498
|
+
* `"eager"` equals capacity and under `"lazy"` starts at 0 and grows on
|
|
1499
|
+
* demand, so a caller can tell a real eager pool from a `prealloc` typo that
|
|
1500
|
+
* silently fell through to lazy) plus three cumulative lifecycle counters
|
|
1501
|
+
* added in 1.4.0 (`totalAllocations`, `totalDisposals`, `poolGrowths`). The counters are
|
|
1338
1502
|
* monotonic over the registry's life and reset only by {@link destroy}; sample
|
|
1339
1503
|
* them over time to derive allocation rate, pool-reuse ratio, and graph churn
|
|
1340
1504
|
* without the engine computing rates itself. In a quiescent registry
|
|
@@ -1350,6 +1514,15 @@ export function createRegistry(config) {
|
|
|
1350
1514
|
pooledLinks: currentLinkCapacity - activeLinks,
|
|
1351
1515
|
linkPoolCapacity: currentLinkCapacity,
|
|
1352
1516
|
nodePoolCapacity: currentNodesCapacity,
|
|
1517
|
+
// 1.4.5: PHYSICAL population (constructed objects), distinct from the
|
|
1518
|
+
// capacity ledger above. `nodePool.length` / `linkPool.length` are the
|
|
1519
|
+
// exact count ever constructed in this registry: eager fills the pool to
|
|
1520
|
+
// capacity at construction (population === capacity), lazy starts at 0 and
|
|
1521
|
+
// grows on demand. This is the instrument that distinguishes a real eager
|
|
1522
|
+
// pool from a `prealloc` typo silently falling through to lazy. Two free
|
|
1523
|
+
// array-length reads, no allocation.
|
|
1524
|
+
nodePoolPopulation: nodePool.length,
|
|
1525
|
+
linkPoolPopulation: linkPool.length,
|
|
1353
1526
|
activeNodes,
|
|
1354
1527
|
// 1.4: cumulative lifecycle counters (monotonic; reset by destroy()).
|
|
1355
1528
|
// Derive: allocationRate = deltatotalAllocations/deltat; poolReuseRate =
|
package/llms.txt
CHANGED
|
@@ -22,7 +22,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
22
22
|
- **isTracking**: `isTracking()` returns true iff a read right now would record a dependency on this registry (for wrappers that lazily allocate signals).
|
|
23
23
|
- **onCleanup**: registers teardown for the current computation; fires before each re-run and once on dispose. Works in effects and computeds.
|
|
24
24
|
- **Observer-lifecycle introspection** (1.1.4; top-level + per-registry): `hasObservers(handle)` returns true iff a signal/computed has >=1 live observer right now (O(1); a `peek` does not count). `observeObservers(handle, { onConnect?, onDisconnect? })` fires on the 0->1 and 1->0 observer transitions (after registration; transition-only) and returns an idempotent unobserve -- the auto-pause hook for tickers (lite-time/lite-raf start a source only while it's watched). `forEachObserver(handle, fn)` / `forEachSource(handle, fn)` walk the live graph in either direction, passing a `{ kind, value }` descriptor (`kind` is `"signal" | "computed" | "effect"`) -- for inspection (lite-devtools). The surface is gated by an internal counter: zero steady-state cost when nothing is observed. `hasObservers`/`forEach*` no-op on a non-handle; `observeObservers` throws `TypeError`. **Node identity (1.1.5):** `nodeId(handle)` returns the node's stable per-allocation id, `describe(handle)` returns the handle's own `{ id, kind, value }` descriptor, and `forEach*` descriptors now carry `id` too; a descriptor is **re-walkable** (pass it back into `forEachObserver`/`forEachSource`) -- the recursion primitive lite-devtools uses to walk the full DAG. **Owner-tree introspection (1.2.1):** `forEachOwned(handle, fn)` walks a node's owned children (lifetime-binding edges from the 1.2 owner tree -- invisible through dep/sub); `ownerOf(handle)` returns the owner's descriptor or `undefined` for top-level / stale handles. **Stale-handle guard (1.2.1):** the entire introspection surface plus `peek()`/`read()`/`set()` is now generation-checked. A handle held across the 1.2 owner-cascade auto-dispose used to resolve `NODE_PTR` ungated and silently report the recycled slot's NEW resident; 1.2.1 surfaces stale handles as `undefined` (or `TypeError`, for `observeObservers`) -- same ABA discipline `dispose()` always had. Descriptors are gen-stamped so the re-walkable contract survives the guard. **Push-based mutation hook (1.2.1):** `onGraphMutation(fn)` registers a single nullable listener invoked synchronously at every mutation point with three integers `(opcode, intA, intB)` -- opcodes `1` node-create / `2` node-dispose / `3` link-add / `4` link-remove / `5` recompute. Zero-cost gate when no listener is registered (one branch-predicted null check); allocation-free dispatch when registered. The connection point for push-based devtools/studio. Contract: observe only -- never throw, never mutate.
|
|
25
|
-
- **Registry**: `createRegistry({ maxNodes, maxLinks, prealloc, onCapacityExceeded, maxFlushPasses })` creates an isolated reactive world with its own pools. Useful for tests, plugins, multi-tenant sandboxes. Top-level helpers use a default registry created at module load. `prealloc` (1.3.0; `"eager"` default | `"lazy"`) chooses up-front vs on-demand pool construction; `onCapacityExceeded` (`"throw"` default | `"grow"`) chooses fail-fast vs chunked-incremental growth bounded by the 16x link ceiling.
|
|
25
|
+
- **Registry**: `createRegistry({ maxNodes, maxLinks, prealloc, onCapacityExceeded, maxFlushPasses })` creates an isolated reactive world with its own pools. Useful for tests, plugins, multi-tenant sandboxes. Top-level helpers use a default registry created at module load. `prealloc` (1.3.0; `"eager"` default | `"lazy"`) chooses up-front vs on-demand pool construction; `onCapacityExceeded` (`"throw"` default | `"grow"`) chooses fail-fast vs chunked-incremental growth bounded by the 16x link ceiling. **Config is validated (1.4.5):** `maxNodes`/`maxLinks`/`maxFlushPasses` must be finite integers >= 1, `prealloc` exactly `"eager"`/`"lazy"`, `onCapacityExceeded` exactly `"throw"`/`"grow"`, `config` itself an object or undefined; a bad value throws a `TypeError` prefixed `createRegistry: "<option>"`, an unknown key throws with a did-you-mean hint, and `prealloc:"eager"` above a `1<<24`-object ceiling throws by name rather than OOM-killing the process.
|
|
26
26
|
- **CapacityError**: thrown when a fixed-size pool is exhausted under the `"throw"` policy, or when a `"grow"` policy hits the 16× starting-capacity ceiling on links.
|
|
27
27
|
|
|
28
28
|
## Architecture invariants
|
|
@@ -50,7 +50,54 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
50
50
|
|
|
51
51
|
## Version notes
|
|
52
52
|
|
|
53
|
-
- **1.4.
|
|
53
|
+
- **1.4.5** (current): the **createRegistry validation patch**. `createRegistry`
|
|
54
|
+
read five options and validated none of them: 20 of 25 malformed configs built
|
|
55
|
+
without complaint and the rest failed later, deep in the allocator. This closes
|
|
56
|
+
the door. `maxNodes`/`maxLinks`/`maxFlushPasses` must be finite integers >= 1;
|
|
57
|
+
`prealloc` exactly `"eager"`/`"lazy"`; `onCapacityExceeded` exactly
|
|
58
|
+
`"throw"`/`"grow"`; `config` itself an object or `undefined`. A bad value throws
|
|
59
|
+
a `TypeError` prefixed `createRegistry: "<option>"`, and an unknown key throws
|
|
60
|
+
with a did-you-mean hint (`preAlloc` -> `prealloc`, `maxNods` -> `maxNodes`)
|
|
61
|
+
instead of being silently ignored. Two severe fixes: `prealloc:"eager"` with a
|
|
62
|
+
finite-but-absurd capacity (`maxNodes:1e9`, `Infinity`) used to allocate forever
|
|
63
|
+
and SIGABRT the process uncatchably -- it now throws by name above a
|
|
64
|
+
`(maxNodes+maxLinks) > (1<<24)` ceiling before constructing anything (suggesting
|
|
65
|
+
`prealloc:"lazy"`); and a one-character `prealloc` typo used to silently flip an
|
|
66
|
+
eager pool to lazy, selling back the zero-GC real-time contract with `stats()`
|
|
67
|
+
blind to it. `stats()` now returns **13 keys** -- adds `nodePoolPopulation` /
|
|
68
|
+
`linkPoolPopulation` (physical constructed-object counts, eager == capacity,
|
|
69
|
+
lazy grows from 0), the instrument a caller reaches for to confirm the flip did
|
|
70
|
+
not happen. If you had a typo you will now hear about it at construction. **All
|
|
71
|
+
validation is constructor-cold: zero hot-path bytes, the zero-GC steady state is
|
|
72
|
+
byte-for-byte unchanged.** Tests: adds `test/28-config-validation.test.mjs` (the
|
|
73
|
+
full 25-config matrix) and `test/28-config-oom.child.mjs` (the OOM rows as
|
|
74
|
+
isolated child processes under `--max-old-space-size=256`, asserting a caught
|
|
75
|
+
named `TypeError` and a clean exit).
|
|
76
|
+
- **1.4.4**: the **verification-surface patch, round four**. No engine
|
|
77
|
+
change -- as in 1.4.1/1.4.2/1.4.3, the only edit to `Signal.js` is the banner
|
|
78
|
+
version string, `Signal.d.ts` is untouched, and `bench/torture/` stays out of
|
|
79
|
+
`files[]`; for consumers 1.4.4 is byte-for-byte 1.4.3 plus a version number. It
|
|
80
|
+
adds **two** semantic torture scenarios -- `error-torture.mjs` (throwing effect
|
|
81
|
+
BODIES under flush: `flushEffects` buffers each per-effect throw, re-throws a
|
|
82
|
+
single one unwrapped, aggregates two-or-more into an `AggregateError` carrying
|
|
83
|
+
exactly those errors, keeps surviving effects running, and drains the buffer to
|
|
84
|
+
a clean baseline over many cycles) and `deep-chain-torture.mjs` (`pullComputed`
|
|
85
|
+
is call-stack recursive, so a deep computed chain fails CLOSED with a RangeError
|
|
86
|
+
beyond the host stack, ramped never pinned; the registry stays usable afterwards
|
|
87
|
+
and the iterative PUSH path -- an equally deep effect cascade -- does not throw)
|
|
88
|
+
-- taking the suite to **22 scenarios (19 semantic + 3 soak); 13 execute on the
|
|
89
|
+
1.4.x engine**. It also extends `capacity-torture` with the 16x link grow ceiling
|
|
90
|
+
(`grow` throws `CapacityError("links", maxLinks*16)` AT the ceiling, terminating
|
|
91
|
+
the pool exactly at 16x, read edge still fail-closed) and adds a value-correctness
|
|
92
|
+
ORACLE to all three soaks: each now shadows its signals in a once-allocated
|
|
93
|
+
`Int32Array` and asserts the engine's values equal the model on a sampled window
|
|
94
|
+
each tick plus a full final sweep -- so the soaks assert value-correctness, not
|
|
95
|
+
just liveness, with zero per-tick allocation. A new unit file `test/27-throwing-equals`
|
|
96
|
+
pins a throwing user `equals` at its three call sites (signal set pre-check,
|
|
97
|
+
batch revert check, computed re-eval). Verified green: torture 22/22, engine
|
|
98
|
+
byte-identical to 1.4.3, so the unit suite is unaffected (only its count grows).
|
|
99
|
+
|
|
100
|
+
- **1.4.3**: the **verification-surface patch, round three**. No engine
|
|
54
101
|
change -- as in 1.4.1 and 1.4.2, the only edit to `Signal.js` is the banner
|
|
55
102
|
version string, `Signal.d.ts` is untouched, and `bench/torture/` stays out of
|
|
56
103
|
`files[]`; for consumers 1.4.3 is byte-for-byte 1.4.2 plus a version number. It
|
|
@@ -447,7 +494,7 @@ interface RegistryConfig {
|
|
|
447
494
|
onCapacityExceeded?: "throw" | "grow"; // default "throw"; "grow" = chunked refill, ledger doubles, 16x link ceiling
|
|
448
495
|
}
|
|
449
496
|
|
|
450
|
-
interface RegistryStats { //
|
|
497
|
+
interface RegistryStats { // 13 keys as of 1.4.5
|
|
451
498
|
signals: number;
|
|
452
499
|
computeds: number;
|
|
453
500
|
effects: number;
|
|
@@ -455,6 +502,8 @@ interface RegistryStats { // 11 keys as of 1.4.0
|
|
|
455
502
|
pooledLinks: number;
|
|
456
503
|
linkPoolCapacity: number; // ledger; doubles under "grow"
|
|
457
504
|
nodePoolCapacity: number; // ledger; doubles under "grow"
|
|
505
|
+
nodePoolPopulation: number; // 1.4.5: physical node objects constructed; eager == capacity, lazy grows from 0
|
|
506
|
+
linkPoolPopulation: number; // 1.4.5: physical link objects constructed; eager == capacity, lazy grows from 0
|
|
458
507
|
activeNodes: number; // live gauge
|
|
459
508
|
totalAllocations: number; // 1.4.0: cumulative node acquires; reset by destroy()
|
|
460
509
|
totalDisposals: number; // 1.4.0: cumulative node disposals; totalAllocations - totalDisposals === activeNodes
|
|
@@ -657,7 +706,7 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
657
706
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
658
707
|
- `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
|
|
659
708
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
660
|
-
- `bench/torture/` -- **
|
|
709
|
+
- `bench/torture/` -- **22 scenarios (19 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 (`SKIP: <feature> requires <version>+`, exit 0), so the whole directory rides this 1.4.x base forward. `semantic` (deterministic, fast, asserts on MEANING; run in CI) -- the **13 that execute on the 1.4.x engine**: `oracle-fuzzer` (every computed vs an independent uncached reference evaluator, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeup counts), `work-accounting` (minimum body-execution counts over 10 topologies), `op-accounting` (structural work via the `onGraphMutation` opcode lane -- op5 identity, equality cutoff, link/node balance, 400-seed differential), `introspect-torture` (the read-only `describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers` surface: walk agreement vs the real edge set incl. dynamic rewiring, and the ABA gen-stamp guard), `lifecycle-torture` (`destroy` 1.4.0+ registry reset -- gen-bump staling, no-op stale writes, pool reuse, idempotence; its `createRoot` half is 1.5.0+ and self-skips), `concurrent-storm` (8 reentrancy / flush-ordering contracts, `CycleError` via `maxFlushPasses`), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing scheduler containment), `async-torture` (`watch`/`when`/`whenAsync` + a 300-seed storm), `capacity-torture` (the fail-closed pool boundary, `CapacityError`, `grow` crossing it AND its 16x link ceiling terminating exactly at `maxLinks*16`, no partial value escapes), `error-torture` (throwing effect bodies under flush: single-throw re-thrown unwrapped, two-or-more into an `AggregateError` carrying exactly those errors, survivors still run, buffer drains to baseline over 4096 cycles), `deep-chain-torture` (`pullComputed` recursion fails closed with a RangeError at ramped depth, registry stays usable, the iterative effect-cascade push path over an equally deep chain does not throw), `zerogc-torture` (the zero-GC gate -- steady-state writes retain 0 bytes and force 0 major GCs, node churn leaks nothing, via `@zakkster/lite-gc-profiler`'s `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + exact `stats()` deltas, mutation-verified by `ZEROGC_BREAK=1`; its `churn-box` witness self-skips below 1.5.0); plus **6 that self-skip** until their feature exists: `box-torture` (1.5.0), `scope-torture` (1.6.0), `owner-torture` (1.6.0), `flush-torture` (1.7.0), `cleanup-return-torture` (1.8.0), `dispose-torture` (1.9.0). `soak` (wall-clock bound, asserts on RESOURCES and now on VALUE-CORRECTNESS; run 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 AND a once-allocated `Int32Array` shadow model (sampled on a rotating window each tick, full sweep at teardown, zero per-tick allocation) agrees with every signal value. The runner spawns each scenario as a child process because several assert on global pool accounting, and passes `--expose-gc` unconditionally. `zerogc-torture` and the soaks require `--expose-gc` (the runner supplies it). Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
661
710
|
- `bench/torture/helpers/index.mjs` -- shared torture infrastructure: seeded `mulberry32` (failures replay from their seed), `soakRegistry` / `fixedRegistry`, `createReport` (collects failures rather than throwing on the first), and `VALUE_POOL`, the adversarial value domain containing the pairs where candidate equality definitions disagree (`Object.is` vs `===` on NaN and -0/0; `===` vs `==` on 0/""/false/"0" and null/undefined). Dependency-free and side-effect-free by contract: importing it must not touch the default registry.
|
|
662
711
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
663
712
|
- `demo/index.html` -- interactive visualization of the reactive graph.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.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",
|