@zakkster/lite-signal 1.7.0-alpha.5 → 1.7.0-beta
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 +134 -0
- package/README.md +15 -7
- package/Signal.d.ts +10 -0
- package/Signal.js +145 -1
- package/llms.txt +48 -8
- package/package.json +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,140 @@ 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.7.0-beta] -- 2026-09-06
|
|
8
|
+
|
|
9
|
+
Verification + infra increment; promotes the line to the `beta` dist-tag. **No
|
|
10
|
+
engine change past the version banner comment** (`Signal.js` shasum-identical to
|
|
11
|
+
1.7.0-alpha.6 below the banner; `Signal.d.ts` / `Watch.js` untouched). Migration
|
|
12
|
+
2 of the torture-parity campaign: the canonical 1.5.x audit instrument set, as
|
|
13
|
+
merged into 1.6.0-rc.1, carried onto this folder -- with every version-sensitive
|
|
14
|
+
pin re-probed on THIS engine before being written, and this folder's own richer
|
|
15
|
+
tooling kept where it was ahead.
|
|
16
|
+
|
|
17
|
+
### Added -- torture suite 22 -> 27 scenarios (audit-phase hardening)
|
|
18
|
+
|
|
19
|
+
- `contract-torture` (throw-inside-batch commit+flush semantics incl the pending
|
|
20
|
+
scheduler thunk, write-inside-computed in-pass delivery, equals contract under
|
|
21
|
+
churn, and the 1.6.0+ `flushPasses` pins on the abnormal paths),
|
|
22
|
+
`interop-torture` (multi-registry isolation + `destroy()` staleness
|
|
23
|
+
degradation), `retrack-dispose-torture` (dispose-during-retracking cursor
|
|
24
|
+
hazard under survivor-value + pool oracles), `burst-profile-torture` (the
|
|
25
|
+
op-6/7 flush lane engine-raw: coalescing == 1.0x exactly, pass accounting,
|
|
26
|
+
`stats().flushPasses` agreement; `BURST_BREAK=drop7|ghost6` self-tests both
|
|
27
|
+
verified to exit 1), and the opt-in `wraparound-torture` (the 2^31 dormancy
|
|
28
|
+
band re-pinned at FULL distance on this engine, 12/12 asserts).
|
|
29
|
+
- The hardened runner: 3-state skip protocol (exit 77 floor-skip -- escalated to
|
|
30
|
+
FAIL at/above the engine's floor -- and exit 78 environment-skip), per-scenario
|
|
31
|
+
wall-clock caps, and an asserted-nothing guard. This folder's NATIVE
|
|
32
|
+
`flush-torture` (the cross-strategy eager/sab/manual differential plus its
|
|
33
|
+
sections 7-10: value-never-defers, op-7 enqueue dedup, the invalid-token throw
|
|
34
|
+
matrix, re-entrant flush) is KEPT over the canonical floor-skip copy -- its
|
|
35
|
+
self-skip patched from exit 0 to the suite's exit 77 -- and now executes
|
|
36
|
+
natively. Suite on this engine: **24 pass / 3 skip (cleanup-return 1.8,
|
|
37
|
+
dispose 1.9, wraparound opt-in) / 0 fail**.
|
|
38
|
+
|
|
39
|
+
### Added -- test + gate lanes
|
|
40
|
+
|
|
41
|
+
- `test/zgc/` zero-GC gate lane (`npm run test:zgc` + `test:zgc:report`):
|
|
42
|
+
scavenge-witness scenarios under a 4 MB semi-space with the Node-26
|
|
43
|
+
nursery-proofed ctrlPositive; 7/7 + 3/3 report on this engine; both
|
|
44
|
+
`ZEROGC_BREAK` modes exit 1.
|
|
45
|
+
- `test/ProfilerTests/` hardening sub-package (`npm run test:hardening`):
|
|
46
|
+
28 tests, 22 execute + 6 version-gated skips here.
|
|
47
|
+
- `test/25-devtools-real-boot.test.mjs` REWRITTEN against **lite-devtools
|
|
48
|
+
1.6.2** via the single-instance import-rewrite rig; the exact 13-key
|
|
49
|
+
`capabilities()` fingerprint was probed live on this engine first:
|
|
50
|
+
`flushControl:T` (the 1.7.0 flip), `cleanupReturn:F`, `statsKeys:14`,
|
|
51
|
+
22 exports + `VERSION "1.6.2"`, live `burstProfile()` stop-summary,
|
|
52
|
+
the 1.6.x `Symbol.dispose` stamps.
|
|
53
|
+
- `test/32-devtools-zerogc-probe.test.mjs`: devtools attach/detach allocation
|
|
54
|
+
probes against the 14-key `stats()` surface.
|
|
55
|
+
- Harness instruments from the 2026-08 audit phases: `mint-anatomy` (wired as
|
|
56
|
+
`node harness/run.mjs mint [--verify]`), `visit-anatomy --verify`,
|
|
57
|
+
`jit-health --strict` (+ a freshly recorded Node-26 deopt baseline),
|
|
58
|
+
`costmodel`, `floors`, `trend`, `creation-anatomy`, `burst-real`, and the
|
|
59
|
+
phase-3 rewrites of `andrii-isolated-child` / `creation-isolated` /
|
|
60
|
+
`owner-hazard-repro`. VersionMatrix gains the read + creation + exact-counter
|
|
61
|
+
lanes and the `creation-churn` workload.
|
|
62
|
+
|
|
63
|
+
### Measured on this engine (node v26.3.1, darwin/arm64)
|
|
64
|
+
|
|
65
|
+
- Creation anatomy IDENTICAL to the 1.5.x/1.6.x line: `signal(1)`+dispose
|
|
66
|
+
**264 B/op** all-space (tier-invariant), `computed` 208, `effect` 160,
|
|
67
|
+
`signalBox`/`computedBox` **56**, dispose side 0 -- all mint pins PASS. The
|
|
68
|
+
1.7.0 flushStrategy closure split selects ONE closure per registry at init,
|
|
69
|
+
so the creation path allocates exactly what 1.6.0 did.
|
|
70
|
+
- `visit-anatomy --verify`: all 21 exact structural pins hold after a
|
|
71
|
+
DELIBERATE re-anchor (the closure split duplicates the eq-dispatch source
|
|
72
|
+
sites 3 -> 5; runtime counts unchanged). Both failure paths re-proven on this
|
|
73
|
+
engine: the anchor-drift refusal fired on the real drift, and a gutted
|
|
74
|
+
short-circuit mutant fires the `depWalk` pin (640,000 vs pinned 0, exit 1).
|
|
75
|
+
- `jit-health --strict`: signal / computed / signalBox / computedBox handle
|
|
76
|
+
families all MONOMORPHIC; 5 engine-attributed deopts baselined for Node 26.
|
|
77
|
+
- **VersionMatrix `npm run gate` PASSED 5/5** (interleaved floor-1.3.0 +
|
|
78
|
+
rolling-1.5.0 tarballs + tree candidate, REPS=5): all five workloads PASS
|
|
79
|
+
both gates; creation counters exact (288 allocs/frame, 0 poolGrowths).
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
|
|
83
|
+
- devDependencies: `@zakkster/lite-devtools` ^1.2.0 -> **^1.6.2**,
|
|
84
|
+
`@zakkster/lite-gc-profiler` ^1.15.0 -> **^1.16.0**.
|
|
85
|
+
- package.json scripts aligned with the campaign set: added `test:report`,
|
|
86
|
+
`test:hardening(:gc)`, `test:zgc(:report)`, `test:all`; `test:harness` now
|
|
87
|
+
runs the ProfilerTools sub-package via `npm --prefix`; `verify` gains
|
|
88
|
+
`test:zgc` + `harness:smoke`; `exports` puts `types` first. Native
|
|
89
|
+
`harness:smoke/perf/toe` and `profile:*` scripts kept.
|
|
90
|
+
|
|
91
|
+
### Removed
|
|
92
|
+
|
|
93
|
+
- `test/28-scope.test.mjs` -- byte-identical duplicate of `29-scope.test.mjs`
|
|
94
|
+
(the alpha.3 notes already claimed this removal, but the file had survived on
|
|
95
|
+
disk and the scope suite ran twice). Unit count 537 -> **533** (532 pass /
|
|
96
|
+
0 fail / 1 skip).
|
|
97
|
+
- Stale `bench-reactive` script (its target `bench/benchmarkReactive.mjs` does
|
|
98
|
+
not exist in this folder; the legacy reactive bench was deliberately retired).
|
|
99
|
+
|
|
100
|
+
## [1.7.0-alpha.6] -- 2026-08-20
|
|
101
|
+
|
|
102
|
+
Backports the **1.4.5 `createRegistry` input validation** (all four findings) onto
|
|
103
|
+
the 1.7.0-alpha.5 engine. Supersedes 1.7.0-alpha.5. Only `createRegistry`'s *cold*
|
|
104
|
+
construction path changed -- the hot paths are byte-identical and the zero-GC gates
|
|
105
|
+
(`bench/torture/run.mjs` 22/22) are unchanged. If you had a typo in your registry
|
|
106
|
+
config, you will now hear about it.
|
|
107
|
+
|
|
108
|
+
### Added -- createRegistry validates its config (fail closed)
|
|
109
|
+
|
|
110
|
+
- **Bounded eager construction.** `prealloc:"eager"` with a non-finite or absurd
|
|
111
|
+
capacity (`maxNodes:Infinity`, `maxNodes:1e9`) previously ran an unbounded
|
|
112
|
+
construction loop and killed the process with an **uncatchable SIGABRT**. It now
|
|
113
|
+
throws a `TypeError` **by name**, before allocating, gated on `(maxNodes+maxLinks)`
|
|
114
|
+
against a ceiling of `1<<24` (16,777,216) objects. `prealloc:"lazy"` keeps its
|
|
115
|
+
unbounded on-demand ledger, untouched.
|
|
116
|
+
- **Per-option validation by name.** `maxNodes` / `maxLinks` / `maxFlushPasses` must
|
|
117
|
+
be finite integers `>= 1`; `prealloc` must be exactly `"eager"` | `"lazy"`;
|
|
118
|
+
`onCapacityExceeded` must be exactly `"throw"` | `"grow"`. Each bad value throws a
|
|
119
|
+
`TypeError` prefixed `createRegistry: "<option>"` at construction -- not a delayed
|
|
120
|
+
internal `nextFree` TypeError on first use.
|
|
121
|
+
- **Config-shape gate.** A non-object, `null`, or array `config` throws
|
|
122
|
+
`createRegistry: "config"` rather than dying later.
|
|
123
|
+
- **Unknown-key rejection with did-you-mean.** An unrecognized key throws with a
|
|
124
|
+
Levenshtein suggestion (`maxNods` -> `maxNodes`, `preAlloc` -> `prealloc`) instead
|
|
125
|
+
of being silently ignored.
|
|
126
|
+
- **`flushStrategy` stays a first-class option.** It is a recognized key (its own native value-guard is unchanged); only misspelled *keys* are rejected.
|
|
127
|
+
- **`stats()` gains `nodePoolPopulation` / `linkPoolPopulation`** -- the TRUE count
|
|
128
|
+
of physically constructed nodes/links, distinct from the `*Capacity` ledgers. A
|
|
129
|
+
silently mis-set `prealloc` is now observable (population 0 under lazy) instead of
|
|
130
|
+
telemetry-blind. **The one observable API change: `stats()` grows to 14 keys,
|
|
131
|
+
purely additive** -- no existing key changed; only an exact key-*count* assertion
|
|
132
|
+
is affected (updated in `test/03-pool.test.mjs`).
|
|
133
|
+
|
|
134
|
+
### Tests
|
|
135
|
+
|
|
136
|
+
New `test/*-config-validation.test.mjs` adds the full config matrix, the did-you-mean
|
|
137
|
+
cases, the eager ceiling, the population contract, and the three OOM rows as isolated
|
|
138
|
+
child-process cases proving the fixed engine throws + exits 0 under a 256 MB cap where
|
|
139
|
+
the unvalidated engine died.
|
|
140
|
+
|
|
7
141
|
## [1.7.0-alpha.4] -- 2026-08-18
|
|
8
142
|
|
|
9
143
|
**Torture-suite and test parity with the shipped 1.4.4 canonical suite.** This is
|
package/README.md
CHANGED
|
@@ -928,16 +928,19 @@ npm run bench
|
|
|
928
928
|
|
|
929
929
|
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
930
930
|
|
|
931
|
-
`bench/torture/` holds the complete **
|
|
932
|
-
soak)** --
|
|
933
|
-
runner (`run.mjs`), the forward-compatible set through 1.9.
|
|
931
|
+
`bench/torture/` holds the complete **27-scenario superset (23 semantic + 4
|
|
932
|
+
soak)** -- the shipped canonical suite plus the 2026-08 audit-phase hardening --
|
|
933
|
+
behind one runner (`run.mjs`), the forward-compatible set through 1.9.
|
|
934
934
|
They are not perf benchmarks: the ops/sec figures reflect random workload
|
|
935
935
|
composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
|
|
936
936
|
perf harness. Every scenario feature-detects and **skips cleanly** below the
|
|
937
|
-
engine version that introduces its feature
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
937
|
+
engine version that introduces its feature (exit 77, which the runner escalates
|
|
938
|
+
to FAIL if the engine is at or above the scenario's floor), so on the 1.7.0
|
|
939
|
+
engine the runner executes **24 of the 27** (21 semantic + 3 soak, including
|
|
940
|
+
`flush-torture` and the lifecycle scenarios that run natively), reports a clean
|
|
941
|
+
SKIP for the two later-version ones (`cleanup-return-torture` 1.8.0,
|
|
942
|
+
`dispose-torture` 1.9.0), and leaves the full-distance `wraparound-torture`
|
|
943
|
+
soak opt-in (`TORTURE_WRAPAROUND=1`).
|
|
941
944
|
|
|
942
945
|
```bash
|
|
943
946
|
npm run torture # everything
|
|
@@ -965,13 +968,17 @@ engine.
|
|
|
965
968
|
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
966
969
|
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
967
970
|
| `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 |
|
|
971
|
+
| `retrack-dispose-torture` | the dispose-during-retracking cursor hazard: mid-retrack disposals under a survivor-value + pool oracle, plus a seeded disposal fuzz |
|
|
968
972
|
| `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
973
|
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
970
974
|
| `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
975
|
| `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 |
|
|
976
|
+
| `contract-torture` | throw-inside-batch commit+flush semantics (incl the pending scheduler thunk), write-inside-computed in-pass delivery, the equals contract under churn, and the 1.6.0+ `flushPasses` pins on the abnormal paths |
|
|
977
|
+
| `interop-torture` | multi-registry isolation + `destroy()` staleness degradation: cross-registry handles stay inert, post-destroy handles read as stale |
|
|
972
978
|
| `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
979
|
| `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
980
|
| `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 |
|
|
981
|
+
| `burst-profile-torture` (1.6.0) | the op-6/7 flush lane engine-raw: burst coalescing == 1.0x EXACTLY, pass accounting, `stats().flushPasses` agreement; `BURST_BREAK=drop7|ghost6` self-tests must fail the gate |
|
|
975
982
|
| `lifecycle-torture` (1.5.0) | `createRoot` detachment (children survive, deps isolated) + `destroy` registry reset (stales every handle, returns `stats().activeNodes` to 0) |
|
|
976
983
|
| `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard -- SKIP on 1.7.0 |
|
|
977
984
|
| `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.7.0 |
|
|
@@ -993,6 +1000,7 @@ failure:
|
|
|
993
1000
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
|
994
1001
|
node --expose-gc bench/torture/torture-soak.mjs # 5s high-volume churn, 7500 nodes
|
|
995
1002
|
node --expose-gc bench/torture/scheduler-bench.mjs # 10s microtask-scheduled, 3300 nodes
|
|
1003
|
+
TORTURE_WRAPAROUND=1 node bench/torture/wraparound-torture.mjs # opt-in: the 2^31 dormancy band at FULL distance (~40s)
|
|
996
1004
|
```
|
|
997
1005
|
|
|
998
1006
|
Run any of them with `TORTURE_SECONDS=N` for a longer soak. Indicative numbers from a development host (post-teardown pool returns to baseline in all three):
|
package/Signal.d.ts
CHANGED
|
@@ -122,6 +122,16 @@ export interface RegistryStats {
|
|
|
122
122
|
/** Node-pool capacity ledger. Doubles under the `"grow"` policy; under `"lazy"`
|
|
123
123
|
* prealloc it may exceed the count of physically constructed nodes. */
|
|
124
124
|
nodePoolCapacity: number;
|
|
125
|
+
/** TRUE node-pool population: the number of `ReactiveNode`s physically constructed
|
|
126
|
+
* (`nodePool.length`), distinct from the `nodePoolCapacity` ledger. Under
|
|
127
|
+
* `prealloc:"lazy"` (or a silently-flipped `prealloc` typo) this stays 0 until
|
|
128
|
+
* first demand while capacity reads the ledger -- so a mis-set `prealloc` is
|
|
129
|
+
* observable here rather than telemetry-blind. Added in the 1.4.5 backport. */
|
|
130
|
+
nodePoolPopulation: number;
|
|
131
|
+
/** TRUE link-pool population: the number of `ReactiveLink`s physically constructed
|
|
132
|
+
* (`linkPool.length`), distinct from the `linkPoolCapacity` ledger. Added in the
|
|
133
|
+
* 1.4.5 backport. */
|
|
134
|
+
linkPoolPopulation: number;
|
|
125
135
|
/** Number of nodes currently allocated (signals + computeds + alive effects). */
|
|
126
136
|
activeNodes: number;
|
|
127
137
|
/**
|
package/Signal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zakkster/lite-signal v1.7.0-
|
|
2
|
+
* @zakkster/lite-signal v1.7.0-beta
|
|
3
3
|
* --------------------
|
|
4
4
|
* 1.7.0 -- flushStrategy: registry-level effect-delivery policy.
|
|
5
5
|
*
|
|
@@ -237,10 +237,134 @@ export class CapacityError extends Error {
|
|
|
237
237
|
* Error prefixed `"CycleError:"`.
|
|
238
238
|
* @returns {Registry}
|
|
239
239
|
*/
|
|
240
|
+
/** The only config keys {@link createRegistry} recognizes. Anything else is
|
|
241
|
+
* rejected at construction with a did-you-mean hint (fail closed on an
|
|
242
|
+
* unverified state -- an unknown key is an error, never a silent ignore). */
|
|
243
|
+
const ALLOWED_KEYS = ["maxNodes", "maxLinks", "prealloc", "onCapacityExceeded", "maxFlushPasses", "flushStrategy"];
|
|
244
|
+
|
|
245
|
+
/** Ceiling on eager pool construction: `(maxNodes + maxLinks)` objects. A finite
|
|
246
|
+
* but absurd `maxNodes` (e.g. `1e9`, a plausible typo for `1e5`) that would
|
|
247
|
+
* otherwise OOM the process is refused BY NAME at construction rather than
|
|
248
|
+
* allocating forever. Only the `"eager"` path is bounded; `"lazy"` keeps its
|
|
249
|
+
* unbounded ledger. `1 << 24` == 16777216. */
|
|
250
|
+
const EAGER_CONSTRUCT_CEILING = 1 << 24;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Levenshtein edit distance between two short strings. Cold: called only on the
|
|
254
|
+
* constructor error path, over the known option names, so its per-call array
|
|
255
|
+
* allocation never touches any hot path.
|
|
256
|
+
* @param {string} a
|
|
257
|
+
* @param {string} b
|
|
258
|
+
* @returns {number}
|
|
259
|
+
*/
|
|
260
|
+
function editDistance(a, b) {
|
|
261
|
+
const m = a.length;
|
|
262
|
+
const n = b.length;
|
|
263
|
+
const prev = new Array(n + 1);
|
|
264
|
+
const cur = new Array(n + 1);
|
|
265
|
+
for (let j = 0; j <= n; j++) prev[j] = j;
|
|
266
|
+
for (let i = 1; i <= m; i++) {
|
|
267
|
+
cur[0] = i;
|
|
268
|
+
for (let j = 1; j <= n; j++) {
|
|
269
|
+
const cost = a.charCodeAt(i - 1) === b.charCodeAt(j - 1) ? 0 : 1;
|
|
270
|
+
let min = prev[j] + 1;
|
|
271
|
+
if (cur[j - 1] + 1 < min) min = cur[j - 1] + 1;
|
|
272
|
+
if (prev[j - 1] + cost < min) min = prev[j - 1] + cost;
|
|
273
|
+
cur[j] = min;
|
|
274
|
+
}
|
|
275
|
+
for (let j = 0; j <= n; j++) prev[j] = cur[j];
|
|
276
|
+
}
|
|
277
|
+
return prev[n];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The closest known config key to `key` within edit distance 2 (case-folded so
|
|
282
|
+
* `preAlloc`/`MAXNODES` resolve), or null when nothing is close. Cold path only.
|
|
283
|
+
* @param {string} key
|
|
284
|
+
* @returns {string|null}
|
|
285
|
+
*/
|
|
286
|
+
function suggestKey(key) {
|
|
287
|
+
const lk = key.toLowerCase();
|
|
288
|
+
let best = null;
|
|
289
|
+
let bestD = 3;
|
|
290
|
+
for (let i = 0; i < ALLOWED_KEYS.length; i++) {
|
|
291
|
+
const d = editDistance(lk, ALLOWED_KEYS[i].toLowerCase());
|
|
292
|
+
if (d < bestD) { bestD = d; best = ALLOWED_KEYS[i]; }
|
|
293
|
+
}
|
|
294
|
+
return bestD <= 2 ? best : null;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Render a rejected value for an error message, e.g. `42 (number)`.
|
|
299
|
+
* Cold: this runs only on a throw path, never on any hot path. `String(symbol)`
|
|
300
|
+
* throws, so symbols are stringified defensively.
|
|
301
|
+
* @param {*} v
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
function received(v) {
|
|
305
|
+
return (typeof v === "symbol" ? v.toString() : String(v)) + " (" + typeof v + ")";
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Validate that a numeric option is a finite integer >= 1. Cold: constructor
|
|
310
|
+
* error path only. Throws a {@link TypeError} prefixed `createRegistry: "<name>"`.
|
|
311
|
+
* @param {*} v
|
|
312
|
+
* @param {string} name
|
|
313
|
+
*/
|
|
314
|
+
function requirePositiveInt(v, name) {
|
|
315
|
+
if (!Number.isInteger(v) || v < 1) {
|
|
316
|
+
throw new TypeError(
|
|
317
|
+
'createRegistry: "' + name + '" must be a finite integer >= 1, received ' + received(v) + '.'
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
240
322
|
export function createRegistry(config) {
|
|
241
323
|
const NODE_PTR = Symbol("node_ptr");
|
|
242
324
|
const NODE_GEN = Symbol("node_gen");
|
|
243
325
|
|
|
326
|
+
// --- 1.4.5 backport: createRegistry input validation (all cold, constructor-only).
|
|
327
|
+
// Config-shape gate: accept `undefined` or a non-null, non-array object; reject
|
|
328
|
+
// `null`, primitives and arrays BY NAME rather than dying later on `config.maxNodes`
|
|
329
|
+
// or an internal `nextFree` read (fail closed on an unverified state).
|
|
330
|
+
if (config !== undefined && (config === null || typeof config !== "object" || Array.isArray(config))) {
|
|
331
|
+
throw new TypeError(
|
|
332
|
+
'createRegistry: "config" must be a plain object or undefined, received ' + received(config) + '.'
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
if (config !== undefined) {
|
|
336
|
+
// Per-option validation BY NAME -- a bad value throws `createRegistry: "<option>"`
|
|
337
|
+
// at construction, not a delayed internal TypeError on first use.
|
|
338
|
+
if (config.maxNodes !== undefined) requirePositiveInt(config.maxNodes, "maxNodes");
|
|
339
|
+
if (config.maxLinks !== undefined) requirePositiveInt(config.maxLinks, "maxLinks");
|
|
340
|
+
if (config.maxFlushPasses !== undefined) requirePositiveInt(config.maxFlushPasses, "maxFlushPasses");
|
|
341
|
+
if (config.prealloc !== undefined && config.prealloc !== "eager" && config.prealloc !== "lazy") {
|
|
342
|
+
throw new TypeError(
|
|
343
|
+
'createRegistry: "prealloc" must be "eager" or "lazy", received ' + received(config.prealloc) + '.'
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
if (config.onCapacityExceeded !== undefined && config.onCapacityExceeded !== "throw" && config.onCapacityExceeded !== "grow") {
|
|
347
|
+
throw new TypeError(
|
|
348
|
+
'createRegistry: "onCapacityExceeded" must be "throw" or "grow", received ' + received(config.onCapacityExceeded) + '.'
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
// Unknown-key rejection with a did-you-mean hint (`preAlloc` -> `prealloc`,
|
|
352
|
+
// `maxNods` -> `maxNodes`). Own enumerable keys only; cold path.
|
|
353
|
+
const badKeys = Object.keys(config);
|
|
354
|
+
for (let bi = 0; bi < badKeys.length; bi++) {
|
|
355
|
+
const bk = badKeys[bi];
|
|
356
|
+
if (ALLOWED_KEYS.indexOf(bk) === -1) {
|
|
357
|
+
const hint = suggestKey(bk);
|
|
358
|
+
throw new TypeError(
|
|
359
|
+
'createRegistry: "' + bk + '" is not a recognized option' +
|
|
360
|
+
(hint !== null ? ' (did you mean "' + hint + '"?)' : '') +
|
|
361
|
+
'. Allowed: ' + ALLOWED_KEYS.join(", ") + '.'
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// --- end 1.4.5 backport.
|
|
367
|
+
|
|
244
368
|
let currentNodesCapacity = (config !== undefined && config.maxNodes !== undefined) ? config.maxNodes : 1024;
|
|
245
369
|
let currentLinkCapacity = (config !== undefined && config.maxLinks !== undefined) ? config.maxLinks : currentNodesCapacity * 4;
|
|
246
370
|
const policy = (config !== undefined && config.onCapacityExceeded !== undefined) ? config.onCapacityExceeded : "throw";
|
|
@@ -264,6 +388,20 @@ export function createRegistry(config) {
|
|
|
264
388
|
// steady state is identical after warm-up, but the heap no longer carries
|
|
265
389
|
// never-used live objects for every major GC to mark.
|
|
266
390
|
const prealloc = (config !== undefined && config.prealloc !== undefined) ? config.prealloc : "eager";
|
|
391
|
+
// Eager-construction ceiling (cold): `"eager"` builds `(maxNodes + maxLinks)`
|
|
392
|
+
// objects up front; a finite-but-absurd capacity (e.g. `1e9`) would OOM the
|
|
393
|
+
// process with an uncatchable SIGABRT, not a throw. Refuse BY NAME before
|
|
394
|
+
// allocating. Named for the larger driver. `"lazy"` keeps its unbounded ledger.
|
|
395
|
+
if (prealloc === "eager" && (currentNodesCapacity + currentLinkCapacity) > EAGER_CONSTRUCT_CEILING) {
|
|
396
|
+
const driver = currentLinkCapacity > currentNodesCapacity ? "maxLinks" : "maxNodes";
|
|
397
|
+
throw new TypeError(
|
|
398
|
+
'createRegistry: "' + driver + '" eager construction of ' +
|
|
399
|
+
(currentNodesCapacity + currentLinkCapacity) + ' objects (maxNodes ' +
|
|
400
|
+
currentNodesCapacity + ' + maxLinks ' + currentLinkCapacity + ') exceeds the ceiling of ' +
|
|
401
|
+
EAGER_CONSTRUCT_CEILING + '. Use prealloc:"lazy" for an unbounded on-demand ledger, ' +
|
|
402
|
+
'or lower the capacity.'
|
|
403
|
+
);
|
|
404
|
+
}
|
|
267
405
|
const nodePool = [];
|
|
268
406
|
let freeNodeHead = null;
|
|
269
407
|
const linkPool = [];
|
|
@@ -1801,6 +1939,12 @@ export function createRegistry(config) {
|
|
|
1801
1939
|
pooledLinks: currentLinkCapacity - activeLinks,
|
|
1802
1940
|
linkPoolCapacity: currentLinkCapacity,
|
|
1803
1941
|
nodePoolCapacity: currentNodesCapacity,
|
|
1942
|
+
// 1.4.5 backport: TRUE pool population (nodePool.length / linkPool.length),
|
|
1943
|
+
// distinct from the *Capacity ledgers above. Under prealloc:"lazy" (or a
|
|
1944
|
+
// silently-flipped `prealloc` typo) population stays 0 while capacity reads
|
|
1945
|
+
// the ledger -- so a mis-set prealloc is now observable, not telemetry-blind.
|
|
1946
|
+
nodePoolPopulation: nodePool.length,
|
|
1947
|
+
linkPoolPopulation: linkPool.length,
|
|
1804
1948
|
activeNodes,
|
|
1805
1949
|
// 1.4: cumulative lifecycle counters (monotonic; reset by destroy()).
|
|
1806
1950
|
// Derive: allocationRate = deltatotalAllocations/deltat; poolReuseRate =
|
package/llms.txt
CHANGED
|
@@ -16,7 +16,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
16
16
|
- **Signal**: root reactive cell. `signal(initial, { equals? })` returns a function. Call it to read (tracked), use `.peek()` to read without tracking, `.set(v)` to notify downstream, `.update(fn)` for read-modify-write, `.subscribe(fn)` for an effect-backed listener.
|
|
17
17
|
- **Computed**: lazy memoized derivation. `computed(fn, { equals? })`. Cache hits return in O(deps) (version comparison only). Cache misses re-run the body and refresh `evalVersion`. Errors are cached via `FLAG_HAS_ERROR` and re-thrown on every read until a dep changes.
|
|
18
18
|
- **Effect**: side-effect runner. `effect(fn, { scheduler? })`. Runs immediately on creation, then on any tracked dep change. Returns a dispose function. Optional scheduler defers execution (e.g., to rAF, microtask, custom frame loop).
|
|
19
|
-
- **Box (1.5.0)**: non-callable, allocation-light variants. `signalBox(initial, { equals? })` returns `{ get, set, peek, update, subscribe }`; `computedBox(fn, { equals? })` returns `{ get, peek, subscribe }` (no set/update -- derived). Same `ReactiveNode` and zero-GC read/write path as the callable forms, full interop in one graph (a callable can read `box.get()` and vice versa). Construction is ~1.9x cheaper than the callable and ~4.2x cheaper to recreate through the pool (an `Object.create(proto)` handle, not a closure; measured by `npm run harness:dispose`). Built on a shared prototype from the start -- never `setPrototypeOf` (which would deopt the method-call ICs to megamorphic). Exported as registry methods and top-level helpers.
|
|
19
|
+
- **Box (1.5.0)**: non-callable, allocation-light variants. `signalBox(initial, { equals? })` returns `{ get, set, peek, update, subscribe }`; `computedBox(fn, { equals? })` returns `{ get, peek, subscribe }` (no set/update -- derived). Same `ReactiveNode` and zero-GC read/write path as the callable forms, full interop in one graph (a callable can read `box.get()` and vice versa). Construction is ~1.9x cheaper than the callable and ~4.2x cheaper to recreate through the pool (an `Object.create(proto)` handle, not a closure; measured by `npm run harness:dispose`). Measured at **56 B/op per mint+dispose cycle vs 264 B/op for the callable** (all-space, node v26.3.1, probed on this engine -- the 1.7.0 flushStrategy closure split sits outside the creation path; see `node harness/run.mjs mint`). The box guard stays DECIDABLE because each box is a fresh identity carrying its own `NODE_GEN`, so pooling closure identity is not needed to cut the cost. Built on a shared prototype from the start -- never `setPrototypeOf` (which would deopt the method-call ICs to megamorphic). Exported as registry methods and top-level helpers.
|
|
20
20
|
- **createRoot (1.5.0)**: `createRoot(fn)` runs `fn` in a detached ownership scope and returns `fn`'s value. Effects/computeds created directly in `fn` are NOT adopted by the enclosing owner, so they survive its re-runs/disposal (the caller owns their lifecycle). Both ownership and tracking are detached for `fn`'s direct body; inner effect/computed bodies still establish their own scopes. The escape hatch for lazily spawning a long-lived node from inside a consumer effect (e.g. `lite-query`'s query-watcher) -- without it, the consumer owns the watcher and cascade-disposes it on its next re-run. Mirrors Solid's `createRoot`. The re-attach companion `runWithOwner` **shipped in 1.7.0** -- see below.
|
|
21
21
|
- **dispose(api)**: universal disposal. Accepts a signal, computed, or effect dispose handle; idempotent; cross-registry calls are silent no-ops (per-registry `Symbol("node_ptr")` keys the node-identity slot on the returned API function, foreign signals fail the lookup and fall through). Passing an unrelated value is also safe; passing an arbitrary function invokes it (effect-handle contract).
|
|
22
22
|
- **createScope (1.6.0)**: `createScope(fn)` runs `fn(dispose)` in a detached, untracked scope and returns `fn`'s value. The single `dispose` argument cascade-disposes every effect and computed created inside `fn`. Lifecycle complement to `createRoot`: `createRoot` only *detaches* (caller disposes each child by hand), `createScope` *adopts*, so one disposer tears down a subtree of unknown shape -- the per-item lifecycle a keyed-list or scene reconciler needs. Plain signals created directly in `fn` are NOT adopted (consistent with the 1.2.0 ownership rule). A scope created inside a consumer effect SURVIVES that consumer's re-run.
|
|
@@ -31,7 +31,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
31
31
|
- **isTracking**: `isTracking()` returns true iff a read right now would record a dependency on this registry (for wrappers that lazily allocate signals).
|
|
32
32
|
- **onCleanup**: registers teardown for the current computation; fires before each re-run and once on dispose. Works in effects and computeds.
|
|
33
33
|
- **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.
|
|
34
|
-
- **Registry**: `createRegistry({ maxNodes, maxLinks, prealloc, onCapacityExceeded, maxFlushPasses, flushStrategy })` 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. `flushStrategy` (1.7.0; `"eager"` default | `"sab"` | `"manual"`) chooses when effects deliver; every registry also exposes `r.flush()`.
|
|
34
|
+
- **Registry**: `createRegistry({ maxNodes, maxLinks, prealloc, onCapacityExceeded, maxFlushPasses, flushStrategy })` 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. `flushStrategy` (1.7.0; `"eager"` default | `"sab"` | `"manual"`) chooses when effects deliver; every registry also exposes `r.flush()`. **Config is validated at construction (1.7.0-alpha.6, backported from 1.4.5):** every option is checked BY NAME (the six recognized keys include `flushStrategy`), a bad shape or unknown key throws a `TypeError` prefixed `createRegistry: "<name>"` with a did-you-mean hint, and an absurd eager capacity (`maxNodes:Infinity`/`1e9`) is refused before it can OOM the process. `stats()` gains `nodePoolPopulation` / `linkPoolPopulation` (true constructed-object counts, distinct from the `*Capacity` ledgers) -> **14 keys**.
|
|
35
35
|
- **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.
|
|
36
36
|
|
|
37
37
|
## Architecture invariants
|
|
@@ -59,7 +59,43 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
59
59
|
|
|
60
60
|
## Version notes
|
|
61
61
|
|
|
62
|
-
- **1.7.0-
|
|
62
|
+
- **1.7.0-beta** (current): verification + infra increment -- NO engine change
|
|
63
|
+
past the version banner comment (shasum-verified). Migration 2 of the
|
|
64
|
+
torture-parity campaign: the canonical 1.5.x audit instruments, as merged into
|
|
65
|
+
1.6.0-rc.1, carried onto this folder with every pin re-probed on THIS engine
|
|
66
|
+
first. `bench/torture/` grows 22 -> **27 scenarios** (adds `contract-torture`,
|
|
67
|
+
`interop-torture`, `retrack-dispose-torture`, `burst-profile-torture` -- all
|
|
68
|
+
running natively here -- plus the opt-in `wraparound-torture`, re-pinned at
|
|
69
|
+
full distance 12/12); this folder's richer native `flush-torture` (the
|
|
70
|
+
cross-strategy differential + sections 7-10) is KEPT over the canonical copy,
|
|
71
|
+
patched to the suite's exit-77 skip protocol, and now executes natively; the
|
|
72
|
+
runner enforces 3-state floors (skip at/above floor = FAIL). New `test/zgc/`
|
|
73
|
+
zero-GC gate lane (`test:zgc` + `test:zgc:report`, Node-26 nursery-proofed
|
|
74
|
+
ctrlPositive), `test/ProfilerTests/` hardening sub-package (`test:hardening`,
|
|
75
|
+
28 tests), `test/25` REWRITTEN against **devtools 1.6.2** (live-probed
|
|
76
|
+
fingerprint: `flushControl:T`, `cleanupReturn:F`, `statsKeys:14`; 22 exports),
|
|
77
|
+
new `test/32` devtools-zerogc probe; the byte-identical duplicate
|
|
78
|
+
`test/28-scope.test.mjs` -- which the alpha.3 notes already claimed removed
|
|
79
|
+
but which had survived on disk -- is now actually deleted. Unit suite
|
|
80
|
+
**533 tests / 532 pass / 0 fail / 1 skip**; torture **24 pass / 3 skip / 0
|
|
81
|
+
fail**. Harness gains `mint-anatomy` (creation-cycle allocation anatomy,
|
|
82
|
+
re-measured IDENTICAL to the 1.5.x/1.6.x line: callable mint+dispose **264
|
|
83
|
+
B/op**, computed 208, effect 160, boxes **56**, all-space + tier-invariant --
|
|
84
|
+
the flushStrategy closure split sits OUTSIDE the creation path),
|
|
85
|
+
`visit-anatomy --verify` (21 exact structural pins, deliberately re-anchored:
|
|
86
|
+
the closure split turns 3 eq-dispatch source sites into 5, runtime counts
|
|
87
|
+
unchanged), `jit-health --strict` (4 handle families monomorphic; fresh
|
|
88
|
+
Node-26 deopt baseline), costmodel / floors / trend / creation-anatomy /
|
|
89
|
+
burst-real, and the phase-3 rewrites of andrii-isolated / creation-isolated /
|
|
90
|
+
owner-hazard. VersionMatrix gains the read + creation + exact-counter lanes
|
|
91
|
+
and the `creation-churn` workload: **GATE PASSED 5/5** vs floor-1.3.0 +
|
|
92
|
+
rolling-1.5.0 (creation counters exact: 288 allocs/frame, 0 poolGrowths).
|
|
93
|
+
devDeps: `@zakkster/lite-devtools` ^1.2.0 -> **^1.6.2**,
|
|
94
|
+
`@zakkster/lite-gc-profiler` ^1.15.0 -> **^1.16.0**; stale `bench-reactive`
|
|
95
|
+
script dropped (its target was removed at 1.6.0-beta era). See CHANGELOG
|
|
96
|
+
`[1.7.0-beta]`.
|
|
97
|
+
- **1.7.0-alpha.6**: backports the **1.4.5 `createRegistry` input validation** (all four findings) onto the 1.7.0-alpha.5 engine. Only `createRegistry`'s *cold* path moved; hot paths stay byte-identical and `bench/torture/run.mjs` is unchanged at 22/22. Bad config now throws a named `TypeError` (unknown keys get a did-you-mean); an absurd eager capacity is refused before it can OOM the process; `stats()` grows to 14 keys (adds `nodePoolPopulation`/`linkPoolPopulation`, purely additive). New `test/*-config-validation.test.mjs` (matrix + ceiling + population + OOM child processes). See CHANGELOG `[1.7.0-alpha.6]`.
|
|
98
|
+
- **1.7.0-alpha.4**: **torture-suite + test parity with the shipped 1.4.4
|
|
63
99
|
canonical suite** -- verification-only, the `Signal.js`/`Signal.d.ts` engine is
|
|
64
100
|
UNCHANGED (shasum-identical). Five scenarios were ported to bring `bench/torture/`
|
|
65
101
|
from 17 to **22** (19 semantic + 3 soak): `lifecycle-torture`, `owner-torture`,
|
|
@@ -785,18 +821,23 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
785
821
|
- `test/22-mutation-hook.test.mjs` (12) -- 1.2.1 `onGraphMutation` registration + opcode emission (1-5).
|
|
786
822
|
- `test/23-owner-introspection.test.mjs` (14) -- `ownerOf`, `forEachOwned`, gen-guarded introspection, the effect-disposer-as-handle fix.
|
|
787
823
|
- `test/24-signalbox.test.mjs` (12) -- the signalBox/computedBox handle API (activated in 1.5.0).
|
|
788
|
-
- `test/25-devtools-real-boot.test.mjs` (
|
|
824
|
+
- `test/25-devtools-real-boot.test.mjs` (14) -- real **devtools 1.6.2** boot against the 1.7.0 engine via the single-instance import-rewrite rig: all 22 exports + `VERSION`, the exact 13-key `capabilities()` fingerprint probed live (`flushControl:T`, `cleanupReturn:F`, `statsKeys:14`), live `burstProfile()` stop-summary, the 1.6.x `Symbol.dispose` stamps.
|
|
789
825
|
- `test/26-free-list-invariant.test.mjs` (4) -- 1.2.2: the audit's clean-free-list invariant, asserted by inspecting freshly-allocated nodes.
|
|
790
826
|
- `test/27-create-root.test.mjs` (7) -- `createRoot` (1.5.0), the ownership escape hatch; includes the top-level-export binding case.
|
|
791
827
|
- `test/28-run-with-owner.test.mjs` (16) -- `getOwner`/`runWithOwner` (1.7.0): 7 basic shapes, 3 degradation cases (null/undefined/signal-handle all fall through to rooted execution), 3 HAZARD PINS run under allocation pressure so the ABA guard is genuinely exercised (recycled-slot cascade, corpse adoption, composed). Both hazards fail on a raw-pointer sketch and pass on the shipped gen-guarded implementation.
|
|
792
828
|
- `test/29-scope.test.mjs` (4) -- `createScope` (1.6.0), the adopting counterpart to `createRoot`.
|
|
793
|
-
|
|
829
|
+
- `test/30-throwing-equals.test.mjs` (9) -- a user `equals` that THROWS: every eq() dispatch site on this engine (callable set pre-check/revert, boxSet pre-check/revert -- both split-closure variants -- and the computed re-eval site) surfaces the throw with coherent state after.
|
|
830
|
+
- `test/31-config-validation.test.mjs` (13) -- the 1.4.5-backport validation matrix on the 6-key config family (incl `flushStrategy`): per-option TypeErrors, did-you-mean, the eager-construction ceiling, population keys, OOM child-process rows.
|
|
831
|
+
- `test/32-devtools-zerogc-probe.test.mjs` (5) -- devtools attach/detach allocation probes against the 14-key `stats()` surface.
|
|
832
|
+
- `test/zgc/` -- the promoted zero-GC gate lane (`npm run test:zgc` + `test:zgc:report`): scavenge-witness scenarios under a 4 MB semi-space, Node-26 nursery-proofed ctrlPositive, `ZEROGC_BREAK` self-tests.
|
|
833
|
+
- `test/ProfilerTests/` -- gc-profiler x engine hardening sub-package (`npm run test:hardening`; 28 tests, 22 execute + 6 version-gated skips).
|
|
794
834
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
795
835
|
- `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).
|
|
796
836
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
797
|
-
- `bench/torture/` -- the complete **
|
|
837
|
+
- `bench/torture/` -- the complete **27-scenario superset (23 semantic + 4 soak)** -- the shipped canonical suite plus the 2026-08 audit-phase hardening (`contract-torture`, `interop-torture`, `retrack-dispose-torture`, `burst-profile-torture`, the opt-in `wraparound-torture`) -- 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 **24 of the 27 execute** (21 semantic + 3 soak), **2 skip cleanly** at their floors, and the wraparound soak is opt-in. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **21 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), `retrack-dispose-torture` (the dispose-during-retracking cursor hazard: mid-retrack disposals under a survivor-value + pool oracle, plus a seeded disposal fuzz; hoisted so it runs from 1.4), `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), `contract-torture` (throw-inside-batch commit+flush semantics incl the PENDING scheduler thunk, write-inside-computed in-pass delivery, the equals contract under churn, and the 1.6.0+ `flushPasses` pins on the abnormal paths), `interop-torture` (multi-registry isolation + `destroy()` staleness degradation: cross-registry handles stay inert, post-destroy handles read as stale), `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), `burst-profile-torture` (the op-6/7 flush lane engine-raw: burst coalescing == 1.0x EXACTLY, pass accounting, `stats().flushPasses` agreement; `BURST_BREAK=drop7|ghost6` self-tests 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`, plus the opt-in `wraparound-torture` (`TORTURE_WRAPAROUND=1`: the 2^31 dormancy band pinned at FULL distance, ~30s) -- 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), passes `--expose-gc` unconditionally, and ENFORCES version floors: a skip (exit 77) at/above the engine floor is a FAILURE, exit 78 marks an environment skip, each scenario gets a wall-clock cap, and a scenario that reaches PASS having asserted nothing fails. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
798
838
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
799
|
-
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
839
|
+
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, mint, all).
|
|
840
|
+
- `harness/mint-anatomy.mjs` -- mint+dispose cycle allocation anatomy (`mint` / `mint --verify`): per-op all-space vs new-space heap bytes for every creation primitive on a pre-grown throw-policy registry, fresh child per (variant, warmup) cell. Documents the 264 B/op callable cycle vs 56 B/op signalBox and the ALL-space accounting rule (a new-space-only witness undercounts by ~56 B/op of pre-TurboFan closure-feedback). Re-measured IDENTICAL on the 1.7.0 engine -- the flushStrategy closure split sits outside the creation path. `--verify` applies relative pins P1..P5.
|
|
800
841
|
- `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`.
|
|
801
842
|
- `harness/perf-probe.mjs` -- sBench update-group shape, eager vs sab, per scenario.
|
|
802
843
|
- `harness/fieldkit.mjs` -- single-file portable verify + cold-child A/B bench across six shapes.
|
|
@@ -809,7 +850,6 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
809
850
|
- `harness/VersionMatrix/` -- cold-process-per-version regression gate (wired as prepublishOnly); refuses a verdict on unstable captures (NO EVIDENCE) rather than misreading host noise as a regression.
|
|
810
851
|
- `harness/ProfilerTools/` -- profiler-signal x devtools composition harness (wired as test:harness).
|
|
811
852
|
- `harness/attic/` -- parked probes (1.2.0->1.2.1 shape hunt, the superseded contiguous burst-dag, the superseded sbench sweep); wired into nothing.
|
|
812
|
-
- `demo/index.html` -- interactive visualization of the reactive graph.
|
|
813
853
|
|
|
814
854
|
## Install
|
|
815
855
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.7.0-
|
|
3
|
+
"version": "1.7.0-beta",
|
|
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",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"types": "./Signal.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"types": "./Signal.d.ts",
|
|
13
14
|
"node": "./Signal.js",
|
|
14
15
|
"import": "./Signal.js",
|
|
15
|
-
"types": "./Signal.d.ts",
|
|
16
16
|
"default": "./Signal.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -26,12 +26,17 @@
|
|
|
26
26
|
"CHANGELOG.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "node --test --test-reporter=spec test/*.test.mjs",
|
|
30
|
-
"test:gc": "node --expose-gc --test --test-reporter=spec test/*.test.mjs",
|
|
31
|
-
"test:coverage": "c8
|
|
32
|
-
"test:
|
|
29
|
+
"test": "node --test --test-reporter=spec 'test/*.test.mjs'",
|
|
30
|
+
"test:gc": "node --expose-gc --test --test-reporter=spec 'test/*.test.mjs'",
|
|
31
|
+
"test:coverage": "c8 node --test --test-reporter=spec 'test/*.test.mjs'",
|
|
32
|
+
"test:report": "c8 --reporter=lcov --reporter=text node --test --test-reporter=spec 'test/*.test.mjs'",
|
|
33
|
+
"test:hardening": "npm --prefix test/ProfilerTests test",
|
|
34
|
+
"test:hardening:gc": "npm --prefix test/ProfilerTests run test:gc",
|
|
35
|
+
"test:harness": "npm --prefix harness/ProfilerTools test",
|
|
36
|
+
"test:zgc": "node --expose-gc --max-semi-space-size=4 --test 'test/zgc/*.test.mjs'",
|
|
37
|
+
"test:zgc:report": "node --expose-gc test/zgc/zero-gc-gate.mjs",
|
|
38
|
+
"test:all": "npm test && npm run test:hardening && npm run test:harness && npm run test:zgc",
|
|
33
39
|
"bench": "node --expose-gc bench/benchmark.mjs",
|
|
34
|
-
"bench-reactive": "node --expose-gc bench/benchmarkReactive.mjs",
|
|
35
40
|
"harness": "node harness/run.mjs",
|
|
36
41
|
"harness:smoke": "node harness/run.mjs smoke",
|
|
37
42
|
"harness:field": "node harness/run.mjs field",
|
|
@@ -45,7 +50,7 @@
|
|
|
45
50
|
"profile:burst": "node --expose-gc harness/burst-dag.mjs ./Signal.js",
|
|
46
51
|
"profile:pull": "node --expose-gc harness/pull-stress.mjs",
|
|
47
52
|
"gate": "node harness/VersionMatrix/pre-publish.mjs",
|
|
48
|
-
"verify": "npm test && npm run harness:smoke && npm run bench",
|
|
53
|
+
"verify": "npm test && npm run test:zgc && npm run harness:smoke && npm run bench",
|
|
49
54
|
"torture": "node bench/torture/run.mjs",
|
|
50
55
|
"torture:semantic": "node bench/torture/run.mjs --group semantic",
|
|
51
56
|
"torture:soak": "node bench/torture/run.mjs --group soak"
|
|
@@ -85,8 +90,8 @@
|
|
|
85
90
|
},
|
|
86
91
|
"sideEffects": false,
|
|
87
92
|
"devDependencies": {
|
|
88
|
-
"@zakkster/lite-devtools": "^1.2
|
|
89
|
-
"@zakkster/lite-gc-profiler": "^1.
|
|
93
|
+
"@zakkster/lite-devtools": "^1.6.2",
|
|
94
|
+
"@zakkster/lite-gc-profiler": "^1.16.0",
|
|
90
95
|
"@zakkster/lite-profiler": "^1.1.0",
|
|
91
96
|
"@zakkster/lite-profiler-signal": "^1.2.0",
|
|
92
97
|
"@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
|