@zakkster/lite-signal 1.8.0-beta → 1.8.0-beta.1

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 CHANGED
@@ -4,6 +4,38 @@ 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.0-beta.1] -- 2026-09-20
8
+
9
+ Verification + docs increment over `1.8.0-beta`; **no engine change past the
10
+ version banner comment** (`Signal.js` byte-identical, banner line only). Migration
11
+ 7 of the campaign: ports the standing perf-gate lane from the canonical 1.5.2
12
+ line onto this engine.
13
+
14
+ ### Added -- perf-gate lane (`@zakkster/lite-perf-gate`, devDependency only)
15
+
16
+ - `test/36-perf-gate.test.mjs` + `npm run test:gate`
17
+ (`node --expose-gc --max-semi-space-size=4 --test test/36-perf-gate.test.mjs`),
18
+ chained into `test:all` after `test:zgc`. Where the existing `test:zgc` lane
19
+ (lite-gc-profiler) is the suite's bespoke zero-GC harness, this lane wires
20
+ `@zakkster/lite-perf-gate`'s `zgcSuite` as a standing, self-validating verdict:
21
+ five signals (scavenges / engine counters / retainedKB / oldGen /
22
+ arrayBuffersKB), two scales (N and k*N), positive+negative+large detector
23
+ controls on every run, and permanent `mustFail` negative controls.
24
+ - Seven claimed-zero steady-state scenarios, each anchored to its `llms.txt`
25
+ claim: `set-propagate` (1 signal -> 8 computeds -> 1 effect, sync flush),
26
+ `computed-cache-hit`, `computed-recompute-stable`, `effect-rerun-stable`,
27
+ `peek`, `batch-flush` (3 sets/batch), `box-set-propagate`. `statsOf` reads each
28
+ scenario's isolated registry ledger; `counters` pins
29
+ `totalAllocations`/`totalDisposals`/`poolGrowths` at 0-delta.
30
+ - Two `mustFail` controls that MUST trip the gate: a per-op `{x,y,z,w}` object
31
+ allocator, and the documented `signal()`+dispose churn (264 B/op). lite-perf-gate
32
+ DEFAULT thresholds, untouched (maxScavenges 2, maxRetainedKB 64, maxOldGen 0,
33
+ maxArrayBuffersKB 64).
34
+ - **Result on this engine (node v26.x): green and REAL, 10/10** -- all seven
35
+ claimed-zero paths pass under defaults, both `mustFail` controls trip. Plain
36
+ `npm test` is undisturbed (the in-glob file emits one loud named skip unless
37
+ BOTH `--expose-gc` and `--max-semi-space-size=4` are present).
38
+
7
39
  ## [1.8.0-beta] -- 2026-09-06
8
40
 
9
41
  The verification-infrastructure migration: the full 1.6.0-rc.1 / 1.7.0-beta audit
package/README.md CHANGED
@@ -868,6 +868,15 @@ If these fail, something allocates in the hot path and we want to find it before
868
868
  npm run test:gc
