@zakkster/lite-signal 1.9.0-preview.6 → 1.10.0-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +115 -334
- package/README.md +57 -21
- package/Signal.d.ts +80 -0
- package/Signal.js +90 -2
- package/llms.txt +21 -8
- package/package.json +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,247 +4,102 @@ 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.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
the 1.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
`
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- **`error-torture`** -- throwing effect bodies under flush: a single throw is
|
|
105
|
-
re-thrown UNWRAPPED; two or more aggregate into one `AggregateError` carrying
|
|
106
|
-
EXACTLY those errors in order; the effect scheduled between two throwers still
|
|
107
|
-
runs; and the pre-allocated error buffer drains to a clean baseline over 4096
|
|
108
|
-
throw/clean cycles (`activeNodes` / `activeLinks` flat). Pinned against 1.9.0
|
|
109
|
-
`Signal.js` :928 (buffer append), :936-937 (finally clear), :941-951 (single
|
|
110
|
-
re-throw / AggregateError).
|
|
111
|
-
- **`deep-chain-torture`** -- `pullComputed` (1.9.0 :1092, recursing at :1113) is
|
|
112
|
-
call-stack recursive, so a computed chain ramped START 2000 / STEP 2000 /
|
|
113
|
-
CEILING 100000 fails CLOSED with a `RangeError` at some depth; the registry
|
|
114
|
-
stays usable, the re-read is deterministic, and the heap-iterative effect
|
|
115
|
-
cascade over an equally deep chain completes without throwing.
|
|
116
|
-
- **`zerogc-torture`** -- the zero-GC claim as a re-runnable gate via
|
|
117
|
-
`@zakkster/lite-gc-profiler` (added as a dev-only dependency): `measureAllocs` /
|
|
118
|
-
`checkAllocs` at `maxBytesPerCall: 0`, `measureOps` / `checkNoGc` at
|
|
119
|
-
`maxMajor: 0` / `maxPauseMs: 2`, and `stats()` poolGrowths/totalAllocations
|
|
120
|
-
deltas, over deep/wide/batch steady writes plus create/dispose churn on both the
|
|
121
|
-
callable form and `signalBox` (churn-box activates natively and reports a visible
|
|
122
|
-
"ok" verdict). `ZEROGC_BREAK=1` self-tests that the gate rejects a planted
|
|
123
|
-
allocation (exits non-zero).
|
|
124
|
-
- **`capacity-torture` section 9** -- the 16x link grow ceiling: `grow` mode still
|
|
125
|
-
fails closed at `maxLinks * 16` (confirmed 1.9.0 :312 / :471) with a `links`
|
|
126
|
-
`CapacityError`, growth terminating AT the ceiling, and a fail-closed re-throw
|
|
127
|
-
rather than a partial sum.
|
|
128
|
-
- **Soak value-oracles** -- `graph-fuzzer`, `scheduler-bench`, `torture-soak` now
|
|
129
|
-
assert VALUE-CORRECTNESS, not just resources: a single `Int32Array` shadow,
|
|
130
|
-
allocated ONCE before the loop, shadows every writable signal; a rotating fixed
|
|
131
|
-
window is checked per tick (no per-tick allocation) and a full sweep runs at
|
|
132
|
-
teardown; a mismatch exits 1 with the seed and index. The module-scoped int32
|
|
133
|
-
JIT sink replaces the former magic-constant "impossible" guard.
|
|
134
|
-
- **`test/30-throwing-equals.test.mjs`** -- a user `equals` that THROWS, pinned at
|
|
135
|
-
all five 1.9.0 sites: the three callable sites (signal set pre-check :1272, batch
|
|
136
|
-
revert :1279, computed re-eval :1143) with a CONTRAST anti-tautology test, and
|
|
137
|
-
the two `signalBox` `boxSet` sites (pre-check :1403, revert :1410).
|
|
138
|
-
|
|
139
|
-
### Changed -- introspect-torture forEachOwned pinned to an exact count
|
|
140
|
-
|
|
141
|
-
`introspect-torture` section 7 asserted `owned >= 2`; the owned count under one
|
|
142
|
-
scope owner (a computed + an effect) is DETERMINISTICALLY 2, so it is now pinned
|
|
143
|
-
`owned === 2`. No behavioural change -- a tightened assertion.
|
|
144
|
-
|
|
145
|
-
### Verified -- the whole superset runs natively on the 1.9.0 engine
|
|
146
|
-
|
|
147
|
-
`dispose`, `cleanup-return`, `owner`, `scope`, and `flush` all execute NATIVELY
|
|
148
|
-
here with zero feature-skips: 1.9.0 is the first engine to run the complete
|
|
149
|
-
torture superset.
|
|
150
|
-
|
|
151
|
-
- **Torture:** 22/22 -- `torture:semantic` 19/19 (all executed, zero skips),
|
|
152
|
-
`torture:soak` 3/3 (zero errors, value-oracle clean, every pool back to its
|
|
153
|
-
leaf-only floor).
|
|
154
|
-
- **Unit (`npm test`):** 512 tests, 511 pass, 0 fail, 1 skip.
|
|
155
|
-
- **Unit (`npm run test:gc`):** 520 tests, 519 pass, 0 fail, 1 skip.
|
|
156
|
-
|
|
157
|
-
## [1.9.0-preview.2] -- 2026-07-27
|
|
158
|
-
|
|
159
|
-
Rolls up the post-`1.9.0-preview` changes into the `preview.2` tag. The 1.9.0
|
|
160
|
-
feature (`using` / `Symbol.dispose` on lifecycle objects) ships in the preview and
|
|
161
|
-
is unchanged here; this cut adds two new torture scenarios from a consolidated
|
|
162
|
-
coverage audit, the crash fix inherited from the 1.8.0 base, 100% coverage, and
|
|
163
|
-
test-suite hygiene.
|
|
164
|
-
|
|
165
|
-
### Added -- torture suite reaches the zero-skip milestone (19 scenarios)
|
|
166
|
-
|
|
167
|
-
Two effects converge on the 1.9.0 engine. First, **`dispose-torture` now
|
|
168
|
-
executes**: 1.9.0 stamps `Symbol.dispose` at five sites (the registry -> destroy,
|
|
169
|
-
an effect's stop handle, a `createScope` disposer, a `createRoot` disposer, and
|
|
170
|
-
both box prototypes), so `using`-declared lifecycle objects dispose at block exit.
|
|
171
|
-
The scenario feature-detects via the box-prototype stamp and drives each site
|
|
172
|
-
through the TC39 `using` path, asserting idempotent disposal. Because it is a set
|
|
173
|
-
of stamped methods with **no new export**, it is exactly the profile the value /
|
|
174
|
-
introspection oracles cannot see. Second, the coverage audit added **two new
|
|
175
|
-
semantic scenarios** for exports no scenario exercised directly:
|
|
176
|
-
|
|
177
|
-
- **`owner-torture`** (1.6.0+) -- `getOwner` / `runWithOwner` capture-restore: the
|
|
178
|
-
gen-stamped owner handle, adoption of effects/computeds created inside
|
|
179
|
-
`runWithOwner`, and cascade-dispose when the captured owner is torn down.
|
|
180
|
-
- **`lifecycle-torture`** (createRoot 1.5.0+, destroy 1.4.0+) -- `createRoot`
|
|
181
|
-
detachment (an owned subtree that survives its enclosing scope) and the direct
|
|
182
|
-
`destroy` reset contract; `createRoot` had never been called by any scenario,
|
|
183
|
-
and `destroy` was only reached indirectly through a registry `Symbol.dispose`.
|
|
184
|
-
|
|
185
|
-
The suite is now **19 scenarios (16 semantic + 3 soak)**. On the 1.9.0 engine
|
|
186
|
-
**every semantic scenario executes -- zero feature-skips** -- the first engine
|
|
187
|
-
version to run the complete superset, since `dispose` was the last remaining
|
|
188
|
-
feature gate (box 1.5.0, scope/owner/introspect 1.6.0, flush 1.7.0,
|
|
189
|
-
cleanup-return 1.8.0, dispose 1.9.0 are all satisfied).
|
|
190
|
-
|
|
191
|
-
### Verified -- full suite green on the 1.9.0 engine (Node 22, `--expose-gc`)
|
|
192
|
-
|
|
193
|
-
- **Torture:** 19/19 -- `torture:semantic` 16/16 (all executed, zero skips),
|
|
194
|
-
`torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
|
|
195
|
-
- **Unit (plain run):** 499 tests, 479 pass, 0 fail, 1 skip (the architectural
|
|
196
|
-
SSR N/A in `17-reactivity`). The only non-passes are the 19 in
|
|
197
|
-
`test/25-devtools-real-boot`, the real-rig that requires the sibling
|
|
198
|
-
`@zakkster/lite-devtools`; with that sibling resolvable the suite is 498 pass +
|
|
199
|
-
1 skip. Engine-only, excluding `test/25`: 480 tests, 479 pass, 1 skip. (The c8
|
|
200
|
-
coverage run below reports a different count -- perf-smoke budgets skip under
|
|
201
|
-
instrumentation.)
|
|
202
|
-
|
|
203
|
-
### Changed -- bench protocol v3 (carried forward)
|
|
204
|
-
|
|
205
|
-
The `bench/` harness is bench protocol v3: three instruments (microscope / mirror /
|
|
206
|
-
version-economics), each with a fixed config and a machine-generated `#STAMP`
|
|
207
|
-
(engine + harness sha256, live registry config, host, node). The pre-v3
|
|
208
|
-
five-framework reactivity suite was removed after 1.5.1. See `bench/README.md`.
|
|
209
|
-
|
|
210
|
-
### Added -- Coveralls coverage badge
|
|
211
|
-
|
|
212
|
-
README carries a Coveralls badge; lcov is produced by `npm run test:report`
|
|
213
|
-
(`coveralls-next` in devDependencies).
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
### Fixed -- dangling re-tracking cursor on source disposal (crash)
|
|
217
|
-
|
|
218
|
-
Disposing a signal/computed from inside an observer that had linked it on the
|
|
219
|
-
previous run, but had not yet re-read it on the current run, crashed with
|
|
220
|
-
`TypeError: Cannot set properties of null (setting 'headSub')`. `disposeNode`'s
|
|
221
|
-
sub-list teardown freed the link while the observer's re-tracking cursor
|
|
222
|
-
(`activeObserverCurrentDep`) was still parked on it; `severTail` then walked from
|
|
223
|
-
a freed link, wiped the observer's `headDep`, and double-freed the link. Reachable
|
|
224
|
-
from the plain public API, inherited from the 1.8.0 base. Fixed with a one-line
|
|
225
|
-
cursor repair in `disposeNode`; the two dead `freeLink` `-1` ternaries were removed
|
|
226
|
-
with it. Pinned by a regression test in `test/12-coverage.test.mjs`.
|
|
227
|
-
|
|
228
|
-
### Changed -- coverage closed to 100% and test-suite hygiene
|
|
229
|
-
|
|
230
|
-
`Signal.js` reaches **100% statements / branches / functions / lines** (491 tests,
|
|
231
|
-
490 pass, 1 skip). Beyond the crash fix and its ported box/owner/opcode closure
|
|
232
|
-
suite, this pass added: a test for the new **`using` / `Symbol.dispose`** methods on
|
|
233
|
-
both box prototypes (`box[Symbol.dispose]()` disposes and is idempotent); and the
|
|
234
|
-
cleanup-return array-append arm (carried in via `33-cleanup-return`). Three provably
|
|
235
|
-
-unreachable arms carry `/* c8 ignore */` with proofs: the link-ledger clamp, the
|
|
236
|
-
`batchEpoch` 2^32 wraparound, and the `Symbol.dispose` pre-Node-20 polyfill fallback.
|
|
237
|
-
|
|
238
|
-
Test-suite hygiene: `33-computed-selfdirty-prev-owner.test.mjs` renamed to `34-`
|
|
239
|
-
(the `33-` slot belongs to `33-cleanup-return`, which carries forward from 1.8.0
|
|
240
|
-
because this line inherits effect cleanup-return) -- the rename had left a
|
|
241
|
-
byte-identical `33-` copy behind, so the scope suite's `28-`/`29-` pattern
|
|
242
|
-
repeated here; the stray `33-computed-selfdirty-prev-owner.test.mjs` is deleted,
|
|
243
|
-
leaving one `34-`. The duplicate `28-scope.test.mjs` was likewise dropped in
|
|
244
|
-
favour of `29-scope.test.mjs` (both were byte-identical).
|
|
245
|
-
|
|
246
|
-
**Hot-path parity note:** the fix touches `disposeNode` and `freeLink`; re-baseline
|
|
247
|
-
the VersionMatrix engine sha256 on the next publish.
|
|
7
|
+
## [1.10.0-preview] -- 2026-09-06
|
|
8
|
+
|
|
9
|
+
The **verification-infrastructure parity cut** for the named-nodes + `whyDirty()`
|
|
10
|
+
feature (introduced in the 1.10.0-canary entry below, unchanged in behaviour).
|
|
11
|
+
The engine is byte-identical to the canary past the version banner EXCEPT for two
|
|
12
|
+
cold-path fixes ported from the 1.9.0 line (see Fixed); the four hot propagation
|
|
13
|
+
bodies stay byte-identical to 1.9.0 (sha-proven, WHY-1_10.md). This cut brings the
|
|
14
|
+
full 1.9.0-alpha audit infrastructure onto the folder and re-proves it here.
|
|
15
|
+
|
|
16
|
+
### Fixed -- two cold-path ports from LiteSignal1.9.0 (user-authorized, one-time)
|
|
17
|
+
|
|
18
|
+
- **disposeNode cursor repair.** The folder's v1.10.0-canary.1 engine had FORKED
|
|
19
|
+
the rebuilt-1.9 line before this fix landed: disposing a linked-but-unread source
|
|
20
|
+
from an observer's own body mid-retrack left the re-tracking cursor
|
|
21
|
+
(`activeObserverCurrentDep`) dangling at a freed link, then crashed `severTail` /
|
|
22
|
+
`freeLink` with `Cannot set properties of null (setting 'headSub')`. Reproduced by
|
|
23
|
+
scope-torture (dispose-linked-unread) and all five cleanup-return 6b geometries.
|
|
24
|
+
Ported verbatim from 1.9.0: advance the cursor to the next surviving dep when the
|
|
25
|
+
parked link is freed. Disposal path only; no steady-state cost.
|
|
26
|
+
- **createRegistry validation (1.4.5 backport).** The canary also predated the
|
|
27
|
+
config-validation cascade the other five folders carry: `ALLOWED_KEYS` /
|
|
28
|
+
did-you-mean / eager-construction ceiling, plus the `nodePoolPopulation` /
|
|
29
|
+
`linkPoolPopulation` stats keys (`stats()` 12 -> 14). Its absence failed 37 unit
|
|
30
|
+
tests. Ported verbatim; all cold, constructor-only.
|
|
31
|
+
|
|
32
|
+
### Added -- the 27-scenario torture suite (was 22) + audit lanes
|
|
33
|
+
|
|
34
|
+
- The 2026-08 audit scenarios (`contract`, `interop`, `retrack-dispose`,
|
|
35
|
+
`burst-profile`, opt-in `wraparound`), the 3-state runner with ENFORCED floors,
|
|
36
|
+
and the flush/cleanup-return folder supersets. On this engine **all 23 semantic
|
|
37
|
+
execute with zero floor-skips** (as on 1.9.0 -- `dispose` was the last gate);
|
|
38
|
+
suite verdict 26 pass / 1 opt-in skip / 0 fail.
|
|
39
|
+
- `test/25` rewritten against the REAL devtools 1.6.2 (14 tests): the exact 13-key
|
|
40
|
+
`capabilities()` fingerprint (identical to the 1.8.0/1.9.0 pairings -- devtools
|
|
41
|
+
1.6.2 has no 1.9/1.10 cap key, so the exact key set is the pin). New
|
|
42
|
+
`test/37-devtools-zerogc-probe` (renumbered above the native `36-named-and-whydirty`).
|
|
43
|
+
- `test/zgc/` (`test:zgc` 7/7 + report 3/3), `test/ProfilerTests` (`test:hardening`
|
|
44
|
+
22/0/6), `harness/ProfilerTools` (`test:harness` 5/5), and the phase-1/2/3 harness
|
|
45
|
+
instruments (`visit-anatomy`, `jit-health`, `mint-anatomy`, `costmodel`, `floors`,
|
|
46
|
+
`trend`, `creation-anatomy`, `burst-real`); `harness/run.mjs` gains `mint`.
|
|
47
|
+
- VersionMatrix read+counter lanes; **gate-self PASSED 5/5** vs floor-1.3.0 +
|
|
48
|
+
rolling-1.5.0, counter lane exact (288 allocs/frame, 0 poolGrowths).
|
|
49
|
+
|
|
50
|
+
### Measured on this engine
|
|
51
|
+
|
|
52
|
+
- **Mint anatomy IDENTICAL for the sixth engine running**: signal 264.3 / computed
|
|
53
|
+
208.1 / effect 160.0 / signalBox 56.0 / computedBox 56.0 B/op all-space -- the cold
|
|
54
|
+
`nodeNames.set` on named creation is off the unnamed fast path.
|
|
55
|
+
- visit-anatomy 21/21 with NO re-anchor (named/whyDirty add no eq-dispatch site;
|
|
56
|
+
both failure paths re-witnessed in scratch clones). jit-health strict: 4x
|
|
57
|
+
monomorphic. Cleanup-return compose order, the wraparound band, and every
|
|
58
|
+
audit-era pin: carried with ZERO pin flips.
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- devDeps: `@zakkster/lite-devtools` ^1.2.0 -> **^1.6.2**,
|
|
63
|
+
`@zakkster/lite-gc-profiler` ^1.15.0 -> **^1.16.0**.
|
|
64
|
+
- `test` / `test:gc` / `test:coverage` glob-scoped to `'test/*.test.mjs'`; unit suite
|
|
65
|
+
**553 tests, 552 pass, 0 fail, 1 skip** (`test:gc` 561/560/0/1). `verify` chains the
|
|
66
|
+
zgc gate. Banner v1.10.0-canary.1 -> v1.10.0-preview.
|
|
67
|
+
- Signal.js line-ref comments (capacity / deep-chain / error / owner tortures, test/30)
|
|
68
|
+
refreshed against the ported engine.
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
|
|
72
|
+
- `test/33-computed-selfdirty-prev-owner.test.mjs` -- byte-identical duplicate of
|
|
73
|
+
`test/34-...` (sha `0f48d434`); its `33-` prefix collided with `33-cleanup-return`.
|
|
74
|
+
- The stale `bench-reactive` script and the llms `demo/index.html` +
|
|
75
|
+
"wired as prepublishOnly" claims (the gate is `npm run gate` -> `pre-publish.mjs`).
|
|
76
|
+
|
|
77
|
+
## [1.10.0-canary] -- 2026-07-XX (rebuilt line, candidate)
|
|
78
|
+
|
|
79
|
+
**Feature of the cut: named nodes + `whyDirty()` -- the tracing foundation.**
|
|
80
|
+
Two cold-path primitives the profiler tools (`lite-trace`, `lite-hud`,
|
|
81
|
+
`lite-devtools`) consume directly. No node-shape change; the pinned handle
|
|
82
|
+
shapes from `21-perf-pins` are untouched.
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
- `signal(v, {name})` / `computed(fn, {name})` / `effect(fn, {name})`. Names
|
|
86
|
+
live in a registry-side `Map<id, name>`, written only on named creation and
|
|
87
|
+
read only by `describeNode()` / `whyDirty()` (both cold). Unnamed nodes pay
|
|
88
|
+
a single guarded comparison on the creation path and carry no name key.
|
|
89
|
+
- `describe()` / `describeNode()` gain `name` when present (absent otherwise).
|
|
90
|
+
- `whyDirty(handle)` -- pull-side diagnostic. For a computed, walks its deps
|
|
91
|
+
and reports which one's version moved past the observer's `evalVersion`
|
|
92
|
+
(the SAME predicate `pullComputed` uses, `((dep.version - evalVer)|0) > 0`),
|
|
93
|
+
then traces transitively to the root signal write via `rootCause`. Read-only:
|
|
94
|
+
it never pulls, so it cannot perturb the graph. Returns `[]` for a clean
|
|
95
|
+
computed and for non-computed handles.
|
|
96
|
+
- `nodeNames` cleared by `destroy()`.
|
|
97
|
+
|
|
98
|
+
### Unchanged (proven, not asserted)
|
|
99
|
+
- Hot propagation bodies `markDownstream` / `flushEffects` / `executeEffect` /
|
|
100
|
+
`pullComputed` are **byte-identical** to 1.9.0 (sha256 over extracted bodies).
|
|
101
|
+
- Bars: `1to1batch` neutral (write path is the frozen set); `createSignals` /
|
|
102
|
+
`createEffects` within noise (the name comparison on the unnamed path is free).
|
|
248
103
|
|
|
249
104
|
## [1.9.0-preview] -- 2026-07-XX (rebuilt line, candidate)
|
|
250
105
|
|
|
@@ -438,7 +293,7 @@ run variance; the sha256 verification rules out any other mechanism.
|
|
|
438
293
|
- **`test/28-run-with-owner.test.mjs`** (16 tests, cascade-forwarded):
|
|
439
294
|
basic shape, degradation, and the three hazard pins with allocation
|
|
440
295
|
pressure applied so the ABA guard is actually exercised.
|
|
441
|
-
- **New: `test/
|
|
296
|
+
- **New: `test/33-computed-selfdirty-prev-owner.test.mjs`** -- a single
|
|
442
297
|
self-gating discriminator covering three feature bands:
|
|
443
298
|
- **`getOwner / runWithOwner`** -- **ACTIVE on 1.9.0** (owner APIs
|
|
444
299
|
are present via the cascade port). All 5 tests pass: `getOwner`
|
|
@@ -463,13 +318,11 @@ run variance; the sha256 verification rules out any other mechanism.
|
|
|
463
318
|
assertion from 1.6/1.7/1.8 (adds `flushPasses`).
|
|
464
319
|
|
|
465
320
|
**Note on the test file name convention:** the uploaded discriminator
|
|
466
|
-
file used `33-computed-selfdirty-prev-owner_test.mjs` (underscore
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
to avoid colliding with `33-cleanup-return.test.mjs`, which carries forward
|
|
472
|
-
from 1.8.0 since this line inherits the effect cleanup-return feature.
|
|
321
|
+
file used `33-computed-selfdirty-prev-owner_test.mjs` (underscore);
|
|
322
|
+
renamed to `.test.mjs` (period) in the delivered tree to match the
|
|
323
|
+
ecosystem-wide convention (`NN-name.test.mjs`) and pick up the standard
|
|
324
|
+
`test/*.test.mjs` glob. `_test.mjs` would be silently ignored by
|
|
325
|
+
`node --test`.
|
|
473
326
|
|
|
474
327
|
### The rebuilt-line rejection ledger (context for what does NOT ship)
|
|
475
328
|
|
|
@@ -561,80 +414,6 @@ twins (see the 1.12.0-preview trace-twin design).
|
|
|
561
414
|
between `createRoot` and `createScope`; sha256 confirms no
|
|
562
415
|
pre-existing function was disturbed by the insertion.
|
|
563
416
|
|
|
564
|
-
### Verified -- fresh 1.9.0-preview bench sweep (Apple M4 Pro / Node 26)
|
|
565
|
-
|
|
566
|
-
Both v3 instruments were re-run in full on the 1.9.0-preview engine on
|
|
567
|
-
**Apple M4 Pro darwin/arm64, Node 26.3.1**, with `#STAMP`-verified
|
|
568
|
-
outputs committed to `bench/r.txt` (microscope aggregate, 4 engines
|
|
569
|
-
across the six first-party shapes) and `bench/rb.txt` (mirror sweep,
|
|
570
|
-
Andrii's canonical adapter verbatim, lite vs alien across 47 rows,
|
|
571
|
-
isolated-per-row, 10 reps). Andrii 15-framework log at
|
|
572
|
-
`bench/AndriiVolynetsReactiveBench.log` (byte-identical to 1.8.0's --
|
|
573
|
-
the 1.9.0-preview engine is sha256-identical to 1.8.0 on all 14
|
|
574
|
-
propagation / flush-scaffold functions and differs only in `effect` and
|
|
575
|
-
`createScope` by one existence-guarded `[Symbol.dispose]` stamp line
|
|
576
|
-
each on the cold creation path, so the ranking numbers carry with zero
|
|
577
|
-
re-verification cost).
|
|
578
|
-
|
|
579
|
-
- **Andrii Volynets js-reactivity-benchmark position holds at 3rd of
|
|
580
|
-
15** (the position lite moved to on 1.8.0) with geomean **95.4 ms**;
|
|
581
|
-
lite is ahead of 4th-place @reactively (136.0, lite 1.43x faster) and
|
|
582
|
-
5th-place Preact Signals (148.8, ~56% ahead), behind only
|
|
583
|
-
alien-signals (77.5) and reflex (89.7). **20 outright wins** (the
|
|
584
|
-
eight canonical propagation shapes, all four wide fan-in / fan-out
|
|
585
|
-
shapes, `molBench`, and seven of the rectangular / layered DAG
|
|
586
|
-
shapes). Top-3 count: **29/47**. Since the engine is sha256-identical
|
|
587
|
-
to 1.8.0 across every propagation function, this is the same log
|
|
588
|
-
1.8.0 published; re-running Andrii's suite would produce host-noise
|
|
589
|
-
drift, not a code-driven delta.
|
|
590
|
-
- **Microscope aggregate on M4 Pro (r.txt):** on the six v3 microscope
|
|
591
|
-
shapes, lite wins vs alien on **MUX +34.9%** (fan-in), **SELECTIVE
|
|
592
|
-
DAG +20.9%**, **DYNAMIC DAG +16.1%**, and **BROADCAST +5.2%**
|
|
593
|
-
(narrowed from +9.4% on 1.8.0 but still on the win side of parity).
|
|
594
|
-
The wins hold within noise of the 1.8.0 M4 Pro sweep despite the two
|
|
595
|
-
`[Symbol.dispose]` stamp lines added at effect / createScope
|
|
596
|
-
creation, which is what "one existence guard per cold creation path,
|
|
597
|
-
nothing on the propagation hot path" looks like in the propagation
|
|
598
|
-
numbers. Alien ahead on **KAIROS -19.5%** (widened from -15.9% on
|
|
599
|
-
1.8.0 -- host-noise drift on the shape where lite is architecturally
|
|
600
|
-
weakest) and **DEEP CHAIN -72.8%** (the architectural weak spot:
|
|
601
|
-
recursive JS-stack computed resolution against alien's flatter
|
|
602
|
-
chain). Speed wins vs alien: **4/6**; heap wins: **5/6** with the
|
|
603
|
-
sixth being a shared-zero on BROADCAST.
|
|
604
|
-
- **Microscope heap (the actual story) on M4 Pro:** on every shape
|
|
605
|
-
where GC pressure exists at all, lite allocates **one to four orders
|
|
606
|
-
of magnitude less transient heap than alien** -- DEEP CHAIN 0.5 KB vs
|
|
607
|
-
1062 KB (>2000x, on the shape lite loses on time), MUX 0 KB vs 781
|
|
608
|
-
KB, KAIROS 23 KB vs 802 KB (34.3x), DYNAMIC DAG 3.4 MB vs 55.7 MB
|
|
609
|
-
(16.6x), SELECTIVE DAG 7.7 MB vs 76.5 MB (9.9x). Against
|
|
610
|
-
preact-signals and solid-signals the heap gap is even wider on the
|
|
611
|
-
fan-in / fan-out family; solid allocates ~17 MB on MUX and ~15 MB on
|
|
612
|
-
SELECTIVE DAG where lite allocates 0 KB and 7.7 MB on the same
|
|
613
|
-
shapes. The differentiated position is ALLOCATION, not raw
|
|
614
|
-
propagation speed -- competitive-to-winning throughput with
|
|
615
|
-
dramatically lower GC pressure, and that is the headline that
|
|
616
|
-
reproduces across hosts.
|
|
617
|
-
- **Mirror sweep on M4 Pro (rb.txt):** Andrii's canonical 47-shape
|
|
618
|
-
suite re-run isolated-per-row lite vs alien on M4 Pro reproduces the
|
|
619
|
-
same honest framing: lite runs **parity-to-behind alien on
|
|
620
|
-
throughput** across the head-to-head suite (wins outright on **3/47**
|
|
621
|
-
-- `1000x5 - 25 sources (wide dense)` +10.7%,
|
|
622
|
-
`manySourcesIntoOneComputedEffectWithDirect` +31.5%,
|
|
623
|
-
`manySourcesIntoOneComputedEffect` +30.2%; `molBench` dropped from a
|
|
624
|
-
razor-thin +0.3% win on 1.8.0 to -0.4% parity this sweep, taking the
|
|
625
|
-
outright-win count from 4/47 to 3/47), weak on the deep/layered-burst
|
|
626
|
-
family. That head-to-head result and the "3rd of 15 with 20 outright
|
|
627
|
-
wins" both live on the same Andrii log and are not contradictory: the
|
|
628
|
-
outright-of-15 rankings look at each shape across every framework in
|
|
629
|
-
the field, so shapes where alien beats lite by 20-30% but reflex
|
|
630
|
-
beats both and everyone else is slower can still count as a lite
|
|
631
|
-
outright win when measured that way.
|
|
632
|
-
- **Third-party engine versions carried forward** from the 1.8.0 sweep
|
|
633
|
-
(alien-signals 3.2.1, @preact/signals-core 1.14.2, @vue/reactivity
|
|
634
|
-
3.5.35, solid-js 1.9.13). No peer bumps this cycle; the deltas here
|
|
635
|
-
are the 1.9 engine's own footprint (the two `[Symbol.dispose]` stamp
|
|
636
|
-
lines) plus host noise.
|
|
637
|
-
|
|
638
417
|
### Migration
|
|
639
418
|
|
|
640
419
|
Zero work for every existing user. Symbol.dispose is additive; nothing
|
|
@@ -652,6 +431,8 @@ cascade forward from every prior 1.x line without semantic change.
|
|
|
652
431
|
|
|
653
432
|
## [1.8.0-preview] -- 2026-07-XX
|
|
654
433
|
|
|
434
|
+
## [1.8.0-preview] -- 2026-07-XX
|
|
435
|
+
|
|
655
436
|
The **effect cleanup return** minor -- Reflex-study pattern A. One additive
|
|
656
437
|
hot-path change: an effect body may now `return` a cleanup function, which
|
|
657
438
|
runs before the next re-run and on dispose, composing with imperative
|
|
@@ -950,9 +731,9 @@ monomorphic targets and inlines the body. In "eager" mode the inlined body is
|
|
|
950
731
|
byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
|
|
951
732
|
-- **zero behavioral or performance regression** for any existing user.
|
|
952
733
|
|
|
953
|
-
This is NOT ledger
|
|
734
|
+
This is NOT ledger §0b #6 (per-call closure-var load of a primitive). It is a
|
|
954
735
|
hoisted function reference resolved once at registry build time and is a NEW
|
|
955
|
-
mechanism by the v1 roadmap
|
|
736
|
+
mechanism by the v1 roadmap §0b line 100 definition.
|
|
956
737
|
|
|
957
738
|
The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
|
|
958
739
|
hot path. sha256 over the extracted function bodies of `pullComputed`,
|
|
@@ -997,7 +778,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
|
|
|
997
778
|
|
|
998
779
|
Real wins, but smaller than the gap to Reflex on the same shapes. The residual
|
|
999
780
|
gap is structural (per-write `gen` check, batch-revert epoch tracking, global
|
|
1000
|
-
version bumping) -- design decisions accepted by
|
|
781
|
+
version bumping) -- design decisions accepted by §0b and not in scope here.
|
|
1001
782
|
Modern V8's `try/finally` elision varies; expect higher absolute speedups on
|
|
1002
783
|
production V8 than on this sandbox.
|
|
1003
784
|
|
|
@@ -1137,7 +918,7 @@ they produce are reproducible, comparable, and engine-version-aware.
|
|
|
1137
918
|
|
|
1138
919
|
- **Full suite green** against the 1.6.0 engine: 443 tests, 442 pass, 0 fail,
|
|
1139
920
|
1 skip (only the architecturally-N/A SSR case in `17-reactivity`). +4
|
|
1140
|
-
`createScope` tests in `test/
|
|
921
|
+
`createScope` tests in `test/28-scope_test.mjs`; the 1.5.0 box and createRoot
|
|
1141
922
|
suites carry forward unchanged. **Coverage** (c8@11, Node 22): `Signal.js`
|
|
1142
923
|
100% statements / 96.96% branches / 100% functions / 100% lines; `Watch.js`
|
|
1143
924
|
100% across all four. The branch drop vs 1.5.0 (97.35% -> 96.96%) is the
|
|
@@ -1222,7 +1003,7 @@ dependency and updates correctly; a `computedBox` that reads a callable
|
|
|
1222
1003
|
the introspection surface all apply uniformly -- a box node is indistinguishable
|
|
1223
1004
|
from a callable node to the graph, the owner tree, and devtools.
|
|
1224
1005
|
|
|
1225
|
-
### Added -- `test/24-
|
|
1006
|
+
### Added -- `test/24-signalbox_test.mjs` activated (9 tests)
|
|
1226
1007
|
|
|
1227
1008
|
The suite that was committed-but-skipped since 1.3.0 now runs against the real
|
|
1228
1009
|
implementation: box get/set/peek/update, computedBox derive + memoize,
|
|
@@ -1269,7 +1050,7 @@ survives consumer re-runs.
|
|
|
1269
1050
|
- **Full suite green** against the 1.5.0 engine: 439 tests, 438 pass, 0 fail,
|
|
1270
1051
|
1 skip (only the architecturally-N/A SSR case in `17-reactivity`; the 9
|
|
1271
1052
|
`24-signalbox` tests are now active, +6 `createRoot` tests in
|
|
1272
|
-
`test/27-create-
|
|
1053
|
+
`test/27-create-root_test.mjs`, +3 box-coverage tests). **Coverage** (c8@11,
|
|
1273
1054
|
Node 22): `Signal.js` 100% statements / 97.35% branches / 100% functions / 100%
|
|
1274
1055
|
lines; `Watch.js` 100% across all four.
|
|
1275
1056
|
- **Box hot path is zero-GC**: 200,000 writes through a 256-wide box graph,
|
|
@@ -1504,7 +1285,7 @@ What `createNode` still writes are the *lifetime* writes for the new resident:
|
|
|
1504
1285
|
the new lifetime), plus the conditional owner-adoption splice
|
|
1505
1286
|
(`owner`, `nextOwned`, parent chain link).
|
|
1506
1287
|
|
|
1507
|
-
### Added -- `test/10-free-list-
|
|
1288
|
+
### Added -- `test/10-free-list-invariant_test.mjs`
|
|
1508
1289
|
|
|
1509
1290
|
A three-test invariant suite that asserts the audit's claim by inspecting
|
|
1510
1291
|
freshly-allocated nodes' underlying field state (via the documented
|
|
@@ -1522,7 +1303,7 @@ If any future change reintroduces a write to a clean-state field on the
|
|
|
1522
1303
|
dispose path or removes a write that turns out NOT to be redundant, this
|
|
1523
1304
|
suite catches it.
|
|
1524
1305
|
|
|
1525
|
-
### Added -- `test/11-devtools-
|
|
1306
|
+
### Added -- `test/11-devtools-contract_test.mjs`
|
|
1526
1307
|
|
|
1527
1308
|
A 12-test smoke probe of the introspection surface that lite-devtools 1.1 /
|
|
1528
1309
|
lite-studio 1.1 consume. Verifies handle resolution + walkers, owner-tree
|
|
@@ -1869,7 +1650,7 @@ over 1.1.4, no breaking changes.
|
|
|
1869
1650
|
shape kept uniform (monomorphic). **Zero steady-state cost.**
|
|
1870
1651
|
|
|
1871
1652
|
### Test suite
|
|
1872
|
-
- Added `test/15-
|
|
1653
|
+
- Added `test/15-identity_test.mjs`: 5 tests -- ids unique + stable, `nodeId`/`describe`
|
|
1873
1654
|
undefined on non-handles, descriptor shape `{ id, kind, value }`, descriptors re-walkable,
|
|
1874
1655
|
identity walks non-perturbing.
|
|
1875
1656
|
|
|
@@ -1921,7 +1702,7 @@ All accept a public `Signal`/`Computed` handle.
|
|
|
1921
1702
|
on a non-handle argument; `observeObservers` throws `TypeError`.
|
|
1922
1703
|
|
|
1923
1704
|
### Test suite
|
|
1924
|
-
- Added `test/13-
|
|
1705
|
+
- Added `test/13-introspection_test.mjs`: 10 tests across 3 describe blocks --
|
|
1925
1706
|
`hasObservers` (live observation reflects, peek doesn't count), `observeObservers`
|
|
1926
1707
|
auto-pause lifecycle (start-on-first/stop-on-last, no extra connect for a 2nd
|
|
1927
1708
|
observer, re-observe fires again, no churn on re-track, conditional reads toggle
|
|
@@ -1965,7 +1746,7 @@ allocation on whether the read will actually subscribe anything.
|
|
|
1965
1746
|
Roughly 1-2 ns per call.
|
|
1966
1747
|
|
|
1967
1748
|
### Test suite
|
|
1968
|
-
- Added `test/10-is-
|
|
1749
|
+
- Added `test/10-is-tracking_test.mjs`: 11 tests across 5 describe blocks --
|
|
1969
1750
|
observer-bodies (effect + computed), untracked windows (`untrack`, `subscribe`
|
|
1970
1751
|
callback, `onCleanup`, `watch` callback), outside-observer (module scope,
|
|
1971
1752
|
call-site of unobserved computed read), robustness (state restored after
|
package/README.md
CHANGED
|
@@ -459,6 +459,22 @@ The 1.2.0 owner tree makes the engine recycle pool slots autonomously: when an e
|
|
|
459
459
|
|
|
460
460
|
Descriptors returned by `describe()` and the `forEach*` walkers are themselves gen-stamped, so the documented "descriptors are re-walkable handles" contract survives the guard: a fresh descriptor walks, one held across a recycle correctly goes stale.
|
|
461
461
|
|
|
462
|
+
### Named nodes + `whyDirty` (1.10.0)
|
|
463
|
+
|
|
464
|
+
Two cold-path diagnostics the profilers consume directly. Both are read-only and cost nothing when you don't ask -- the hot propagation bodies are byte-identical to 1.9.0.
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
const hp = signal(100, { name: "hp" }); // {name} on signal / computed / effect
|
|
468
|
+
const shield = computed(() => hp() > 0, { name: "alive" });
|
|
469
|
+
describe(hp).name; // "hp" (absent for unnamed nodes)
|
|
470
|
+
|
|
471
|
+
hp.set(80);
|
|
472
|
+
whyDirty(shield); // [ { id, kind: "signal", name: "hp", value: 80 } ]
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
- **Named nodes.** `signal(v, {name})`, `computed(fn, {name})`, `effect(fn, {name})`. The name lives in a registry-side `Map<id, name>` populated **only** when you pass one -- no field is added to the node, so the `21-perf-pins` handle shapes (signal 6 own props, computed 4) are unchanged and unnamed nodes pay nothing. `describe()` / `describeNode()` gain `name` when present; devtools and the profilers render `hp` instead of `#412`.
|
|
476
|
+
- **`whyDirty(handle)`.** The pull-side answer to "why will this recompute / why did this fire". For a computed it walks the deps and returns each one whose version moved past the observer's `evalVersion` -- the **exact** predicate `pullComputed` runs (`((dep.version - evalVer) | 0) > 0`, modular, not `!==`) -- and traces transitively to the underlying signal write as `rootCause`. It **never pulls**, so it cannot recompute anything or move the clock it is describing; it allocates freely, as a diagnostic on your cold path the engine never invokes. Empty for a clean computed and for non-computeds.
|
|
477
|
+
|
|
462
478
|
### onGraphMutation (1.2.1)
|
|
463
479
|
|
|
464
480
|
```ts
|
|
@@ -813,9 +829,9 @@ Three tiers, all reproducible.
|
|
|
813
829
|
|
|
814
830
|
### Tier 1 -- Behavior (unit tests, fast)
|
|
815
831
|
|
|
816
|
-
On the 1.
|
|
817
|
-
`npm run test:gc` (Tier 2, `--expose-gc`) reports **
|
|
818
|
-
skip**. `npm test` runs the suite in `test/`, covering:
|
|
832
|
+
On the 1.10.0 engine `npm test` reports **553 tests, 552 pass, 0 fail, 1 skip**, and
|
|
833
|
+
`npm run test:gc` (Tier 2, `--expose-gc`) reports **561 tests, 560 pass, 0 fail, 1
|
|
834
|
+
skip**. `npm test` runs the glob-scoped suite in `test/`, covering:
|
|
819
835
|
|
|
820
836
|
- **`01-core.test.mjs`** -- signal/computed/effect basics, equality semantics, NaN/+/-0, subscribe/peek/update, untrack, batch, cleanup ordering, first-run error recovery, nested object reference-identity gotchas.
|
|
821
837
|
- **`02-topology.test.mjs`** -- diamond glitch-freedom, 256-deep and 1024-deep computed chains, wide fan-out (1000 effects from one signal), dynamic dependency switching, conditional fan-out, nested effects, cycle detection (`CycleError`).
|
|
@@ -842,9 +858,14 @@ skip**. `npm test` runs the suite in `test/`, covering:
|
|
|
842
858
|
- **`24-signalbox.test.mjs`** -- the `signalBox` / `computedBox` allocation-light handle API, **activated in 1.5.0** (committed `{skip:true}` since 1.3.0, now running against the real implementation). 12 tests: box get/set/peek/update, `computedBox` derive + memoize, peek-does-not-track, subscribe fires-and-untracks, box<->callable interop both directions, batch coalescing (including set-then-revert net no-op), dispose with ABA-safety, the `equals` short-circuit, `computedBox.peek`, and the top-level helpers bound to the default registry.
|
|
843
859
|
- **`27-create-root.test.mjs`** -- `createRoot` (1.5.0), the ownership escape hatch. A watcher spawned inside a consumer effect via `createRoot` survives the consumer's re-run (the exact `lite-query` lazy-watcher pattern); the contrast case confirms an *unwrapped* spawn is cascade-disposed; `createRoot` returns `fn`'s value, detaches tracking in `fn`'s direct body while inner effect bodies still track, and composes with box handles. 7 tests, including a top-level-export binding case that closes the otherwise-uncovered top-level `createRoot` path.
|
|
844
860
|
- **`29-scope.test.mjs`** -- `createScope` (1.6.0), the adopting counterpart to `createRoot`. 4 tests: the scope owner runs exactly once on creation; direct-body signal reads in `fn` are untracked while inner effect/computed bodies track normally; `dispose()` cascade-disposes the owned subtree (effects + computeds) while a directly-allocated signal correctly survives (the engine never owner-adopts signals); a scope created inside a consumer effect SURVIVES that consumer's re-run -- the reconciler-critical detach property; `dispose()` is idempotent; the disposer is introspection-stamped to its owner effect (`describe(dispose).kind === "effect"`); and `totalAllocations - totalDisposals === activeNodes` holds across the entire lifecycle.
|
|
845
|
-
- **`25-devtools-real-boot.test.mjs`** --
|
|
861
|
+
- **`25-devtools-real-boot.test.mjs`** -- the devtools pairing contract (14 tests). Boots the REAL installed `@zakkster/lite-devtools` 1.6.2 against this engine through an import-rewrite rig (both share ONE engine instance -- the rig catches the two-instance failure mode where the package resolves to the published build instead of the local engine). Pins the live-probed ground truth: all 22 function exports + the `VERSION` const, the EXACT 13-key `capabilities()` fingerprint (1.5 through 1.8 all true, `statsKeys: 14` -- devtools 1.6.2 has no 1.9 or 1.10 cap key, so the exact key set is itself the pin), the `burstProfile()` live-handle and `stop()` summary shapes, and the 1.6.x `Symbol.dispose` stamps on devtools' own stopper handles.
|
|
846
862
|
- **`26-free-list-invariant.test.mjs`** -- the 1.2.2 audit's cleanliness pins (3 invariant tests + 1 targeted coverage test). Asserts directly -- by inspecting freshly-allocated nodes through the documented `describe()` -> `NODE_PTR` introspection protocol -- that the `ReactiveNode` constructor and the fresh-pool-growth path initialize the ten fields the audit removed from `createNode` to identical values, so the deleted writes were defending against a state the engine cannot produce on a clean free list. The 4th test covers the swallow-on-self-dispose-then-throw branch in `pullComputed` (the path that lifted branch coverage from 98.07% to 98.43%).
|
|
847
|
-
- **`30-throwing-equals.test.mjs`** -- a user `equals` that THROWS, pinned at all five 1.
|
|
863
|
+
- **`30-throwing-equals.test.mjs`** -- a user `equals` that THROWS, pinned at all five 1.10.0 invocation sites (9 tests): the three callable sites (signal set pre-check, batch revert, computed re-eval -- with a CONTRAST anti-tautology test proving the batch-revert pin is caused by the throw, not the set-then-back shape) and the two `signalBox` `boxSet` sites (pre-check leaves the box unmutated; batch-revert strands the version bump so the net value fires downstream).
|
|
864
|
+
- **`33-cleanup-return.test.mjs`** -- the 1.8.0 effect cleanup-return contract at unit grain (7 tests): timing (fires before re-run + on dispose), compose order with `onCleanup`, non-function returns ignored, the computed exclusion.
|
|
865
|
+
- **`34-computed-selfdirty-prev-owner.test.mjs`** -- forward-compat suite for the roadmap 1.10.x+ surface (11 tests): `computed(fn(prev), {initial})` and the gen-guarded owner APIs, feature-discriminated so legacy engines degrade cleanly; plus the DELIBERATE #179/#15 absorption pin (a computed writing its own tracked dep ABSORBS) that holds on every 1.x engine.
|
|
866
|
+
- **`35-config-validation.test.mjs`** -- the 1.4.5 `createRegistry` validation matrix on the 6-key config family incl `flushStrategy` (13 tests): per-option `TypeError`s, did-you-mean hints, the eager-construction ceiling, the two pool-population stats keys, and OOM rows spawned as child processes under a 256 MB cap via `35-config-oom.child.mjs`.
|
|
867
|
+
- **`36-named-and-whydirty.test.mjs`** -- the 1.10.0 discriminator (6 tests): `signal(v, {name})` / `computed` / `effect` names surface in `describe().name` (and are absent for unnamed nodes -- zero node-shape change); `whyDirty(computed)` returns EXACTLY the dep whose version moved past the observer's `evalVersion` (never the whole dep set -- the rejected-sketch bug), traces transitively to the root signal write, and is read-only (a `whyDirty` call never pulls, so it cannot perturb the clock it describes).
|
|
868
|
+
- **`37-devtools-zerogc-probe.test.mjs`** -- the zero-GC claim on the reactive-benchmark weak-group shapes (5 tests), through both the engine's `stats().poolGrowths` counter and devtools 1.6.2's `watchAllocations()` feed: the pool never grows its backing store (`poolGrowths` delta == 0).
|
|
848
869
|
|
|
849
870
|
```bash
|
|
850
871
|
npm test
|
|
@@ -875,13 +896,17 @@ npm run bench
|
|
|
875
896
|
|
|
876
897
|
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
877
898
|
|
|
878
|
-
`bench/torture/` holds the complete **
|
|
879
|
-
behind one runner (`run.mjs`)
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
899
|
+
`bench/torture/` holds the complete **27-scenario superset (23 semantic + 4
|
|
900
|
+
soak, one opt-in)** behind one runner (`run.mjs`), the forward-compatible set
|
|
901
|
+
through 1.9. They are not perf benchmarks: the ops/sec figures reflect random
|
|
902
|
+
workload composition, not engine throughput -- `bench/benchmark.mjs` remains the
|
|
903
|
+
canonical perf harness. Every scenario feature-detects and **skips cleanly**
|
|
904
|
+
(exit 77) below the engine version that introduces its feature, and the runner
|
|
905
|
+
**enforces the floors**: a scenario that skips while the engine is at or above
|
|
906
|
+
its floor FAILS the run -- a dropped export cannot masquerade as a green skip.
|
|
907
|
+
On the **1.10.0 engine all 23 semantic scenarios execute with zero
|
|
908
|
+
feature-skips** -- the first engine version to run the complete superset, since
|
|
909
|
+
`dispose` was the last gate.
|
|
885
910
|
|
|
886
911
|
```bash
|
|
887
912
|
npm run torture # everything
|
|
@@ -892,7 +917,12 @@ node bench/torture/run.mjs --list
|
|
|
892
917
|
|
|
893
918
|
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
894
919
|
|
|
895
|
-
Run these on every commit.
|
|
920
|
+
Run these on every commit. Most scenarios run on any 1.4.x+ engine;
|
|
921
|
+
`box-torture`, `owner-torture` and `lifecycle-torture` (1.5.0),
|
|
922
|
+
`scope-torture` / `introspect-torture` / `burst-profile-torture` (1.6.0),
|
|
923
|
+
`flush-torture` (1.7.0), `cleanup-return-torture` (1.8.0), and
|
|
924
|
+
`dispose-torture` (1.9.0) all run here because their features exist --
|
|
925
|
+
nothing floor-skips on this engine.
|
|
896
926
|
|
|
897
927
|
| scenario | pins |
|
|
898
928
|
| -------- | ---- |
|
|
@@ -900,19 +930,23 @@ Run these on every commit.
|
|
|
900
930
|
| `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
|
|
901
931
|
| `work-accounting` | minimum body-execution counts across 10 fixed topologies |
|
|
902
932
|
| `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
|
|
933
|
+
| `burst-profile-torture` (1.6.0) | the op-6/op-7 burst lane: batched write-bursts coalesce to exactly 1.0x (zero redundant recomputes) visible BEFORE any body runs, D-stage cascades drain in exactly D passes, self-write stays one pass; `BURST_BREAK=drop7\|ghost6` self-tests prove the pins fire |
|
|
903
934
|
| `introspect-torture` (1.6.0) | the read-only introspection surface: walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors |
|
|
904
935
|
| `concurrent-storm` | eight reentrancy and flush-ordering contracts |
|
|
905
936
|
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
906
937
|
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
907
938
|
| `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, pool balance over 200 rounds |
|
|
908
|
-
| `
|
|
939
|
+
| `retrack-dispose-torture` | dispose-during-retracking: the cursor hazard the 1.8 severTail repair targets, driven as a seeded fuzz across cursor positions with a survivor value + pool oracle |
|
|
940
|
+
| `owner-torture` (1.5.0) | `getOwner`/`runWithOwner` capture-restore: the gen-stamped owner handle, adoption of nodes created inside `runWithOwner`, cascade-dispose when the captured owner is torn down, ABA degradation to rooted execution under allocation pressure |
|
|
909
941
|
| `lifecycle-torture` | `createRoot` (1.5.0+) detachment of an owned subtree, and the direct `destroy` (1.4.0+) reset contract -- both previously unexercised by any scenario |
|
|
910
942
|
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
911
943
|
| `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary, and the 16x link grow ceiling (`maxLinks * 16`) that fails closed too |
|
|
912
944
|
| `error-torture` | throwing effect bodies under flush: a single throw re-thrown unwrapped, 2+ aggregated into an `AggregateError` carrying exactly those errors, the survivor still runs, and the error buffer drains to baseline over 4096 throw/clean cycles |
|
|
945
|
+
| `contract-torture` | the probed behavioural contract, pinned: write-inside-computed staleness, throw-in-batch flush semantics (commit + flush on abnormal exit, revert honored, no wedge), stranded scheduler thunks, equals-under-churn vs a shadow model, and `flushPasses` exact counts on the abnormal paths |
|
|
946
|
+
| `interop-torture` | multi-registry isolation (value flows, tracking never links, batches don't cross, the foreign-dispose contract both ways) + `destroy()` staleness with a 20k-op hammer |
|
|
913
947
|
| `deep-chain-torture` | `pullComputed` recursion fails closed with a `RangeError` at a ramped depth (<= 100000) while the heap-iterative effect-cascade push path stays open at the same depth |
|
|
914
948
|
| `flush-torture` (1.7.0) | the three `flushStrategy` modes by cross-strategy differential, per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each |
|
|
915
|
-
| `cleanup-return-torture` (1.8.0) | an effect's returned cleanup: timing at re-run/dispose, compose order after `onCleanup`, the self-dispose guard, and the computed exclusion |
|
|
949
|
+
| `cleanup-return-torture` (1.8.0) | an effect's returned cleanup: timing at re-run/dispose, compose order after `onCleanup`, the self-dispose guard, and the computed exclusion; plus the 1.8 severTail cursor-repair pinned by mechanism (five named dispose-mid-retrack geometries, section 6b) |
|
|
916
950
|
| `dispose-torture` (1.9.0) | `Symbol.dispose` stamped at five sites (registry, effect stop handle, scope/root disposers, both box prototypes) driven through the TC39 `using` path; idempotent disposal, feature-detected via the box-prototype stamp |
|
|
917
951
|
| `zerogc-torture` | the zero-GC claim as a gate via `@zakkster/lite-gc-profiler`: `measureAllocs`/`checkAllocs` at `maxBytesPerCall: 0` + `measureOps`/`checkNoGc` at `maxMajor: 0`/`maxPauseMs: 2` + `stats()` deltas over steady + create/dispose churn (callable and `signalBox`); `ZEROGC_BREAK=1` self-tests that the gate rejects a planted allocation |
|
|
918
952
|
|
|
@@ -921,8 +955,9 @@ Run these on every commit.
|
|
|
921
955
|
Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
|
|
922
956
|
and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
|
|
923
957
|
effect rewires, nested-batch + untrack reads, and microtask-scheduled async
|
|
924
|
-
flushes -- for 5-10 seconds
|
|
925
|
-
|
|
958
|
+
flushes -- for 5-10 seconds; a fourth, opt-in soak spins the 32-bit version
|
|
959
|
+
counter across the full 2^31 dormancy band. What they assert, with a non-zero
|
|
960
|
+
exit code on failure:
|
|
926
961
|
|
|
927
962
|
- zero thrown exceptions during the run,
|
|
928
963
|
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn),
|
|
@@ -933,18 +968,19 @@ failure:
|
|
|
933
968
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
|
934
969
|
node --expose-gc bench/torture/torture-soak.mjs # 5s high-volume churn, 7500 nodes
|
|
935
970
|
node --expose-gc bench/torture/scheduler-bench.mjs # 10s microtask-scheduled, 3300 nodes
|
|
971
|
+
TORTURE_WRAPAROUND=1 node bench/torture/wraparound-torture.mjs # ~50s full-distance 2^31 dormancy-band soak (opt-in)
|
|
936
972
|
```
|
|
937
973
|
|
|
938
974
|
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):
|
|
939
975
|
|
|
940
976
|
| | duration | ops | errors | post-teardown nodes / links |
|
|
941
977
|
| --------------------- | --------:| --------:| ------:| --------------------------- |
|
|
942
|
-
| graph-fuzzer | 10 s |
|
|
943
|
-
| torture-soak | 5 s |
|
|
944
|
-
| scheduler-bench | 10 s |
|
|
978
|
+
| graph-fuzzer | 10 s | 20.2 M | 0 | 500 / 0 |
|
|
979
|
+
| torture-soak | 5 s | 3.3 M | 0 | 2500 / 0 |
|
|
980
|
+
| scheduler-bench | 10 s | 63.1 M | 0 | 1000 / 0 |
|
|
945
981
|
|
|
946
982
|
```bash
|
|
947
|
-
npm run verify # test +
|
|
983
|
+
npm run verify # test + the zgc gate + harness smoke + a sanity bench
|
|
948
984
|
```
|
|
949
985
|
|
|
950
986
|
---
|
package/Signal.d.ts
CHANGED
|
@@ -37,12 +37,16 @@ export type EqualsFn<T> = (a: T, b: T) => boolean;
|
|
|
37
37
|
export interface SignalOptions<T> {
|
|
38
38
|
/** Custom equality predicate. Default: `Object.is`. */
|
|
39
39
|
equals?: EqualsFn<T>;
|
|
40
|
+
/** 1.10.0: optional debug name; surfaces in describe().name. */
|
|
41
|
+
name?: string;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** Options accepted by {@link computed}. */
|
|
43
45
|
export interface ComputedOptions<T> {
|
|
44
46
|
/** Custom equality predicate. Default: `Object.is`. */
|
|
45
47
|
equals?: EqualsFn<T>;
|
|
48
|
+
/** 1.10.0: optional debug name; surfaces in describe().name. */
|
|
49
|
+
name?: string;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -57,6 +61,8 @@ export interface EffectOptions {
|
|
|
57
61
|
/** Optional scheduler. If supplied, the effect's first run and every
|
|
58
62
|
* subsequent re-run is deferred through this trampoline. */
|
|
59
63
|
scheduler?: EffectScheduler;
|
|
64
|
+
/** 1.10.0: optional debug name; surfaces in describe().name. */
|
|
65
|
+
name?: string;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
/**
|
|
@@ -234,8 +240,21 @@ export interface NodeDescriptor {
|
|
|
234
240
|
kind: NodeKind;
|
|
235
241
|
/** The node's current value (last stored/computed value; an effect's is its body return). */
|
|
236
242
|
value: unknown;
|
|
243
|
+
/** 1.10.0: the node's debug name, present only for nodes created with a `name` option. */
|
|
244
|
+
name?: string;
|
|
245
|
+
/** 1.10.0: the root signal write behind a dirty dep, present only on descriptors
|
|
246
|
+
* yielded by {@link whyDirty} for deps pending through an intermediate computed. */
|
|
247
|
+
rootCause?: NodeDescriptor;
|
|
237
248
|
}
|
|
238
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Opaque, gen-stamped lifecycle-owner handle returned by {@link getOwner} (1.7.0).
|
|
252
|
+
* Structurally a {@link NodeDescriptor} -- the same ABA-guarded handle `describe`
|
|
253
|
+
* returns -- so it is also re-walkable through `forEachOwned` / `ownerOf` / `nodeId`.
|
|
254
|
+
* Pass it back to {@link runWithOwner}; a stale one degrades to rooted execution.
|
|
255
|
+
*/
|
|
256
|
+
export type OwnerHandle = NodeDescriptor;
|
|
257
|
+
|
|
239
258
|
/** Transition callbacks for {@link Registry.observeObservers}. */
|
|
240
259
|
export interface ObserveObserversHooks {
|
|
241
260
|
/** Fired on the 0->1 observer transition (after registration). */
|
|
@@ -321,6 +340,27 @@ export interface RegistryConfig {
|
|
|
321
340
|
onCapacityExceeded?: "throw" | "grow";
|
|
322
341
|
/** Max effect-queue drain passes before a flush-cycle `Error` (message prefixed `"CycleError:"`) is thrown. Default: 100. */
|
|
323
342
|
maxFlushPasses?: number;
|
|
343
|
+
/**
|
|
344
|
+
* When effects auto-deliver (1.7.0). Resolved ONCE at registry init into two
|
|
345
|
+
* closure-captured `const` booleans, so the chosen body is a JIT constant --
|
|
346
|
+
* `"eager"` emits code byte-identical to 1.6.0. Default: `"eager"`.
|
|
347
|
+
*
|
|
348
|
+
* - `"eager"`: a `.set` outside `batch()` auto-flushes; `batch()` exit
|
|
349
|
+
* auto-flushes. The 1.0-1.6 behaviour; no existing user sees a change.
|
|
350
|
+
* - `"sab"` (**stable-after-batch**): a `.set` outside `batch()` writes the
|
|
351
|
+
* value and marks downstream, but does NOT flush -- effects stay queued
|
|
352
|
+
* (deduped via `FLAG_SCHEDULED`) until `batch()` exit or an explicit
|
|
353
|
+
* {@link Registry.flush}. Matches Reflex-style delivery semantics.
|
|
354
|
+
* - `"manual"`: neither a `.set` nor a `batch()` exit auto-flushes. Only
|
|
355
|
+
* {@link Registry.flush} drains the queue -- for frame-aligned settle
|
|
356
|
+
* points in hard-real-time loops.
|
|
357
|
+
*
|
|
358
|
+
* In every mode the WRITE is eager and `computed` pull stays correct: only
|
|
359
|
+
* effect *delivery* is deferred, never the value.
|
|
360
|
+
*
|
|
361
|
+
* @throws Error if the value is not one of the three tokens.
|
|
362
|
+
*/
|
|
363
|
+
flushStrategy?: "eager" | "sab" | "manual";
|
|
324
364
|
}
|
|
325
365
|
|
|
326
366
|
/** Method surface of {@link Registry}; see that type for the full contract. */
|
|
@@ -367,7 +407,39 @@ interface RegistryMembers {
|
|
|
367
407
|
*/
|
|
368
408
|
dispose(api: Disposable): void;
|
|
369
409
|
batch<T>(fn: () => T): T;
|
|
410
|
+
/**
|
|
411
|
+
* Drain the effect queue now (1.7.0). Available in every
|
|
412
|
+
* {@link RegistryConfig.flushStrategy}: a no-op in `"eager"` (which already
|
|
413
|
+
* auto-flushes), the escape hatch for an idle-write backlog in `"sab"`, and
|
|
414
|
+
* the ONLY settle point in `"manual"`. Re-entrant calls are no-ops (the
|
|
415
|
+
* `isFlushing` guard); an empty queue exits immediately.
|
|
416
|
+
*/
|
|
417
|
+
flush(): void;
|
|
370
418
|
untrack<T>(fn: () => T): T;
|
|
419
|
+
/**
|
|
420
|
+
* Capture the currently-active lifecycle owner as an opaque, gen-stamped
|
|
421
|
+
* handle -- `undefined` outside any effect/computed body (1.7.0; carried
|
|
422
|
+
* forward from 1.5.0-beta.2). Companion to {@link Registry.runWithOwner}.
|
|
423
|
+
* Safe to hold across an `await`: the handle carries the pool slot's `gen`,
|
|
424
|
+
* so a dispose-and-recycle of that slot is detected on restore (ABA guard).
|
|
425
|
+
*/
|
|
426
|
+
getOwner(): OwnerHandle | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Run `fn` with `ownerHandle` reinstated as the current lifecycle owner
|
|
429
|
+
* (1.7.0): effects/computeds created directly in `fn` are adopted by it and
|
|
430
|
+
* cascade-dispose when it re-runs. Tracking is nulled for `fn`'s direct body
|
|
431
|
+
* (same pairing as {@link Registry.createRoot}), so no cross-async dependency
|
|
432
|
+
* edge can form. A stale, `null`, `undefined`, or non-tracker handle degrades
|
|
433
|
+
* to **rooted execution** rather than adopting into a recycled slot's new
|
|
434
|
+
* resident. Returns whatever `fn` returns.
|
|
435
|
+
*/
|
|
436
|
+
runWithOwner<T>(ownerHandle: OwnerHandle | null | undefined, fn: () => T): T;
|
|
437
|
+
/** 1.10.0: pull-side "why will this recompute / why did this fire". Walks a
|
|
438
|
+
* computed's deps and returns a descriptor for each that is currently dirty
|
|
439
|
+
* against the observer's `evalVersion`; deps pending through an intermediate
|
|
440
|
+
* computed carry a {@link NodeDescriptor.rootCause}. Empty for a clean
|
|
441
|
+
* computed and for non-computed (or stale/non-) handles. */
|
|
442
|
+
whyDirty(handle: ReactiveHandle): NodeDescriptor[];
|
|
371
443
|
/** True iff a read RIGHT NOW would record a dependency on this registry.
|
|
372
444
|
* False inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and
|
|
373
445
|
* outside any observer. Use for lazy-allocation wrappers like lite-store. */
|
|
@@ -452,7 +524,13 @@ export function createScope<T>(fn: (dispose: () => void) => T): T;
|
|
|
452
524
|
/** Universal disposal -- see {@link Registry.dispose}. */
|
|
453
525
|
export function dispose(api: Disposable): void;
|
|
454
526
|
export function batch<T>(fn: () => T): T;
|
|
527
|
+
/** Drain the default registry's effect queue now (1.7.0). See {@link Registry.flush}. */
|
|
528
|
+
export function flush(): void;
|
|
455
529
|
export function untrack<T>(fn: () => T): T;
|
|
530
|
+
/** Capture the default registry's current lifecycle owner (1.7.0). See {@link Registry.getOwner}. */
|
|
531
|
+
export function getOwner(): OwnerHandle | undefined;
|
|
532
|
+
/** Run `fn` with `ownerHandle` reinstated on the default registry (1.7.0). See {@link Registry.runWithOwner}. */
|
|
533
|
+
export function runWithOwner<T>(ownerHandle: OwnerHandle | null | undefined, fn: () => T): T;
|
|
456
534
|
/** Top-level binding of {@link Registry.isTracking} against the default registry. */
|
|
457
535
|
export function isTracking(): boolean;
|
|
458
536
|
/** Top-level binding of {@link Registry.hasObservers}. */
|
|
@@ -471,6 +549,8 @@ export function ownerOf(handle: ReactiveHandle): NodeDescriptor | undefined;
|
|
|
471
549
|
export function nodeId(handle: ReactiveHandle): number | undefined;
|
|
472
550
|
/** Top-level binding of {@link Registry.describe}. */
|
|
473
551
|
export function describe(handle: ReactiveHandle): NodeDescriptor | undefined;
|
|
552
|
+
/** Top-level binding of {@link Registry.whyDirty} (1.10.0). */
|
|
553
|
+
export function whyDirty(handle: ReactiveHandle): NodeDescriptor[];
|
|
474
554
|
/** Top-level binding of {@link Registry.onGraphMutation} (1.2.1+). */
|
|
475
555
|
export function onGraphMutation(fn: GraphMutationListener | null): GraphMutationUnsubscribe;
|
|
476
556
|
export function onCleanup(fn: () => void): void;
|
package/Signal.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zakkster/lite-signal v1.
|
|
2
|
+
* @zakkster/lite-signal v1.10.0-preview
|
|
3
|
+
* Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
|
|
4
|
+
* MIT License
|
|
5
|
+
* --------------------
|
|
6
|
+
* 1.10.0 -- named nodes + whyDirty(): the tracing foundation. TWO cold-path
|
|
7
|
+
* primitives the profilers consume directly, zero node-shape change.
|
|
8
|
+
* - signal(v,{name}) / computed(fn,{name}) / effect(fn,{name}): names live
|
|
9
|
+
* in a registry-side Map<id,name>, populated ONLY when a name is given;
|
|
10
|
+
* unnamed nodes pay nothing and keep their pinned handle shapes.
|
|
11
|
+
* describe()/describeNode() gain `name` when present.
|
|
12
|
+
* - whyDirty(handle): pull-side diagnostic. Walks a computed's deps and
|
|
13
|
+
* reports which one's version moved past the observer's evalVersion --
|
|
14
|
+
* the SAME predicate pullComputed uses, ((dep.version - evalVer)|0) > 0 --
|
|
15
|
+
* then traces transitively to the root signal write. Read-only (it never
|
|
16
|
+
* pulls, so it cannot perturb state), allocates freely; a user-cold-path
|
|
17
|
+
* call the engine never invokes.
|
|
18
|
+
* Hot propagation bodies (markDownstream / flushEffects / executeEffect /
|
|
19
|
+
* pullComputed) are BYTE-IDENTICAL to 1.9.0 (sha256-proven); the feature is
|
|
20
|
+
* confined to creation + cold diagnostics. See ROADMAP-1_9-REBUILT s1.10.0.
|
|
21
|
+
*
|
|
22
|
+
* Previous 1.9.0 header follows.
|
|
23
|
+
* --------------------
|
|
24
|
+
* @zakkster/lite-signal v1.9.0 (rebuilt line, candidate)
|
|
3
25
|
* Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
|
|
4
26
|
* MIT License
|
|
5
27
|
* --------------------
|
|
@@ -428,6 +450,12 @@ export function createRegistry(config) {
|
|
|
428
450
|
}
|
|
429
451
|
}
|
|
430
452
|
// --- end 1.4.5 backport.
|
|
453
|
+
// 1.10.0: cold registry-side name table, keyed by node.id. Written only on
|
|
454
|
+
// named creation, read only by describeNode()/whyDirty() (both cold). Node
|
|
455
|
+
// ids are monotonic (fresh identity per allocation), so a recycled slot
|
|
456
|
+
// never collides with a prior name; stale entries for disposed named nodes
|
|
457
|
+
// are harmless (bounded, debug-scope) and cleared by destroy().
|
|
458
|
+
const nodeNames = new Map();
|
|
431
459
|
|
|
432
460
|
let currentNodesCapacity = (config !== undefined && config.maxNodes !== undefined) ? config.maxNodes : 1024;
|
|
433
461
|
let currentLinkCapacity = (config !== undefined && config.maxLinks !== undefined) ? config.maxLinks : currentNodesCapacity * 4;
|
|
@@ -1368,6 +1396,7 @@ export function createRegistry(config) {
|
|
|
1368
1396
|
node.equals = (opts !== undefined && opts.equals !== undefined) ? opts.equals : OBJECT_IS;
|
|
1369
1397
|
node.version = globalVersion;
|
|
1370
1398
|
statSignals++;
|
|
1399
|
+
if (opts !== undefined && opts.name !== undefined) nodeNames.set(node.id, opts.name);
|
|
1371
1400
|
|
|
1372
1401
|
// birthGen pinned at construction. The set/read closures check
|
|
1373
1402
|
// `node.gen === birthGen` to detect stale handles after dispose +
|
|
@@ -1468,6 +1497,7 @@ export function createRegistry(config) {
|
|
|
1468
1497
|
node.computeFn = fn;
|
|
1469
1498
|
node.equals = (opts !== undefined && opts.equals !== undefined) ? opts.equals : OBJECT_IS;
|
|
1470
1499
|
statComputeds++;
|
|
1500
|
+
if (opts !== undefined && opts.name !== undefined) nodeNames.set(node.id, opts.name);
|
|
1471
1501
|
|
|
1472
1502
|
const birthGen = node.gen;
|
|
1473
1503
|
|
|
@@ -1708,6 +1738,7 @@ export function createRegistry(config) {
|
|
|
1708
1738
|
node.computeFn = fn;
|
|
1709
1739
|
node.scheduler = (opts !== undefined) ? opts.scheduler : undefined;
|
|
1710
1740
|
statEffects++;
|
|
1741
|
+
if (opts !== undefined && opts.name !== undefined) nodeNames.set(node.id, opts.name);
|
|
1711
1742
|
|
|
1712
1743
|
let firstRunError = null;
|
|
1713
1744
|
if (node.scheduler) {
|
|
@@ -2059,6 +2090,7 @@ export function createRegistry(config) {
|
|
|
2059
2090
|
* no-ops (every node's `gen` bump invalidates any outstanding handle).
|
|
2060
2091
|
*/
|
|
2061
2092
|
function destroy() {
|
|
2093
|
+
nodeNames.clear(); // 1.10.0: drop the cold name table with the registry
|
|
2062
2094
|
const nodeCount = nodePool.length;
|
|
2063
2095
|
for (let i = 0; i < nodeCount; i++) {
|
|
2064
2096
|
const n = nodePool[i];
|
|
@@ -2173,6 +2205,8 @@ export function createRegistry(config) {
|
|
|
2173
2205
|
// empirically: `o[Symbol()] = x; Object.keys(o)` returns only
|
|
2174
2206
|
// string-keyed enumerable props.
|
|
2175
2207
|
const d = {id: node.id, kind, value: node.value};
|
|
2208
|
+
const nm = nodeNames.get(node.id); // 1.10.0: cold; undefined for unnamed nodes
|
|
2209
|
+
if (nm !== undefined) d.name = nm;
|
|
2176
2210
|
d[NODE_PTR] = node;
|
|
2177
2211
|
d[NODE_GEN] = node.gen; // descriptors are re-walkable handles; stamp gen so the ABA guard holds for them too
|
|
2178
2212
|
return d;
|
|
@@ -2198,6 +2232,57 @@ export function createRegistry(config) {
|
|
|
2198
2232
|
const node = liveNode(handle);
|
|
2199
2233
|
return node !== undefined ? describeNode(node) : undefined;
|
|
2200
2234
|
}
|
|
2235
|
+
// 1.10.0: read-only descent. Given a computed suspected dirty relative to
|
|
2236
|
+
// `sinceVer`, find a source in its cone whose version moved past sinceVer.
|
|
2237
|
+
// Prefers the underlying SIGNAL write (the true root cause) over an
|
|
2238
|
+
// intermediate computed. NEVER pulls -- uses only cached version fields, so
|
|
2239
|
+
// it cannot perturb the graph it is describing. DAG dep edges guarantee
|
|
2240
|
+
// termination (dep cycles are CycleError at eval, never persisted).
|
|
2241
|
+
function rootWrite(node, sinceVer) {
|
|
2242
|
+
let l = node.headDep;
|
|
2243
|
+
while (l !== null) {
|
|
2244
|
+
const dep = l.source;
|
|
2245
|
+
const moved = ((dep.version - sinceVer) | 0) > 0;
|
|
2246
|
+
if ((dep.flags & FLAG_COMPUTED) !== 0) {
|
|
2247
|
+
const deeper = rootWrite(dep, dep.evalVersion | 0);
|
|
2248
|
+
if (deeper !== null) return deeper;
|
|
2249
|
+
if (moved) return describeNode(dep);
|
|
2250
|
+
} else if (moved) {
|
|
2251
|
+
return describeNode(dep); // signal: the root write
|
|
2252
|
+
}
|
|
2253
|
+
l = l.nextDep;
|
|
2254
|
+
}
|
|
2255
|
+
return null;
|
|
2256
|
+
}
|
|
2257
|
+
// 1.10.0: pull-side "why will this recompute / why did this fire". Applies
|
|
2258
|
+
// the EXACT predicate pullComputed uses -- ((dep.version - evalVer)|0) > 0
|
|
2259
|
+
// against the OBSERVER's evalVersion (not the dep's own evalVersion; that
|
|
2260
|
+
// was the rejected-sketch bug that reported every written signal). Also
|
|
2261
|
+
// surfaces deps pending through an intermediate computed, each tagged with
|
|
2262
|
+
// its root signal write. Empty for a clean computed and for non-computeds.
|
|
2263
|
+
function whyDirty(handle) {
|
|
2264
|
+
const node = liveNode(handle);
|
|
2265
|
+
if (node === undefined || (node.flags & FLAG_COMPUTED) === 0) return [];
|
|
2266
|
+
const reasons = [];
|
|
2267
|
+
const evalVer = node.evalVersion | 0;
|
|
2268
|
+
let link = node.headDep;
|
|
2269
|
+
while (link !== null) {
|
|
2270
|
+
const dep = link.source;
|
|
2271
|
+
let isReason = ((dep.version - evalVer) | 0) > 0;
|
|
2272
|
+
let root = null;
|
|
2273
|
+
if ((dep.flags & FLAG_COMPUTED) !== 0) {
|
|
2274
|
+
root = rootWrite(dep, dep.evalVersion | 0);
|
|
2275
|
+
if (root !== null) isReason = true; // pending through this computed
|
|
2276
|
+
}
|
|
2277
|
+
if (isReason) {
|
|
2278
|
+
const d = describeNode(dep);
|
|
2279
|
+
if (root !== null && root.id !== dep.id) d.rootCause = root;
|
|
2280
|
+
reasons.push(d);
|
|
2281
|
+
}
|
|
2282
|
+
link = link.nextDep;
|
|
2283
|
+
}
|
|
2284
|
+
return reasons;
|
|
2285
|
+
}
|
|
2201
2286
|
function forEachObserver(handle, fn) {
|
|
2202
2287
|
const node = liveNode(handle);
|
|
2203
2288
|
if (node === undefined) return;
|
|
@@ -2226,7 +2311,7 @@ export function createRegistry(config) {
|
|
|
2226
2311
|
while (l !== null) { const nx = l.nextDep; fn(describeNode(l.source)); l = nx; }
|
|
2227
2312
|
}
|
|
2228
2313
|
|
|
2229
|
-
const registry = {signal, computed, effect, signalBox, computedBox, dispose, batch, flush, untrack, createRoot, getOwner, runWithOwner, createScope, onCleanup, stats, destroy, isTracking, hasObservers, observeObservers, forEachObserver, forEachSource, forEachOwned, ownerOf, nodeId, describe, onGraphMutation};
|
|
2314
|
+
const registry = {signal, computed, effect, signalBox, computedBox, dispose, batch, flush, untrack, createRoot, getOwner, runWithOwner, createScope, onCleanup, stats, destroy, isTracking, hasObservers, observeObservers, forEachObserver, forEachSource, forEachOwned, ownerOf, nodeId, describe, whyDirty, onGraphMutation};
|
|
2230
2315
|
// 1.9.0: `using r = createRegistry()` destroys at block exit.
|
|
2231
2316
|
if (SYMBOL_DISPOSE !== null) registry[SYMBOL_DISPOSE] = destroy;
|
|
2232
2317
|
return registry;
|
|
@@ -2350,5 +2435,8 @@ export function nodeId(handle) {
|
|
|
2350
2435
|
export function describe(handle) {
|
|
2351
2436
|
return defaultRegistry.describe(handle);
|
|
2352
2437
|
}
|
|
2438
|
+
export function whyDirty(handle) {
|
|
2439
|
+
return defaultRegistry.whyDirty(handle);
|
|
2440
|
+
}
|
|
2353
2441
|
|
|
2354
2442
|
export {watch, when, whenAsync} from "./Watch.js";
|
package/llms.txt
CHANGED
|
@@ -25,6 +25,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
25
25
|
- **onCleanup**: registers teardown for the current computation; fires before each re-run and once on dispose. Works in effects and computeds.
|
|
26
26
|
- **Returned cleanup (1.8.0)**: an EFFECT body may `return` a cleanup function (Solid/Vue/Reflex-compatible). Runs at the same points as onCleanup (before each re-run, once on dispose) and is APPENDED after any onCleanup registered in the same body, so the two styles compose in call order. Non-function returns are ignored; a self-disposed body registers nothing (gen-guarded). COMPUTEDS ARE EXCLUDED: a computed returning a function keeps treating it as the VALUE. Cost: one `typeof` per effect run, off the mark/pull path; `executeEffect` is the only body whose sha256 changed 1.7.0 -> 1.8.0.
|
|
27
27
|
- **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.
|
|
28
|
+
- **Named nodes + `whyDirty` (1.10.0):** `signal(v, {name})` / `computed(fn, {name})` / `effect(fn, {name})` attach a debug name that lives in a cold registry-side `Map<id, name>` populated ONLY when a name is given -- zero node-shape change (the `21-perf-pins` handle shapes are unchanged), zero cost for unnamed nodes; `describe()` / `describeNode()` return `name` when present. `whyDirty(handle)` is the pull-side diagnostic: for a computed it returns each dep whose version moved past the observer's `evalVersion` -- the EXACT predicate `pullComputed` runs, `((dep.version - evalVer) | 0) > 0`, modular not `!==` -- with a transitive `rootCause` down to the root signal write. Read-only: it never pulls, so it cannot perturb the graph it describes; allocates freely (a cold diagnostic the engine never invokes). Empty for a clean computed and for non-computeds. Module surface is now 33 exports / registry 27 fns (whyDirty added); the four hot propagation bodies are byte-identical to 1.9.0 (sha-proven, WHY-1_10.md).
|
|
28
29
|
- **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 at construction (1.9.0-preview.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**.
|
|
29
30
|
- **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.
|
|
30
31
|
|
|
@@ -53,7 +54,8 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
53
54
|
|
|
54
55
|
## Version notes
|
|
55
56
|
|
|
56
|
-
- **1.
|
|
57
|
+
- **1.10.0-preview** (current): **named nodes + `whyDirty()`** -- the tracing foundation, two cold-path diagnostics the profilers consume directly (`signal/computed/effect(v, {name})` into a cold registry-side `Map<id,name>`; `whyDirty(computed)` returns the deps whose version moved past the observer's `evalVersion`, tracing to the root signal write, read-only and never pulling). Zero node-shape change, zero cost for unnamed nodes; the four hot propagation bodies are byte-identical to 1.9.0 (sha-proven, see WHY-1_10.md). Module 33 exports / registry 27 fns. This cut ALSO lands the verification-infrastructure parity that the rest of the line carries: torture 22 -> **27 scenarios** (all 23 semantic execute, zero floor-skips), unit suite glob-scoped to **553 tests** (test/25 rewritten against the live devtools-1.6.2 pairing; new `test/36-named-and-whydirty` discriminator + `test/37` zero-GC probe), the `test/zgc` + `test/ProfilerTests` + `harness/ProfilerTools` lanes, the phase-1/2/3 harness instruments (mint measured IDENTICAL for the sixth engine; visit 21/21 no re-anchor; jit strict 4x monomorphic), and the VersionMatrix gate (PASSED 5/5, counters 288/0). devDeps: devtools ^1.6.2, gc-profiler ^1.16.0. ENGINE NOTE: the folder's v1.10.0-canary.1 engine had forked the rebuilt-1.9 line before two later cold-path fixes; the disposeNode cursor-repair and the 1.4.5 createRegistry validation (+ 2 stats keys) were ported verbatim from 1.9.0 (no hot body touched), fixing a real dispose-mid-retrack crash. See CHANGELOG `[1.10.0-preview]`.
|
|
58
|
+
- **1.9.0-preview.6**: backports the **1.4.5 `createRegistry` input validation** (all four findings) onto the 1.9.0-preview.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.9.0-preview.6]`.
|
|
57
59
|
- **1.9.0-preview.5**: a **packaging-only cut** -- the engine is
|
|
58
60
|
behaviourally unchanged from preview.4 (`Signal.js` differs only in its header
|
|
59
61
|
banner string). Two fixes make the tarball honour its own manifest. (1) The
|
|
@@ -769,15 +771,27 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
769
771
|
- `test/21-perf-pins.test.mjs` -- 1.2.1 construction-shape + ABA-guard pins (6 tests).
|
|
770
772
|
- `test/22-mutation-hook.test.mjs` -- 1.2.1 `onGraphMutation` registration + opcode emission (12 tests).
|
|
771
773
|
- `test/23-owner-introspection.test.mjs` -- `ownerOf`, `forEachOwned`, gen-guarded introspection (14 tests).
|
|
772
|
-
- `test/24-signalbox.test.mjs` --
|
|
773
|
-
- `test/25-devtools-real-boot.test.mjs` -- 1.2.
|
|
774
|
+
- `test/24-signalbox.test.mjs` -- the signalBox/computedBox handle API, active since 1.5.0: get/set/peek/update, derive + memoize, interop both directions, batch coalescing, dispose ABA-safety, plus the 1.9.0 `Symbol.dispose` box test (`using`-path disposal via the shared prototype stamp) (13 tests).
|
|
775
|
+
- `test/25-devtools-real-boot.test.mjs` -- real **devtools 1.6.2** boot against the 1.10.0 engine via the single-instance import-rewrite rig: all 22 exports + `VERSION`, the exact 13-key `capabilities()` fingerprint probed live (`flushControl:T`, `cleanupReturn:T`, `statsKeys:14`; devtools 1.6.2 has NO 1.9 cap key, so the exact key set is itself the 1.9-era pin), live `burstProfile()` stop-summary, the 1.6.x `Symbol.dispose` stamps (14 tests).
|
|
774
776
|
- `test/26-free-list-invariant.test.mjs` -- 1.2.2: the audit's clean-free-list invariant, asserted by inspecting freshly-allocated nodes (4 tests).
|
|
777
|
+
- `test/27-create-root.test.mjs` -- `createRoot` (1.5.0), the ownership escape hatch; includes the top-level-export binding case (7 tests).
|
|
778
|
+
- `test/28-run-with-owner.test.mjs` -- `getOwner`/`runWithOwner`: 7 basic shapes, 3 degradation cases (null/undefined/signal-handle fall through to rooted execution), 3 HAZARD PINS under allocation pressure so the ABA guard is genuinely exercised (16 tests).
|
|
779
|
+
- `test/29-scope.test.mjs` -- `createScope` (1.6.0), the adopting counterpart to `createRoot` (4 tests).
|
|
780
|
+
- `test/30-throwing-equals.test.mjs` -- 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; site audit anchored to 1.10.0 line numbers (9 tests).
|
|
781
|
+
- `test/33-cleanup-return.test.mjs` -- the 1.8.0 effect cleanup-return contract at unit grain: timing, compose order with `onCleanup`, non-function returns ignored, computed exclusion (7 tests).
|
|
782
|
+
- `test/34-computed-selfdirty-prev-owner.test.mjs` -- forward-compat suite for the 1.10.0 surface (computed `fn(prev)` + `opts.initial`, the gen-guarded owner APIs), feature-discriminated so legacy engines degrade cleanly; plus the DELIBERATE #179/#15 absorption pin (a computed writing its own tracked dep ABSORBS) that holds on every 1.x engine (11 tests).
|
|
783
|
+
- `test/35-config-validation.test.mjs` -- 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 rows spawned as child processes under a 256MB cap via `35-config-oom.child.mjs` (13 tests).
|
|
784
|
+
- `test/36-named-and-whydirty.test.mjs` -- the 1.10.0 discriminator (6 tests): `signal(v,{name})`/`computed`/`effect` names surface in `describe().name` (absent for unnamed nodes -- zero node-shape change), and `whyDirty(computed)` returns EXACTLY the dep whose version moved past the observer's `evalVersion` (never the whole dep set), traces to the root signal write, and never pulls (read-only, cannot perturb the clock it describes).
|
|
785
|
+
- `test/37-devtools-zerogc-probe.test.mjs` -- devtools attach/detach allocation probes against the 14-key `stats()` surface (5 tests).
|
|
786
|
+
- `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.
|
|
787
|
+
- `test/ProfilerTests/` -- gc-profiler x engine hardening sub-package (`npm run test:hardening`; 28 tests, 22 execute + 6 version-gated skips).
|
|
775
788
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
776
|
-
- `bench/
|
|
789
|
+
- `bench/mirror.mjs` + `bench/sweep.mjs` -- Andrii's canonical adapter verbatim, cross-framework rows diffing 1:1 against his log; aggregate output `rb.txt` (isolated-per-row).
|
|
777
790
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
778
|
-
- `bench/torture/` -- the complete **
|
|
791
|
+
- `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.10.0 engine and stays green from 1.4.x forward. On the 1.10.0 engine **26 of the 27 execute** (23 semantic + 3 soak) with **zero floor-skips** (as on 1.9.0 -- `dispose` was the last feature gate) -- and the wraparound soak is opt-in. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- all **23 semantic**: `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 since 1.6.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.10.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), `cleanup-return-torture` (1.8.0: an effect's returned cleanup -- timing at re-run/dispose, compose order appended after `onCleanup` from the same body, the self-dispose gen-guard, the computed exclusion, a 400-seed `return fn` vs `onCleanup(fn)` differential -- plus the 1.8.0-origin section 6b, which pins the 1.8 severTail cursor-repair by MECHANISM: five named deterministic dispose-mid-retrack geometries, including the cursor parked exactly on the freed link and a survivors-intact headDep check), `dispose-torture` (1.9.0, native here: `Symbol.dispose` stamped at five sites -- registry -> `destroy`, effect + `createScope` disposers -> themselves, both box PROTOTYPES shared per registry -- driven through the TC39 `using` path, idempotent disposal, feature-detected via the box-prototype stamp), `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; runs the createScope-native root-vs-scope differential); nothing floor-skips on this engine. `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`.
|
|
779
792
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
780
|
-
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
793
|
+
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, mint, all).
|
|
794
|
+
- `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. Re-measured IDENTICAL on the 1.10.0 engine (SIXTH engine running) -- the cold `nodeNames.set` on named creation is off the unnamed fast path. `--verify` applies relative pins P1..P5.
|
|
781
795
|
- `harness/smoke.mjs` -- 1.7 flushStrategy semantics (eager/sab/manual) + `flush()`, and the 1.8 effect-cleanup-return contract (fires before re-run + on dispose, composes with onCleanup in call order, non-function returns ignored, computed-returning-a-function still yields the VALUE). ASSERTS, so it fails loudly on a regression. First in `harness:all` and `verify`.
|
|
782
796
|
- `harness/perf-probe.mjs` -- sBench update-group shape, eager vs sab, per scenario.
|
|
783
797
|
- `harness/fieldkit.mjs` -- single-file portable verify + cold-child A/B bench across six shapes.
|
|
@@ -787,10 +801,9 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
787
801
|
- `harness/owner-hazard-repro.mjs` -- async-gap owner-recycling hazard verdict (cited by getOwner/runWithOwner).
|
|
788
802
|
- `harness/retracking.difftest.mjs` -- differential retracking fuzzer; takes <reference.js> [candidate.js] and asserts both builds agree under thousands of value-dependent topology flips.
|
|
789
803
|
- `harness/toe-to-toe/` -- cross-version sweep (round-robin ordering, drift sentinel, capability columns). Its `engines/` dir is PRIVATE/gitignored: several snapshots are unreleased.
|
|
790
|
-
- `harness/VersionMatrix/` -- cold-process-per-version regression gate (
|
|
804
|
+
- `harness/VersionMatrix/` -- cold-process-per-version regression gate (`npm run gate` -> `pre-publish.mjs`, run before every publish); refuses a verdict on unstable captures (NO EVIDENCE) rather than misreading host noise as a regression.
|
|
791
805
|
- `harness/ProfilerTools/` -- profiler-signal x devtools composition harness (wired as test:harness).
|
|
792
806
|
- `harness/attic/` -- parked probes (1.2.0->1.2.1 shape hunt, the superseded contiguous burst-dag, the superseded sbench sweep); wired into nothing.
|
|
793
|
-
- `demo/index.html` -- interactive visualization of the reactive graph.
|
|
794
807
|
|
|
795
808
|
## Install
|
|
796
809
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0-preview",
|
|
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",
|
|
@@ -26,12 +26,17 @@
|
|
|
26
26
|
"CHANGELOG.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "node --test --test-reporter=spec",
|
|
30
|
-
"test:gc": "node --expose-gc --test --test-reporter=spec",
|
|
31
|
-
"test:coverage": "c8 node --test --test-reporter=spec",
|
|
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",
|