@zakkster/lite-signal 1.4.0 → 1.4.2
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 +254 -0
- package/README.md +101 -16
- package/Signal.js +1 -1
- package/llms.txt +35 -3
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,260 @@ All notable changes to `@zakkster/lite-signal` are documented here.
|
|
|
4
4
|
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
This project follows [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.4.2] -- 2026-07-28
|
|
8
|
+
|
|
9
|
+
The verification-surface patch, round two. **The engine is unchanged**: as in
|
|
10
|
+
1.4.1, the only edit to `Signal.js` is the version string in its header banner,
|
|
11
|
+
and `Signal.d.ts` is untouched. Everything here lives in `bench/torture/`, which
|
|
12
|
+
does not ship -- `files[]` excludes it. If you consume the package, 1.4.2 is
|
|
13
|
+
byte-for-byte 1.4.1 plus a version number.
|
|
14
|
+
|
|
15
|
+
1.4.1 added five semantic scenarios and left the torture directory at eight. This
|
|
16
|
+
release completes it: eleven more scenarios land, and one runner now drives the
|
|
17
|
+
whole forward-compatible superset -- **19 scenarios (16 semantic + 3 soak)** --
|
|
18
|
+
across every version from this 1.4.x base through 1.9.
|
|
19
|
+
|
|
20
|
+
### Added -- eleven torture scenarios completing the 19-scenario suite
|
|
21
|
+
|
|
22
|
+
Each new scenario **feature-detects and skips cleanly** on an engine that predates
|
|
23
|
+
its feature: it prints `SKIP: <feature> requires <version>+` and exits 0 rather
|
|
24
|
+
than failing, which is what lets one directory ride every version on the rebuilt
|
|
25
|
+
line. Three run fully on this 1.4.x base; six self-skip until their feature exists;
|
|
26
|
+
two more run on the surfaces 1.4.x already has:
|
|
27
|
+
|
|
28
|
+
- **`op-accounting.mjs`** -- structural work read from the `onGraphMutation`
|
|
29
|
+
opcode lane (op 1-5): the op5 identity (op5 == computed recomputes + effect
|
|
30
|
+
executions), equality cutoff, diamond glitch-freedom by recompute count,
|
|
31
|
+
link/node balance, laziness, and a 400-seed op5-vs-wrapper differential.
|
|
32
|
+
- **`introspect-torture.mjs`** -- the read-only introspection surface
|
|
33
|
+
(`describe` / `nodeId` / `forEach*` / `hasObservers` / `isTracking` / `ownerOf` /
|
|
34
|
+
`observeObservers`): walk agreement against the real edge set including dynamic
|
|
35
|
+
rewiring, `hasObservers` transitions, `observeObservers` connect/disconnect
|
|
36
|
+
edges, and the ABA gen-stamp guard (a stale descriptor must resolve to nothing,
|
|
37
|
+
never a recycled resident).
|
|
38
|
+
- **`lifecycle-torture.mjs`** -- `destroy` (1.4.0+) registry reset: handles staled
|
|
39
|
+
via gen-bump, stale writes no-op, pool reusable, idempotent. Its `createRoot`
|
|
40
|
+
half (1.5.0+) self-skips on this base, and the PASS line reflects only what ran.
|
|
41
|
+
- **`async-torture.mjs`** -- `watch` / `when` / `whenAsync` contracts + a 300-seed
|
|
42
|
+
projection-guard storm.
|
|
43
|
+
- **`capacity-torture.mjs`** -- the fail-closed pool boundary: exact node/link
|
|
44
|
+
ceilings, `CapacityError`, `grow` mode crossing the boundary, no partial value
|
|
45
|
+
escapes.
|
|
46
|
+
- **`box-torture.mjs`** (1.5.0+), **`scope-torture.mjs`** (1.6.0+),
|
|
47
|
+
**`owner-torture.mjs`** (1.6.0+), **`flush-torture.mjs`** (1.7.0+),
|
|
48
|
+
**`cleanup-return-torture.mjs`** (1.8.0+), **`dispose-torture.mjs`** (1.9.0+) --
|
|
49
|
+
present and gen-guarded; each reports a clean SKIP on the 1.4.x engine.
|
|
50
|
+
|
|
51
|
+
### Changed -- one runner for the whole suite
|
|
52
|
+
|
|
53
|
+
`bench/torture/run.mjs` now registers all 19 scenarios in two groups (`semantic`,
|
|
54
|
+
`soak`), child-process-isolated (several assert on global pool accounting). New
|
|
55
|
+
flags: `--group semantic|soak`, `--list`. `npm run torture` /
|
|
56
|
+
`torture:semantic` / `torture:soak` drive them.
|
|
57
|
+
|
|
58
|
+
### Verified -- full suite green on the 1.4.2 engine (Node 22, `--expose-gc`)
|
|
59
|
+
|
|
60
|
+
- **Torture:** 19/19 -- `torture:semantic` 16/16 (10 executed, 6 clean skips:
|
|
61
|
+
box 1.5.0, scope/owner 1.6.0, flush 1.7.0, cleanup-return 1.8.0, dispose 1.9.0),
|
|
62
|
+
`torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
|
|
63
|
+
- The engine is byte-for-byte 1.4.1; the unit suite is unaffected.
|
|
64
|
+
|
|
65
|
+
## [1.4.1] -- 2026-07-21
|
|
66
|
+
|
|
67
|
+
The verification-surface patch. **The engine is unchanged**: the only edit to
|
|
68
|
+
`Signal.js` is the version string in its header banner, and `Signal.d.ts` is
|
|
69
|
+
untouched. Everything here lives in `bench/torture/`, which does not ship --
|
|
70
|
+
`files[]` excludes it. If you consume the package, 1.4.1 is byte-for-byte 1.4.0
|
|
71
|
+
plus a version number.
|
|
72
|
+
|
|
73
|
+
What changed is what the repo can *prove* about that engine. The torture
|
|
74
|
+
directory used to answer two questions -- did anything throw, and did the pool
|
|
75
|
+
come back -- and both are liveness questions. Neither reads a value and asks
|
|
76
|
+
whether it is right. This release adds five scenarios that assert on meaning,
|
|
77
|
+
and fixes the three existing soaks, which had been lying in small ways.
|
|
78
|
+
|
|
79
|
+
### Added -- five semantic torture scenarios
|
|
80
|
+
|
|
81
|
+
The three pre-1.4.1 soaks (`graph-fuzzer`, `scheduler-bench`, `torture-soak`)
|
|
82
|
+
pass green on an engine whose computeds return stale values. That is not a
|
|
83
|
+
hypothesis. Flipping the clean short-circuit in `pullComputed` from `<= 0` to
|
|
84
|
+
`<= 1` -- a one-character edit, exactly the shape a perf tweak makes -- keeps the
|
|
85
|
+
pool perfectly balanced, throws nothing, and all three soaks report PASS. The
|
|
86
|
+
new scenarios exist to close that gap.
|
|
87
|
+
|
|
88
|
+
- **`oracle-fuzzer.mjs`** -- differential correctness. Drives a random DAG and,
|
|
89
|
+
after every operation, compares **every** computed against an independent
|
|
90
|
+
reference evaluator that recomputes from the leaves with no caching, no
|
|
91
|
+
versioning and no short-circuit. The reference shares no code with the engine,
|
|
92
|
+
so a bug in the engine's invalidation cannot hide in the oracle too. Node
|
|
93
|
+
shapes cover static fan-in (`sum`), dynamic dependency sets (`select`, which
|
|
94
|
+
reads a selector then exactly one dep, so the source set moves between
|
|
95
|
+
evaluations), and value passthrough (`identity`, which preserves `-0` and `NaN`
|
|
96
|
+
where a `sum` would normalise them away). Failures print the seed and a
|
|
97
|
+
minimised operation log so they replay.
|
|
98
|
+
- **`glitch-hunter.mjs`** -- glitch freedom across diamond topologies plus exact
|
|
99
|
+
wakeup accounting. An engine may not expose an intermediate state in which two
|
|
100
|
+
branches of a diamond disagree about which epoch they reflect.
|
|
101
|
+
- **`work-accounting.mjs`** -- minimum body-execution counts across 10 fixed
|
|
102
|
+
topologies. Pins that the engine does *exactly* the necessary work: no
|
|
103
|
+
recompute of an unaffected node, and no skipped recompute of an affected one.
|
|
104
|
+
Both directions fail loudly.
|
|
105
|
+
- **`concurrent-storm.mjs`** -- reentrancy, nesting and flush ordering against
|
|
106
|
+
eight documented contracts: self-write termination, mutual A->B->A loops
|
|
107
|
+
tripping `CycleError` rather than hanging, nested batches flushing only at the
|
|
108
|
+
outermost boundary, effects scheduled *by* a pass draining in the *next* pass,
|
|
109
|
+
writes and reads inside cleanup, dispose-mid-flush, self-disposal from inside
|
|
110
|
+
a body, and async writes interleaved with flushes.
|
|
111
|
+
- **`scheduler-storm.mjs`** -- deferred-execution hazards under saturation. The
|
|
112
|
+
cached `schedulerThunk` is gen-bound; `dispose` bumps `gen`, so a `run` the
|
|
113
|
+
scheduler is still holding must become a silent no-op and must **not** fire the
|
|
114
|
+
new resident once that pool slot is recycled. That is a textbook ABA hazard and
|
|
115
|
+
the guard is one `===` away from being wrong. Also pins that `FLAG_QUEUED` is
|
|
116
|
+
cleared only inside `executeEffect` (which is what makes a microtask scheduler
|
|
117
|
+
coalesce N writes into one run), and that a throwing scheduler does not take
|
|
118
|
+
the rest of the flush pass down with it.
|
|
119
|
+
|
|
120
|
+
Where no contract is documented, these files **pin the observed behaviour** and
|
|
121
|
+
say so at the scenario, rather than asserting an invented one.
|
|
122
|
+
|
|
123
|
+
#### Measured discrimination
|
|
124
|
+
|
|
125
|
+
Each scenario was validated by mutating the engine and confirming the scenario
|
|
126
|
+
fails, then restoring. Recorded because a torture suite nobody has mutation-
|
|
127
|
+
tested is decoration:
|
|
128
|
+
|
|
129
|
+
| mutant | caught by | missed by |
|
|
130
|
+
| ------ | --------- | --------- |
|
|
131
|
+
| `pullComputed` short-circuit `<= 0` -> `<= 1` | oracle-fuzzer (400/400 seeds), glitch-hunter, work-accounting | all three legacy soaks |
|
|
132
|
+
| drop `node.gen === gen` from the cached thunk | scheduler-storm | **the entire 405-test unit suite** |
|
|
133
|
+
| `batch` flushing at every boundary, not the outermost | concurrent-storm | -- (unit suite catches it too) |
|
|
134
|
+
|
|
135
|
+
The ABA row is the reason this release exists: 405 unit tests pass on an engine
|
|
136
|
+
whose stale thunks fire into recycled pool slots.
|
|
137
|
+
|
|
138
|
+
### Added -- one entry point, two groups
|
|
139
|
+
|
|
140
|
+
`bench/torture/run.mjs` replaces the ad-hoc shell loops people were writing
|
|
141
|
+
around six separate `node --expose-gc bench/torture/<file>.mjs` invocations.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm run torture # everything
|
|
145
|
+
npm run torture:semantic # correctness only, ~10s, CI-shaped
|
|
146
|
+
npm run torture:soak # resource soaks only
|
|
147
|
+
node bench/torture/run.mjs --list
|
|
148
|
+
node bench/torture/run.mjs --seconds 30 --bail
|
|
149
|
+
node bench/torture/run.mjs oracle glitch # substring match on names
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Scenarios are split into **`semantic`** (deterministic, fast, assert on meaning
|
|
153
|
+
-- belong in CI on every commit) and **`soak`** (wall-clock bound, assert on
|
|
154
|
+
resources -- belong in a nightly or pre-publish job). Each scenario stays a
|
|
155
|
+
standalone executable module, and the runner **spawns them as child processes**
|
|
156
|
+
rather than importing them. That is deliberate: several assert on global pool
|
|
157
|
+
accounting and on the default registry, so running two in one process would let
|
|
158
|
+
the first one's residue poison the second's baseline. Process isolation is the
|
|
159
|
+
only thing that makes those assertions mean anything.
|
|
160
|
+
|
|
161
|
+
`--expose-gc` is passed by the runner unconditionally. It is not optional:
|
|
162
|
+
several scenarios force collection to settle finalizers, and without it they
|
|
163
|
+
would silently degrade to asserting nothing rather than failing loudly.
|
|
164
|
+
|
|
165
|
+
### Added -- shared torture infrastructure
|
|
166
|
+
|
|
167
|
+
`bench/torture/helpers/index.mjs` collects what every soak had grown its own
|
|
168
|
+
copy of: the seeded `mulberry32` PRNG (so a failure replays from its seed
|
|
169
|
+
alone), the `soakRegistry` / `fixedRegistry` constructors, and `createReport`,
|
|
170
|
+
which **collects failures instead of throwing on the first one** -- torture
|
|
171
|
+
output is read once, usually in CI, and "fix, rerun, discover the next one" is a
|
|
172
|
+
slow loop.
|
|
173
|
+
|
|
174
|
+
It also holds `VALUE_POOL`, the adversarial value domain. An earlier draft of
|
|
175
|
+
the oracle used integers only, and a mutant that swapped the default equality
|
|
176
|
+
from `Object.is` to `==` sailed straight through, because on integers the two
|
|
177
|
+
agree. The pool now contains the pairs where the candidate definitions
|
|
178
|
+
disagree: `Object.is` vs `===` differ on `NaN` and on `-0`/`0`; `===` vs `==`
|
|
179
|
+
differ on `0`/`""`/`false`/`"0"` and `null`/`undefined`. Equality decides whether
|
|
180
|
+
a write propagates at all, so it has to be fuzzed with values that can tell the
|
|
181
|
+
definitions apart.
|
|
182
|
+
|
|
183
|
+
The module is deliberately dependency-free and side-effect-free: importing it
|
|
184
|
+
must not touch the default registry, or an import would quietly allocate and
|
|
185
|
+
poison the pool baselines the scenarios assert on.
|
|
186
|
+
|
|
187
|
+
### Fixed -- the soaks printed `impossible` on a healthy run
|
|
188
|
+
|
|
189
|
+
All three legacy soaks used a magic-constant guard as a JIT sink
|
|
190
|
+
(`if (acc === 1234567) console.log("impossible")`) to stop V8 eliminating the
|
|
191
|
+
accumulator loops that make the engine do real work. Those constants are
|
|
192
|
+
**reachable**: a 1.4.0 soak run printed `impossible` for real, because the
|
|
193
|
+
accumulator genuinely landed on the sentinel. The sink polluted stdout on a
|
|
194
|
+
passing run, which is how a CI log teaches people to ignore it.
|
|
195
|
+
|
|
196
|
+
Replaced with a module-scoped int32 sink accumulated in the loop and read at
|
|
197
|
+
teardown. It never prints -- and it now carries an assertion the old form could
|
|
198
|
+
not: **if the sink never advances, the run fails**, because that means the work
|
|
199
|
+
loops were optimised away and the soak measured nothing. Previously that failure
|
|
200
|
+
mode was undetectable.
|
|
201
|
+
|
|
202
|
+
### Fixed -- "pool returned to baseline" was not what was being asserted
|
|
203
|
+
|
|
204
|
+
The soaks printed a `baseline` (e.g. `7500 / 17992`), a post-teardown figure
|
|
205
|
+
(`2500 / 0`), and then declared that the pool had "returned to baseline". Those
|
|
206
|
+
numbers never match and were never supposed to: teardown disposes the computeds
|
|
207
|
+
and effects and leaves only the signals alive, so the real assertion is a
|
|
208
|
+
leaf-only floor of `N_SIGNALS + 8`. The verdict did not describe the check.
|
|
209
|
+
|
|
210
|
+
- the pre-run stat is now labelled `pre-soak`, not `baseline`;
|
|
211
|
+
- the floor actually asserted on is printed
|
|
212
|
+
(`post-teardown floor asserted: <= 2508 nodes / 0 links`), so a reader can
|
|
213
|
+
check the verdict against the numbers instead of trusting it;
|
|
214
|
+
- the pass line reads `pool drained to its leaf-only floor`.
|
|
215
|
+
|
|
216
|
+
### Fixed -- `helpers/` resolution
|
|
217
|
+
|
|
218
|
+
The helpers module was committed at `bench/torture/index.mjs` while the
|
|
219
|
+
scenarios -- and the module's own header docstring -- referenced
|
|
220
|
+
`bench/torture/helpers/index.mjs`. Four of the five semantic scenarios died with
|
|
221
|
+
`ERR_MODULE_NOT_FOUND` before executing a single assertion, leaving the suite at
|
|
222
|
+
1/5 with three stack traces in the log. Moved to the path everything already
|
|
223
|
+
expected. `run.mjs` propagated the failure correctly; nothing else would have
|
|
224
|
+
caught it, because the torture suite is not wired into `npm test` or
|
|
225
|
+
`npm run gate`.
|
|
226
|
+
|
|
227
|
+
### Changed -- torture sources are ASCII
|
|
228
|
+
|
|
229
|
+
`bench/torture/*.mjs` carried em dashes, less-than-or-equal glyphs, and 1,820
|
|
230
|
+
box-drawing characters. `Signal.js` is pure ASCII and `bench/benchmark.mjs` uses
|
|
231
|
+
only the sanctioned multiplication sign, which made the torture directory the
|
|
232
|
+
lone outlier against the ecosystem's ASCII-only source rule. Normalised to
|
|
233
|
+
`--`, `<=` and `-`. The directory's `README.md` is left as it is, consistent
|
|
234
|
+
with `bench/README.md`.
|
|
235
|
+
|
|
236
|
+
### Added -- `harness/ProfilerTools/` is now checked in
|
|
237
|
+
|
|
238
|
+
The combined profiler + devtools integration harness has been described in the
|
|
239
|
+
README and wired into `test:harness` / `test:all` since 1.4.0, but its four files
|
|
240
|
+
were never committed. They land here: `harness.test.mjs`, `package.json`,
|
|
241
|
+
`setup.sh`, `README.md`. Verified working -- 5/5 passing, a 7-node / 6-edge
|
|
242
|
+
telemetry DAG discovered through devtools, and `activeNodes 22 -> 22` across
|
|
243
|
+
2,000 driven frames, which is the zero-GC contract holding end-to-end across
|
|
244
|
+
three packages rather than on a microbench.
|
|
245
|
+
|
|
246
|
+
Its scope is now stated explicitly in the README and `llms.txt`, because it was
|
|
247
|
+
previously ambiguous and the ambiguity was dangerous: **`setup.sh` hard-pins
|
|
248
|
+
`@zakkster/lite-signal@1.6.0-preview.2` from the registry and nothing resolves
|
|
249
|
+
to `../../Signal.js`.** The harness does not test the working tree. Since
|
|
250
|
+
`npm run test:all` chains it, a passing `test:all` is not by itself clearance to
|
|
251
|
+
publish -- `npm test`, `npm run torture` and `npm run test:hardening` are the
|
|
252
|
+
legs that exercise local changes.
|
|
253
|
+
|
|
254
|
+
### Not changed
|
|
255
|
+
|
|
256
|
+
- `Signal.js` behaviour, `Signal.d.ts`, the public API, the hot path, bundle
|
|
257
|
+
size, and the 1.4.0 `stats()` surface.
|
|
258
|
+
- `npm test` still runs `test/*.test.mjs` only: **405 passing**, unchanged.
|
|
259
|
+
- The torture suite remains opt-in and unpublished.
|
|
260
|
+
|
|
7
261
|
## [1.4.0] -- 2026-06-XX
|
|
8
262
|
|
|
9
263
|
The observability minor: `stats()` gains **three cumulative lifecycle counters**
|
package/README.md
CHANGED
|
@@ -700,7 +700,7 @@ npm run bench
|
|
|
700
700
|
|
|
701
701
|
## Testing strategy
|
|
702
702
|
|
|
703
|
-
|
|
703
|
+
Four tiers, all reproducible.
|
|
704
704
|
|
|
705
705
|
### Tier 1 -- Behavior (unit tests, fast)
|
|
706
706
|
|
|
@@ -759,12 +759,80 @@ npm run test:gc
|
|
|
759
759
|
npm run bench
|
|
760
760
|
```
|
|
761
761
|
|
|
762
|
-
### Tier 4 -- Torture
|
|
762
|
+
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
763
763
|
|
|
764
|
-
`bench/torture/`
|
|
764
|
+
`bench/torture/` holds **19 scenarios (16 semantic + 3 soak)** in two groups,
|
|
765
|
+
behind one runner. They are not perf benchmarks: the ops/sec figures reflect
|
|
766
|
+
random workload composition, not engine throughput -- `bench/benchmark.mjs`
|
|
767
|
+
remains the canonical perf harness. Every scenario feature-detects and **skips
|
|
768
|
+
cleanly** below the engine version that introduces its feature (`SKIP: <feature>
|
|
769
|
+
requires <version>+`, exit 0), so the whole directory rides this 1.4.x base
|
|
770
|
+
forward through 1.9. On the 1.4.x engine, **10 semantic scenarios execute and 6
|
|
771
|
+
self-skip**.
|
|
765
772
|
|
|
766
|
-
|
|
767
|
-
|
|
773
|
+
```bash
|
|
774
|
+
npm run torture # everything
|
|
775
|
+
npm run torture:semantic # correctness only, ~10s, CI-shaped
|
|
776
|
+
npm run torture:soak # resource soaks only
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
```bash
|
|
780
|
+
node bench/torture/run.mjs --list
|
|
781
|
+
node bench/torture/run.mjs --seconds 30 --bail
|
|
782
|
+
node bench/torture/run.mjs oracle glitch # substring match on names
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
The runner spawns each scenario as a **child process** rather than importing it.
|
|
786
|
+
Several assert on global pool accounting and on the default registry, so running
|
|
787
|
+
two in one process would let the first one's residue poison the second's
|
|
788
|
+
baseline. `--expose-gc` is passed unconditionally -- some scenarios force
|
|
789
|
+
collection to settle finalizers, and without it they would silently degrade to
|
|
790
|
+
asserting nothing.
|
|
791
|
+
|
|
792
|
+
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
793
|
+
|
|
794
|
+
Run these on every commit. They pin values, wakeups, work and ordering.
|
|
795
|
+
|
|
796
|
+
| scenario | pins |
|
|
797
|
+
| -------- | ---- |
|
|
798
|
+
| `oracle-fuzzer` | every computed against an independent uncached reference evaluator, over 400 seeds x 120 ops |
|
|
799
|
+
| `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
|
|
800
|
+
| `work-accounting` | minimum body-execution counts across 10 fixed topologies -- no missing recompute, no surplus one |
|
|
801
|
+
| `concurrent-storm` | eight reentrancy and flush-ordering contracts: self-write, `CycleError` on mutual loops, nested-batch boundaries, cascade ordering, cleanup writes, dispose-mid-flush, self-disposal, async interleaving |
|
|
802
|
+
| `scheduler-storm` | deferred execution under 10,000 effects: the gen-bound thunk's ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler not taking the pass down |
|
|
803
|
+
| `op-accounting` | structural work read from the `onGraphMutation` opcode lane (op 1-5): the op5 identity, equality cutoff, diamond glitch-freedom by recompute count, link/node balance, laziness, a 400-seed op5-vs-wrapper differential |
|
|
804
|
+
| `introspect-torture` | the read-only introspection surface (`describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers`): walk agreement vs the real edge set incl. dynamic rewiring, `hasObservers` transitions, and the ABA gen-stamp guard (a stale descriptor resolves to nothing, never a recycled resident) |
|
|
805
|
+
| `lifecycle-torture` | `destroy` (1.4.0+) registry reset: handles staled via gen-bump, stale writes no-op, pool reusable, idempotent. Its `createRoot` half is 1.5.0+ and self-skips on this base |
|
|
806
|
+
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
807
|
+
| `capacity-torture` | the fail-closed pool boundary: exact node/link ceilings, `CapacityError`, `grow` mode crossing the boundary, no partial value escapes |
|
|
808
|
+
| `box-torture` (1.5.0+) | `signalBox`/`computedBox` interop + surface -- SKIP on 1.4.x |
|
|
809
|
+
| `scope-torture` (1.6.0+) | `createScope` adoption + the disposal-crash fuzz -- SKIP on 1.4.x |
|
|
810
|
+
| `owner-torture` (1.6.0+) | `getOwner`/`runWithOwner` capture-restore + ABA degradation -- SKIP on 1.4.x |
|
|
811
|
+
| `flush-torture` (1.7.0+) | `flushStrategy` convergence + the value-never-defers invariant + `.subscribe()` -- SKIP on 1.4.x |
|
|
812
|
+
| `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard, computed exclusion -- SKIP on 1.4.x |
|
|
813
|
+
| `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects (five stamp sites) -- SKIP on 1.4.x |
|
|
814
|
+
|
|
815
|
+
Why this group exists: the resource soaks below pass green on an engine whose
|
|
816
|
+
computeds return stale values. Flipping the clean short-circuit in `pullComputed`
|
|
817
|
+
from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws nothing --
|
|
818
|
+
`oracle-fuzzer` catches it on 400/400 seeds, and all three soaks report PASS.
|
|
819
|
+
Separately, removing the `node.gen === gen` guard from the cached scheduler thunk
|
|
820
|
+
is caught by `scheduler-storm` and **missed by all 405 unit tests**.
|
|
821
|
+
|
|
822
|
+
Where no contract is documented, these files pin the *observed* behaviour and say
|
|
823
|
+
so at the scenario, rather than asserting an invented one.
|
|
824
|
+
|
|
825
|
+
#### `soak` -- wall-clock bound, asserts on **resources**
|
|
826
|
+
|
|
827
|
+
Run these nightly or pre-publish. Large randomised graphs (1,500 / 7,500 / 3,300
|
|
828
|
+
nodes) under mixed fuzz -- leaf writes, batched writes, computed and effect
|
|
829
|
+
rewires, nested-batch and untrack reads, microtask-scheduled async flushes. Each
|
|
830
|
+
exits non-zero unless:
|
|
831
|
+
|
|
832
|
+
- zero exceptions were thrown during the run,
|
|
833
|
+
- after teardown `activeNodes` is at or below its leaf-only floor and
|
|
834
|
+
`activeLinks` is exactly `0`, and
|
|
835
|
+
- the JIT sink advanced -- proving the accumulator loops were not optimised away.
|
|
768
836
|
|
|
769
837
|
```bash
|
|
770
838
|
node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
|
|
@@ -772,13 +840,19 @@ node --expose-gc bench/torture/torture-soak.mjs # 5s high-volume churn, 750
|
|
|
772
840
|
node --expose-gc bench/torture/scheduler-bench.mjs # 10s microtask-scheduled, 3300 nodes
|
|
773
841
|
```
|
|
774
842
|
|
|
775
|
-
|
|
843
|
+
Any of them takes `TORTURE_SECONDS=N` for a longer soak (the runner's `--seconds`
|
|
844
|
+
sets it for all three). Indicative numbers from a development host:
|
|
776
845
|
|
|
777
|
-
| | duration | ops | errors | post-teardown nodes / links |
|
|
778
|
-
| --------------------- | --------:| --------:| ------:| --------------------------- |
|
|
779
|
-
| graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 |
|
|
780
|
-
| torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 |
|
|
781
|
-
| scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 |
|
|
846
|
+
| | duration | ops | errors | post-teardown nodes / links | floor |
|
|
847
|
+
| --------------------- | --------:| --------:| ------:| --------------------------- | -------- |
|
|
848
|
+
| graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 | <= 508 |
|
|
849
|
+
| torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 | <= 2508 |
|
|
850
|
+
| scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 | <= 1008 |
|
|
851
|
+
|
|
852
|
+
The floor is the assertion; the pre-soak figure is not. Teardown disposes the
|
|
853
|
+
computeds and effects and leaves the signals alive, so post-teardown is *supposed*
|
|
854
|
+
to sit far below the pre-soak node count. Each soak prints the floor it asserted
|
|
855
|
+
against so the verdict can be checked against the numbers.
|
|
782
856
|
|
|
783
857
|
```bash
|
|
784
858
|
npm run verify # test + a sanity bench
|
|
@@ -856,6 +930,14 @@ npm run test:harness
|
|
|
856
930
|
|
|
857
931
|
The setup script pins specific package versions via tarball install so the harness can be re-run reproducibly without depending on whatever happens to be in the public registry on the day. Treat the setup as a one-time per-checkout cost.
|
|
858
932
|
|
|
933
|
+
> **This harness does not test the tree you are standing in.** `setup.sh` hard-pins `@zakkster/lite-signal@1.6.0-preview.2` from the registry and extracts it into the harness's own `node_modules`; nothing resolves to `../../Signal.js`. That is deliberate -- the point is to prove the contract holds **across the published package chain a consumer actually installs**, where `lite-profiler-signal` and `lite-devtools` meet an engine none of them were built against. It is emphatically *not* a gate on local changes. A green run here says nothing about uncommitted work in `Signal.js`, and because `npm run test:all` chains it, a passing `test:all` is **not** by itself clearance to publish.
|
|
934
|
+
>
|
|
935
|
+
> For the local engine, use `npm test` (in-tree, 405 tests), `npm run torture` (in-tree), and `npm run test:hardening` -- `test/ProfilerTests/` self-references in-tree and therefore *does* exercise the working copy.
|
|
936
|
+
>
|
|
937
|
+
> When the pinned version goes stale, bump it in `setup.sh` and re-check the two capability assertions in `harness.test.mjs` (`cap.owners`, `cap.mutationHook`), which are written against the 1.6 surface.
|
|
938
|
+
|
|
939
|
+
Last verified run (engine `1.6.0-preview.2`, devtools 1.2.0, profiler 1.2.0): 5/5 passing; `capabilities: {"floor":"1.1.5","owners":true,"mutationHook":true,"burst":true}`; 7-node / 6-edge telemetry DAG discovered; `activeNodes 22 -> 22` across 2,000 driven frames with `poolCap` flat at 1024 -- the zero-GC contract holding end-to-end across three packages.
|
|
940
|
+
|
|
859
941
|
### Notes
|
|
860
942
|
|
|
861
943
|
- The hardening suite and the profiler integration do **not** run on `npm test` from the root. They opt in through the `test:hardening` / `test:harness` scripts (and `test:all`, which chains everything).
|
|
@@ -1165,11 +1247,14 @@ Yes, if your computeFn reads its deps in the same order each invocation. The `cu
|
|
|
1165
1247
|
## npm scripts
|
|
1166
1248
|
|
|
1167
1249
|
```bash
|
|
1168
|
-
npm test
|
|
1169
|
-
npm run test:gc
|
|
1170
|
-
npm run bench
|
|
1171
|
-
npm run bench-reactive
|
|
1172
|
-
npm run
|
|
1250
|
+
npm test # behavior suite, ~1.3s
|
|
1251
|
+
npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
|
|
1252
|
+
npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
|
|
1253
|
+
npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
|
|
1254
|
+
npm run torture # full torture suite, all 19 scenarios
|
|
1255
|
+
npm run torture:semantic # correctness scenarios only, ~10s
|
|
1256
|
+
npm run torture:soak # resource soaks only, wall-clock bound
|
|
1257
|
+
npm run verify # test + sanity bench; run before publishing
|
|
1173
1258
|
```
|
|
1174
1259
|
|
|
1175
1260
|
---
|
package/Signal.js
CHANGED
package/llms.txt
CHANGED
|
@@ -50,7 +50,38 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
50
50
|
|
|
51
51
|
## Version notes
|
|
52
52
|
|
|
53
|
-
- **1.4.
|
|
53
|
+
- **1.4.2** (current): the **verification-surface patch, round two**. No engine
|
|
54
|
+
change -- as in 1.4.1, the only edit to `Signal.js` is the banner version string,
|
|
55
|
+
`Signal.d.ts` untouched, `bench/torture/` excluded from `files[]`; for consumers
|
|
56
|
+
1.4.2 is byte-for-byte 1.4.1 plus a version number. It completes the torture
|
|
57
|
+
directory: 1.4.1 left it at eight scenarios, and this adds **eleven** more so one
|
|
58
|
+
runner drives the whole forward-compatible superset -- **19 scenarios (16 semantic
|
|
59
|
+
+ 3 soak)** -- from this 1.4.x base through 1.9. On the 1.4.x engine ten semantic
|
|
60
|
+
run and six self-skip (`box` 1.5.0, `scope`/`owner` 1.6.0, `flush` 1.7.0,
|
|
61
|
+
`cleanup-return` 1.8.0, `dispose` 1.9.0 print `SKIP: <feature> requires <version>+`
|
|
62
|
+
and exit 0). The two that run on surfaces 1.4.x already has: `introspect-torture`
|
|
63
|
+
(the read-only `describe`/`forEach*`/`hasObservers`/`ownerOf` surface + ABA
|
|
64
|
+
gen-stamp guard) and `op-accounting` (structural work via the `onGraphMutation`
|
|
65
|
+
opcode lane); `lifecycle-torture` runs its `destroy` contract (its `createRoot`
|
|
66
|
+
half is 1.5.0+ and self-skips). Verified green: torture 19/19; engine byte-identical
|
|
67
|
+
to 1.4.1, so the unit suite is unaffected.
|
|
68
|
+
|
|
69
|
+
- **1.4.1**: the **verification-surface patch**. No engine change --
|
|
70
|
+
the only edit to `Signal.js` is the version string in its header banner, and
|
|
71
|
+
`Signal.d.ts` is untouched. `bench/torture/` gains five deterministic
|
|
72
|
+
correctness scenarios (`oracle-fuzzer`, `glitch-hunter`, `work-accounting`,
|
|
73
|
+
`concurrent-storm`, `scheduler-storm`), one runner (`bench/torture/run.mjs`)
|
|
74
|
+
with `semantic` / `soak` groups, and shared helpers. The three pre-existing
|
|
75
|
+
soaks assert only on liveness -- nothing threw, the pool came back -- and pass
|
|
76
|
+
green on an engine whose computeds return stale values; the semantic group
|
|
77
|
+
closes that gap. Mutation-verified: removing the `node.gen === gen` guard from
|
|
78
|
+
the cached scheduler thunk is caught by `scheduler-storm` and missed by all
|
|
79
|
+
405 unit tests. Also fixes a reachable JIT-sink sentinel that printed
|
|
80
|
+
`impossible` to stdout on a healthy 1.4.0 soak run, and a pass line that
|
|
81
|
+
claimed the pool "returned to baseline" when the assertion was a leaf-only
|
|
82
|
+
floor. Nothing here ships: `files[]` excludes `bench/`.
|
|
83
|
+
|
|
84
|
+
- **1.4.0**: the **observability minor**. `stats()` gains three
|
|
54
85
|
cumulative lifecycle counters -- `totalAllocations`, `totalDisposals`,
|
|
55
86
|
`poolGrowths` -- the surface reserved for 1.4.0 in the 1.2.x/1.3.0 notes, now
|
|
56
87
|
delivered. **The hot paths and public callable API are byte-identical to 1.3.0**;
|
|
@@ -598,11 +629,12 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
598
629
|
- `test/25-devtools-real-boot.test.mjs` -- 1.2.2: real `Devtools.js` boot against the engine, ghost-contract pin, `stats()` shape pin (10 tests).
|
|
599
630
|
- `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).
|
|
600
631
|
- `test/ProfilerTests/` -- version-portable engine hardening suite. Own `package.json`, own `node:test`. Imports `@zakkster/lite-signal` as bare specifier; self-references in-tree, resolves to the installed version when run standalone. Feature-gated cases activate automatically as the engine gains APIs. Run via `npm run test:hardening` (in-tree) or `./run-matrix.sh` (standalone matrix vs published lines).
|
|
601
|
-
- `harness/ProfilerTools/` -- combined integration harness: `@zakkster/lite-profiler-signal` + `@zakkster/lite-devtools` pointed at the same lite-signal registry. Verifies the cross-package zero-GC contract end-to-end (devtools inspects a profiler-driven graph non-perturbingly; the profiler allocates no new nodes in steady state). Own `package.json`, one-time setup via `bash setup.sh`
|
|
632
|
+
- `harness/ProfilerTools/` -- combined integration harness: `@zakkster/lite-profiler-signal` + `@zakkster/lite-devtools` pointed at the same lite-signal registry. Verifies the cross-package zero-GC contract end-to-end (devtools inspects a profiler-driven graph non-perturbingly; the profiler allocates no new nodes in steady state). Own `package.json`, one-time setup via `bash setup.sh`. IMPORTANT SCOPE NOTE: `setup.sh` hard-pins `@zakkster/lite-signal@1.6.0-preview.2` from the registry and extracts it into the harness's own `node_modules` -- nothing resolves to `../../Signal.js`, so this harness does NOT exercise the local working tree. It proves the cross-package contract across the PUBLISHED chain a consumer installs, not local changes; a green `npm run test:all` is therefore not by itself clearance to publish. For the local engine use `npm test`, `npm run torture`, and `npm run test:hardening` (`test/ProfilerTests/` self-references in-tree). Last verified: 5/5 passing, `activeNodes 22 -> 22` across 2,000 driven frames. The two capability assertions in `harness.test.mjs` (`cap.owners`, `cap.mutationHook`) are written against the 1.6 surface and must be rechecked when the pin is bumped. Run via `npm run test:harness`. Both harnesses are opt-in: `npm test` from root is scoped to `'test/*.test.mjs'` and does NOT sweep them.
|
|
602
633
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
603
634
|
- `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
|
|
604
635
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
605
|
-
- `bench/torture/` --
|
|
636
|
+
- `bench/torture/` -- **19 scenarios (16 semantic + 3 soak)** behind one runner (`run.mjs`), two groups, forward-compatible through 1.9. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature (`SKIP: <feature> requires <version>+`, exit 0), so the whole directory rides this 1.4.x base forward. `semantic` (deterministic, fast, asserts on MEANING; run in CI) -- the **10 that execute on the 1.4.x engine**: `oracle-fuzzer` (every computed vs an independent uncached reference evaluator, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeup counts), `work-accounting` (minimum body-execution counts over 10 topologies), `op-accounting` (structural work via the `onGraphMutation` opcode lane -- op5 identity, equality cutoff, link/node balance, 400-seed differential), `introspect-torture` (the read-only `describe`/`nodeId`/`forEach*`/`hasObservers`/`isTracking`/`ownerOf`/`observeObservers` surface: walk agreement vs the real edge set incl. dynamic rewiring, and the ABA gen-stamp guard), `lifecycle-torture` (`destroy` 1.4.0+ registry reset -- gen-bump staling, no-op stale writes, pool reuse, idempotence; its `createRoot` half is 1.5.0+ and self-skips), `concurrent-storm` (8 reentrancy / flush-ordering contracts, `CycleError` via `maxFlushPasses`), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing scheduler containment), `async-torture` (`watch`/`when`/`whenAsync` + a 300-seed storm), `capacity-torture` (the fail-closed pool boundary, `CapacityError`, `grow` crossing it, no partial value escapes); plus **6 that self-skip** until their feature exists: `box-torture` (1.5.0), `scope-torture` (1.6.0), `owner-torture` (1.6.0), `flush-torture` (1.7.0), `cleanup-return-torture` (1.8.0), `dispose-torture` (1.9.0). `soak` (wall-clock bound, asserts on RESOURCES; run nightly): `graph-fuzzer`, `scheduler-bench`, `torture-soak` -- exit 0 iff zero errors AND post-teardown pool at or below its leaf-only floor AND the JIT sink advanced. The runner spawns each scenario as a child process because several assert on global pool accounting, and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
637
|
+
- `bench/torture/helpers/index.mjs` -- shared torture infrastructure: seeded `mulberry32` (failures replay from their seed), `soakRegistry` / `fixedRegistry`, `createReport` (collects failures rather than throwing on the first), and `VALUE_POOL`, the adversarial value domain containing the pairs where candidate equality definitions disagree (`Object.is` vs `===` on NaN and -0/0; `===` vs `==` on 0/""/false/"0" and null/undefined). Dependency-free and side-effect-free by contract: importing it must not touch the default registry.
|
|
606
638
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
607
639
|
- `demo/index.html` -- interactive visualization of the reactive graph.
|
|
608
640
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
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",
|
|
@@ -37,7 +37,10 @@
|
|
|
37
37
|
"bench": "node --expose-gc bench/benchmark.mjs",
|
|
38
38
|
"bench-reactive": "node --expose-gc bench/benchmarkReactive.mjs",
|
|
39
39
|
"verify": "npm test && npm run bench",
|
|
40
|
-
"gate": "node harness/VersionMatrix/pre-publish.mjs"
|
|
40
|
+
"gate": "node harness/VersionMatrix/pre-publish.mjs",
|
|
41
|
+
"torture": "node bench/torture/run.mjs",
|
|
42
|
+
"torture:semantic": "node bench/torture/run.mjs --group semantic",
|
|
43
|
+
"torture:soak": "node bench/torture/run.mjs --group soak"
|
|
41
44
|
},
|
|
42
45
|
"keywords": [
|
|
43
46
|
"signal",
|