869
869
  ```
870
870
 
871
+ Two standing zero-GC gates back this tier. `npm run test:zgc` runs the suite's own lite-gc-profiler harness (`test/zgc/*`). `npm run test:gate` (added 1.8.0-beta.1) runs **`test/36-perf-gate.test.mjs`**, a second, library-owned judge built on **`@zakkster/lite-perf-gate`** (devDependency only): its `zgcSuite` watches five signals (scavenges / engine `stats()` counters / retainedKB / oldGen / arrayBuffersKB) at two scales with positive+negative+large detector controls, over seven claimed-zero steady-state scenarios (`set-propagate`, `computed-cache-hit`, `computed-recompute-stable`, `effect-rerun-stable`, `peek`, `batch-flush`, `box-set-propagate`) plus two permanent `mustFail` controls (a per-op `{x,y,z,w}` allocator and the documented `signal()`+dispose 264 B/op churn). Thresholds are lite-perf-gate DEFAULTS (maxScavenges 2, maxRetainedKB 64, maxOldGen 0, maxArrayBuffersKB 64) -- a claimed-zero path that cannot meet defaults is a finding, not a config knob. Both lanes are chained by `test:all`.
872
+
873
+ ```bash
874
+ npm run test:zgc # lite-gc-profiler harness (requires --expose-gc --max-semi-space-size=4)
875
+ npm run test:gate # lite-perf-gate judge; same two flags, else one loud named skip
876
+ ```
877
+
878
+ `test:gate` runs REAL only under both `--expose-gc` and `--max-semi-space-size=4` (young-gen sensitivity); the script sets both. Under plain `npm test` / `test:gc` the in-glob file emits one loud named skip -- never a silent pass, never a false red.
879
+
871
880
  ### Tier 3 -- Performance (comparative benchmark)
872
881
 
873
882
  `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes; the aggregate output is [`bench/r.txt`](./bench/r.txt) (four engines: lite, alien, preact, solid). Cross-framework standing comes from the **mirror** (`node --expose-gc bench/mirror.mjs --self-verify` then `bench/sweep.mjs`), which runs Andrii's canonical adapter verbatim so rows diff 1:1 against his log; the aggregate output is [`bench/rb.txt`](./bench/rb.txt) (lite vs alien, all 47 shapes). Every output carries a machine-generated `#STAMP` (engine + harness sha256, the live registry config, host, node), so a header can never disagree with the code that ran. The pre-v3 five-framework reactivity suite was **removed after 1.5.1** (bench protocol v3). Full methodology: [`bench/README.md`](./bench/README.md).
package/Signal.d.ts CHANGED
@@ -195,6 +195,14 @@ export interface NodeDescriptor {
195
195
  value: unknown;
196
196
  }
197
197
 
198
+ /**
199
+ * Opaque, gen-stamped lifecycle-owner handle returned by {@link getOwner} (1.7.0).
200
+ * Structurally a {@link NodeDescriptor} -- the same ABA-guarded handle `describe`
201
+ * returns -- so it is also re-walkable through `forEachOwned` / `ownerOf` / `nodeId`.
202
+ * Pass it back to {@link runWithOwner}; a stale one degrades to rooted execution.
203
+ */
204
+ export type OwnerHandle = NodeDescriptor;
205
+
198
206
  /** Transition callbacks for {@link Registry.observeObservers}. */
199
207
  export interface ObserveObserversHooks {
200
208
  /** Fired on the 0->1 observer transition (after registration). */
@@ -280,6 +288,27 @@ export interface RegistryConfig {
280
288
  onCapacityExceeded?: "throw" | "grow";
281
289
  /** Max effect-queue drain passes before a flush-cycle `Error` (message prefixed `"CycleError:"`) is thrown. Default: 100. */
282
290
  maxFlushPasses?: number;
291
+ /**
292
+ * When effects auto-deliver (1.7.0). Resolved ONCE at registry init into two
293
+ * closure-captured `const` booleans, so the chosen body is a JIT constant --
294
+ * `"eager"` emits code byte-identical to 1.6.0. Default: `"eager"`.
295
+ *
296
+ * - `"eager"`: a `.set` outside `batch()` auto-flushes; `batch()` exit
297
+ * auto-flushes. The 1.0-1.6 behaviour; no existing user sees a change.
298
+ * - `"sab"` (**stable-after-batch**): a `.set` outside `batch()` writes the
299
+ * value and marks downstream, but does NOT flush -- effects stay queued
300
+ * (deduped via `FLAG_SCHEDULED`) until `batch()` exit or an explicit
301
+ * {@link Registry.flush}. Matches Reflex-style delivery semantics.
302
+ * - `"manual"`: neither a `.set` nor a `batch()` exit auto-flushes. Only
303
+ * {@link Registry.flush} drains the queue -- for frame-aligned settle
304
+ * points in hard-real-time loops.
305
+ *
306
+ * In every mode the WRITE is eager and `computed` pull stays correct: only
307
+ * effect *delivery* is deferred, never the value.
308
+ *
309
+ * @throws Error if the value is not one of the three tokens.
310
+ */
311
+ flushStrategy?: "eager" | "sab" | "manual";
283
312
  }
284
313
 
285
314
  /** Isolated reactive graph. Created by {@link createRegistry}. */
@@ -326,7 +355,33 @@ export interface Registry {
326
355
  */
327
356
  dispose(api: Disposable): void;
328
357
  batch<T>(fn: () => T): T;
358
+ /**
359
+ * Drain the effect queue now (1.7.0). Available in every
360
+ * {@link RegistryConfig.flushStrategy}: a no-op in `"eager"` (which already
361
+ * auto-flushes), the escape hatch for an idle-write backlog in `"sab"`, and
362
+ * the ONLY settle point in `"manual"`. Re-entrant calls are no-ops (the
363
+ * `isFlushing` guard); an empty queue exits immediately.
364
+ */
365
+ flush(): void;
329
366
  untrack<T>(fn: () => T): T;
367
+ /**
368
+ * Capture the currently-active lifecycle owner as an opaque, gen-stamped
369
+ * handle -- `undefined` outside any effect/computed body (1.7.0; carried
370
+ * forward from 1.5.0-beta.2). Companion to {@link Registry.runWithOwner}.
371
+ * Safe to hold across an `await`: the handle carries the pool slot's `gen`,
372
+ * so a dispose-and-recycle of that slot is detected on restore (ABA guard).
373
+ */
374
+ getOwner(): OwnerHandle | undefined;
375
+ /**
376
+ * Run `fn` with `ownerHandle` reinstated as the current lifecycle owner
377
+ * (1.7.0): effects/computeds created directly in `fn` are adopted by it and
378
+ * cascade-dispose when it re-runs. Tracking is nulled for `fn`'s direct body
379
+ * (same pairing as {@link Registry.createRoot}), so no cross-async dependency
380
+ * edge can form. A stale, `null`, `undefined`, or non-tracker handle degrades
381
+ * to **rooted execution** rather than adopting into a recycled slot's new
382
+ * resident. Returns whatever `fn` returns.
383
+ */
384
+ runWithOwner<T>(ownerHandle: OwnerHandle | null | undefined, fn: () => T): T;
330
385
  /** True iff a read RIGHT NOW would record a dependency on this registry.
331
386
  * False inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and
332
387
  * outside any observer. Use for lazy-allocation wrappers like lite-store. */
@@ -403,7 +458,13 @@ export function createScope<T>(fn: (dispose: () => void) => T): T;
403
458
  /** Universal disposal -- see {@link Registry.dispose}. */
404
459
  export function dispose(api: Disposable): void;
405
460
  export function batch<T>(fn: () => T): T;
461
+ /** Drain the default registry's effect queue now (1.7.0). See {@link Registry.flush}. */
462
+ export function flush(): void;
406
463
  export function untrack<T>(fn: () => T): T;
464
+ /** Capture the default registry's current lifecycle owner (1.7.0). See {@link Registry.getOwner}. */
465
+ export function getOwner(): OwnerHandle | undefined;
466
+ /** Run `fn` with `ownerHandle` reinstated on the default registry (1.7.0). See {@link Registry.runWithOwner}. */
467
+ export function runWithOwner<T>(ownerHandle: OwnerHandle | null | undefined, fn: () => T): T;
407
468
  /** Top-level binding of {@link Registry.isTracking} against the default registry. */
408
469
  export function isTracking(): boolean;
409
470
  /** Top-level binding of {@link Registry.hasObservers}. */
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.8.0-beta
2
+ * @zakkster/lite-signal v1.8.0-beta.1
3
3
  * Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
4
4
  * MIT License
5
5
  * --------------------
package/llms.txt CHANGED
@@ -53,7 +53,8 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
53
53
 
54
54
  ## Version notes
55
55
 
56
- - **1.8.0-beta** (current): the verification-infrastructure migration -- the full 1.6.0-rc.1/1.7.0-beta audit toolchain forward-ported onto the 1.8.0 engine with the ENGINE BYTE-FROZEN (banner comment only). bench/torture grows 22 -> 27 scenarios (adds `contract-torture`, `interop-torture`, `retrack-dispose-torture`, `burst-profile-torture`, the opt-in `wraparound-torture`; audit-hardened runner: 3-state skip protocol, version-floor enforcement -- a skip at/above floor FAILS -- per-scenario wall-clock caps, assert-nothing detection). THIS folder's richer natives KEPT over the canonical copies: `cleanup-return-torture` (section 6b pins the 1.8 severTail cursor-repair by mechanism), `lifecycle-torture` (createScope-native root-vs-scope differential), the 1.8.0-re-anchored capacity/deep-chain/error scenarios, `harness/smoke.mjs`, `test/30` at 1.8.0 line refs, and the `test/34` config pair (OOM rows in a child under a 256MB cap). New lanes: `test/zgc/` (`test:zgc` + `test:zgc:report`), `test/ProfilerTests/` (`test:hardening`), `test/35` devtools-zerogc probe; `test/25` REWRITTEN against **devtools 1.6.2** (live-probed 13-key fingerprint -- `cleanupReturn:T` is the one flip vs 1.7.0; `flushControl:T`, `statsKeys:14`; 14 tests). Harness gains `mint-anatomy` (re-measured IDENTICAL for the fourth engine running: signal 264 / computed 208 / effect 160 / boxes 56 B/op all-space -- the out-of-line cleanup-return ladder is provably off the creation path), `visit-anatomy --verify` (21 exact structural pins hold with NO re-anchor needed -- the cleanup ladder adds no eq-dispatch site; both failure paths re-witnessed in scratch clones), `jit-health --strict` (4 handle families monomorphic; fresh Node-26 deopt baseline), costmodel / floors / trend / creation-anatomy / burst-real, and the phase-3 rewrites of andrii-isolated / creation-isolated / owner-hazard-repro. VersionMatrix carries the read + creation + exact-counter lanes with trimmed-spread aggregation and the NO-EVIDENCE refusal; **GATE PASSED 5/5** vs floor-1.3.0 + rolling-1.5.0 (creation counters exact: 288 allocs/frame, 0 poolGrowths, zero variance over 1500 frames). Verified ladder on node v26.3.1: unit 539/540 (0 fail, 1 skip), torture 25/2/0 in 30.6s, wraparound full-distance 12/12, zgc 7/7 + report 3/3, hardening 22/0/6, harness 5/5, ZEROGC_BREAK=1|transient and BURST_BREAK=drop7|ghost6 all exit 1. devDeps: devtools ^1.6.2, gc-profiler ^1.16.0; test scripts glob-scoped ('test/*.test.mjs'); the stale `bench-reactive` script dropped (its target was removed at 1.6.0-beta). See CHANGELOG `[1.8.0-beta]`.
56
+ - **1.8.0-beta.1** (current): verification + docs increment -- no engine change past the banner comment (`Signal.js` byte-identical, banner line only). Ports the standing **perf-gate lane** from the canonical 1.5.2 line: `test/36-perf-gate.test.mjs` + `npm run test:gate` (`node --expose-gc --max-semi-space-size=4`), chained into `test:all` after `test:zgc`. Wires **`@zakkster/lite-perf-gate`** (devDependency only) as a second, library-owned zero-GC judge beside the bespoke `test:zgc` harness: `zgcSuite` watches five signals (scavenges / engine `stats()` counters / retainedKB / oldGen / arrayBuffersKB) at two scales with positive+negative+large detector controls, over seven claimed-zero steady-state scenarios (set-propagate, computed-cache-hit, computed-recompute-stable, effect-rerun-stable, peek, batch-flush, box-set-propagate) plus two permanent `mustFail` controls (per-op `{x,y,z,w}` allocator; the documented `signal()`+dispose 264 B/op churn). Thresholds are lite-perf-gate DEFAULTS, untouched. Green and REAL on this engine (10/10); the in-glob file emits one loud named skip unless both flags are set, so plain `npm test` is undisturbed. See CHANGELOG `[1.8.0-beta.1]`.
57
+ - **1.8.0-beta**: the verification-infrastructure migration -- the full 1.6.0-rc.1/1.7.0-beta audit toolchain forward-ported onto the 1.8.0 engine with the ENGINE BYTE-FROZEN (banner comment only). bench/torture grows 22 -> 27 scenarios (adds `contract-torture`, `interop-torture`, `retrack-dispose-torture`, `burst-profile-torture`, the opt-in `wraparound-torture`; audit-hardened runner: 3-state skip protocol, version-floor enforcement -- a skip at/above floor FAILS -- per-scenario wall-clock caps, assert-nothing detection). THIS folder's richer natives KEPT over the canonical copies: `cleanup-return-torture` (section 6b pins the 1.8 severTail cursor-repair by mechanism), `lifecycle-torture` (createScope-native root-vs-scope differential), the 1.8.0-re-anchored capacity/deep-chain/error scenarios, `harness/smoke.mjs`, `test/30` at 1.8.0 line refs, and the `test/34` config pair (OOM rows in a child under a 256MB cap). New lanes: `test/zgc/` (`test:zgc` + `test:zgc:report`), `test/ProfilerTests/` (`test:hardening`), `test/35` devtools-zerogc probe; `test/25` REWRITTEN against **devtools 1.6.2** (live-probed 13-key fingerprint -- `cleanupReturn:T` is the one flip vs 1.7.0; `flushControl:T`, `statsKeys:14`; 14 tests). Harness gains `mint-anatomy` (re-measured IDENTICAL for the fourth engine running: signal 264 / computed 208 / effect 160 / boxes 56 B/op all-space -- the out-of-line cleanup-return ladder is provably off the creation path), `visit-anatomy --verify` (21 exact structural pins hold with NO re-anchor needed -- the cleanup ladder adds no eq-dispatch site; both failure paths re-witnessed in scratch clones), `jit-health --strict` (4 handle families monomorphic; fresh Node-26 deopt baseline), costmodel / floors / trend / creation-anatomy / burst-real, and the phase-3 rewrites of andrii-isolated / creation-isolated / owner-hazard-repro. VersionMatrix carries the read + creation + exact-counter lanes with trimmed-spread aggregation and the NO-EVIDENCE refusal; **GATE PASSED 5/5** vs floor-1.3.0 + rolling-1.5.0 (creation counters exact: 288 allocs/frame, 0 poolGrowths, zero variance over 1500 frames). Verified ladder on node v26.3.1: unit 539/540 (0 fail, 1 skip), torture 25/2/0 in 30.6s, wraparound full-distance 12/12, zgc 7/7 + report 3/3, hardening 22/0/6, harness 5/5, ZEROGC_BREAK=1|transient and BURST_BREAK=drop7|ghost6 all exit 1. devDeps: devtools ^1.6.2, gc-profiler ^1.16.0; test scripts glob-scoped ('test/*.test.mjs'); the stale `bench-reactive` script dropped (its target was removed at 1.6.0-beta). See CHANGELOG `[1.8.0-beta]`.
57
58
  - **1.8.0-alpha.7**: backports the **1.4.5 `createRegistry` input validation** (all four findings) onto the 1.8.0-alpha.6 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.8.0-alpha.7]`.
58
59
  - **1.8.0-alpha.4**: the **effect-cleanup-return minor**. An EFFECT body
59
60
  may now `return` a cleanup function (Solid/Vue/Reflex-compatible), run at the same
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.8.0-beta",
3
+ "version": "1.8.0-beta.1",
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",
@@ -35,7 +35,8 @@
35
35
  "test:harness": "npm --prefix harness/ProfilerTools test",
36
36
  "test:zgc": "node --expose-gc --max-semi-space-size=4 --test 'test/zgc/*.test.mjs'",
37
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",
38
+ "test:gate": "node --expose-gc --max-semi-space-size=4 --test test/36-perf-gate.test.mjs",
39
+ "test:all": "npm test && npm run test:hardening && npm run test:harness && npm run test:zgc && npm run test:gate",
39
40
  "bench": "node --expose-gc bench/benchmark.mjs",
40
41
  "harness": "node harness/run.mjs",
41
42
  "harness:smoke": "node harness/run.mjs smoke",
@@ -92,6 +93,7 @@
92
93
  "devDependencies": {
93
94
  "@zakkster/lite-devtools": "^1.6.2",
94
95
  "@zakkster/lite-gc-profiler": "^1.16.0",
96
+ "@zakkster/lite-perf-gate": "^1.4.2",
95
97
  "@zakkster/lite-profiler": "^1.1.0",
96
98
  "@zakkster/lite-profiler-signal": "^1.2.0",
97
99
  "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",