@zakkster/lite-signal 1.8.0-alpha.1 → 1.8.0-alpha.3

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,54 @@ 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
+ ## [Unreleased]
8
+
9
+ ### Changed -- bench protocol v3 (carried forward)
10
+
11
+ The `bench/` harness is bench protocol v3: three instruments (microscope / mirror /
12
+ version-economics), each with a fixed config and a machine-generated `#STAMP`
13
+ (engine + harness sha256, live registry config, host, node). The pre-v3
14
+ five-framework reactivity suite was removed after 1.5.1. See `bench/README.md`.
15
+
16
+ ### Added -- Coveralls coverage badge
17
+
18
+ README carries a Coveralls badge; lcov is produced by `npm run test:report`
19
+ (`coveralls-next` in devDependencies).
20
+
21
+
22
+ ### Fixed -- dangling re-tracking cursor on source disposal (crash)
23
+
24
+ Disposing a signal/computed from inside an observer that had linked it on the
25
+ previous run, but had not yet re-read it on the current run, crashed with
26
+ `TypeError: Cannot set properties of null (setting 'headSub')`. `disposeNode`'s
27
+ sub-list teardown freed the link while the observer's re-tracking cursor
28
+ (`activeObserverCurrentDep`) was still parked on it; `severTail` then walked from
29
+ a freed link, wiped the observer's `headDep`, and double-freed the link. Reachable
30
+ from the plain public API, and it composes with the new cleanup-return path (the
31
+ effect's returned cleanup still runs). Fixed with a one-line cursor repair in
32
+ `disposeNode` (advance the cursor to the next surviving dep before the free);
33
+ O(1), disposal path only, no steady-state cost. The now-dead `freeLink` `-1`
34
+ defensive ternaries were removed with it (replaced by the always-live `source.id`
35
+ / `target.id`). Pinned by a regression test to add to `test/12-coverage.test.mjs`.
36
+
37
+ **Coverage:** the full box/owner/opcode closure suite (ported forward from 1.7.0)
38
+ plus this fix and a test for the new cleanup-return array-append arm bring
39
+ `Signal.js` to **100% statements / branches / functions / lines** (484 tests,
40
+ 483 pass, 1 skip). The two provably-unreachable clamps (link-ledger,
41
+ `batchEpoch` 2^32 wraparound) carry `/* c8 ignore */` with proofs. See
42
+ `COVERAGE-NOTES.md`; reconfirm under codify.
43
+
44
+ **Hot-path parity note:** this touches `disposeNode` and `freeLink`; re-baseline the
45
+ VersionMatrix engine sha256 on the next publish. `executeEffect` also changed on
46
+ this line for cleanup-return, independently.
47
+
48
+ ### Changed -- test file numbering
49
+
50
+ `test/28-scope.test.mjs` renamed to `test/29-scope.test.mjs` to resolve the
51
+ duplicate `28-` prefix it shared with `28-run-with-owner.test.mjs` (carried over
52
+ from the 1.7.0 fix; `createScope` is the 1.6.0 primitive, sequenced after
53
+ `runWithOwner`).
54
+
7
55
  ## [1.8.0-preview] -- 2026-07-XX
8
56
 
9
57
  The **effect cleanup return** minor -- Reflex-study pattern A. One additive
@@ -532,7 +580,7 @@ they produce are reproducible, comparable, and engine-version-aware.
532
580
 
533
581
  - **Full suite green** against the 1.6.0 engine: 443 tests, 442 pass, 0 fail,
534
582
  1 skip (only the architecturally-N/A SSR case in `17-reactivity`). +4
535
- `createScope` tests in `test/28-scope_test.mjs`; the 1.5.0 box and createRoot
583
+ `createScope` tests in `test/29-scope_test.mjs`; the 1.5.0 box and createRoot
536
584
  suites carry forward unchanged. **Coverage** (c8@11, Node 22): `Signal.js`
537
585
  100% statements / 96.96% branches / 100% functions / 100% lines; `Watch.js`
538
586
  100% across all four. The branch drop vs 1.5.0 (97.35% -> 96.96%) is the
package/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@zakkster/lite-signal?style=for-the-badge)](https://bundlephobia.com/result?p=@zakkster/lite-signal)
10
10
  [![npm downloads](https://img.shields.io/npm/dm/@zakkster/lite-signal?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@zakkster/lite-signal)
11
11
  [![npm total downloads](https://img.shields.io/npm/dt/@zakkster/lite-signal?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@zakkster/lite-signal)
12
+ [![Coverage Status](https://coveralls.io/repos/github/PeshoVurtoleta/lite-signal/badge.svg?branch=main)](https://coveralls.io/github/PeshoVurtoleta/lite-signal?branch=main)
12
13
  ![Tree-Shakeable](https://img.shields.io/badge/tree--shakeable-yes-brightgreen)
13
14
  ![TypeScript](https://img.shields.io/badge/TypeScript-Types-informational)
14
15
  ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
@@ -810,33 +811,33 @@ Three tiers, all reproducible.
810
811
 
811
812
  `npm test` runs the suite in `test/`, covering:
812
813
 
813
- - **`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.
814
- - **`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`).
815
- - **`03-pool_test.mjs`** -- `CapacityError` under both `"throw"` and `"grow"` policies, the 16× link ceiling, stable pool reuse across thousands of create/dispose cycles, registry isolation, (1.3.0) the lazy-prealloc paths: on-demand construction reaching the same steady state as eager, a never-allocated lazy registry surviving `destroy()`, and `"grow"` extending both pool ledgers past their initial capacity, and (1.4.0) the `stats()` lifecycle counters: the 11-key shape, `totalAllocations` / `totalDisposals` tracking the `activeNodes` live invariant, `poolGrowths` firing on growth and staying 0 on a correctly-sized eager pool, and `destroy()` resetting all three.
816
- - **`05-scheduler_test.mjs`** -- scheduler-deferred effects, dispose-during-schedule races, microtask integration, 32-bit version wrap (simulated), `setDefaultRegistry`, `onCleanup` inside computeds.
817
- - **`06-nested-objects_test.mjs`** -- array mutation patterns (push/splice/spread), deep nested paths, Map/Set/Date inside signals, custom structural equality, computed memoisation cutoffs over object slices, signal-of-signals composition, high-frequency object updates, batched immutable updates.
818
- - **`07-dispose_test.mjs`** -- unified `dispose(api)` across signals, computeds and effect handles, idempotency, cross-registry isolation (per-registry Symbol prevents pool corruption), foreign-value safety, top-level helper routing, 500-cycle balanced churn leaving pool and stats stable.
819
- - **`08-watch_test.mjs`** -- Validates the user-land observer utilities (watch, when, whenAsync). Covers lifecycle teardown, old/new value tracking, and Promise-based asynchronous state resolution.
820
- - **`09-conformance_test.mjs`** -- Industry-standard conformance tests. Validates the engine against extreme edge cases from the johnsoncodehk reactive test suite, ensuring strict zero-GC invariants, correct cleanup isolation, and re-entrant stability.
821
- - **`10-is-tracking_test.mjs`** -- The `isTracking()` observer-context predicate. 11 tests across 5 describe blocks: true inside effect/computed bodies; false inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and `watch` callbacks (the untracked-window cases that catch an observer-only misimplementation); false outside any observer including at the call site of an unobserved computed read; state-restoration after a thrown body; per-registry isolation; top-level binding.
822
- - **`11-adopted-reactive_test.mjs`** -- 24 engine-agnostic edge cases adopted from across the ecosystem: alien-signals' parent-child link-integrity regression (#226-228), equality-predicate corners (preact/solid/vue), `signal.update(fn)` functional setter (vue/solid), `peek()` non-subscription depth (preact/vue), and the `subscribe` behavioral contract (preact/mobx).
823
- - **`12-coverage_test.mjs`** -- 18 targeted exercises for public surface and hot-path branches the behavioral suites don't incidentally hit: top-level routing to the default registry, the computed clean-read short-circuit (`markEpoch` O(1) skip), dependency-set shrink severing the stale tail, error/structural edge paths, scheduler ABA across a recycled pool slot, and the v1.2 owner-tree paths (direct-child detach, cascade tolerates an already-freed child). Capability-gated via a runtime probe, so the same file runs unchanged across engines.
824
- - **`13-introspection_test.mjs`** -- The observer-lifecycle surface (1.1.4). 10 tests across 3 describe blocks: `hasObservers` (live observation reflects; a peek doesn't count), `observeObservers` auto-pause lifecycle (start-on-first / stop-on-last, no extra connect for a 2nd observer, re-observe fires again, no churn on re-track, conditional reads toggle honestly, transition-only registration, works for computeds), and `forEachObserver`/`forEachSource` enumeration (both directions; descriptor carries kind + value).
825
- - **`14-lifecycle-teardown_test.mjs`** -- Effect-teardown guards against the alien-signals@3.2.1 regressions (4 tests). A stopped effect must not re-subscribe to a signal read later in the same run; self-dispose must leave no orphaned link (clean `activeLinks`); a throwing setup must leave no live subscription; normal and dynamic re-tracking stay unaffected by the `allocateLink` eligibility gate.
826
- - **`15-owner-lazy-alloc_test.mjs`** -- Owner-adoption contract for the 1.2.0 owner tree (5 tests). A signal allocated lazily *inside* a computed/effect must **not** be owner-adopted (it survives the owner's re-run -- the lite-store/lite-form lazy-field shape) and sibling lazy signals must not cross-wire, while observers (nested effect/computed) *are* still auto-disposed on the owner's re-run.
827
- - **`16-alien-parity_test.mjs`** -- Differential regression guards (3 tests) reproducing the *properties* behind alien-signals@3.2.0 fixed bugs: reads inside a cleanup create no spurious dependencies (the dispose-cleanup fix); an inner-effect write does not block later propagation through a computed chain (#112); a dynamic dependency-set change stays correct under dirty-check (#109/#110).
828
- - **`17-reactivity_test.mjs`** -- Behavioral suite (~30 tests across 11 groups) mirroring universal signal-system bug classes: subscription lifecycle, cleanup ordering, stale-dependency tracking, batching/timing (incl. set-then-revert), equality cutoff (NaN/+/-0/custom), nested invalidation + glitch-free diamond, memory/retained nodes, the synchronous async-boundary, scheduler & loops (self-write termination, self-reading computed), and differential-review additions (cached computed errors, mid-batch pull, self-disposing getter, pooled-slot return). SSR hydration is a documented N/A -- lite has no DOM layer.
829
- - **`18-identity_test.mjs`** -- Node identity (1.1.5; 5 tests). Unique/stable ids; `nodeId`/`describe` return `undefined` for a non-handle; the descriptor's visible shape is `{ id, kind, value }`; `forEach*` descriptors carry `id` and are **re-walkable** (`nodeId`/`forEachSource` accept a descriptor); identity walks are non-perturbing (add no observers).
830
- - **`19-v12-additions_test.mjs`** -- v1.2.0 release-prep regressions (24 tests across 8 suites). Shared `peek` (one closure per registry, identical reference across primitives, no tracking, two registries hold independent peeks). Owner-adoption rule (signals not adopted, computeds/effects adopted, cascade drains correctly). Pre-batch revert (signal-level, propagates through computeds, respects custom `equals`, nested batches, final-different-value still fires). Multi-throw aggregation (`AggregateError` with both errors carried, single-throw unwrapped, engine survives). `CycleError` via `maxFlushPasses` (default + custom). `maxLinks` config branch under `throw` and `grow`. Documented disposed-signal semantics (read undefined, set silent no-op, dispose idempotent). Scheduler-thunk ABA guard across a recycled pool slot.
831
- - **`20-axis-stress_test.mjs`** -- engine-invariant regression guards along eight orthogonal "axes" (16 tests across 9 suites). Pins lite-signal's actual contract on: batch semantics under exception (writes commit; pre-batch revert holds; effects see the post-throw value), connect/disconnect lifecycle re-entrancy (`observeObservers` from inside an `onConnect`, transition-only registration), untrack does NOT suppress owner adoption (a nested effect created via `untrack` is still owner-cascaded), untrack inside a computed body (no hidden dep leaks; tracked source re-evaluates), queue safety under self-dispose mid-flush (no UAF), value-dependent cycle detection (computed graph closes a cycle, `CycleError` thrown), nested-effect creation order (effects run synchronously on creation; immediately-stopped one still ran), synchronous flush (no scheduler in the default path; batch coalesces). Plus a bonus suite: 1,000 effect-create-then-dispose cycles return pool to baseline; `dispose()` idempotent; `dispose()` on foreign values safe.
832
- - **`21-perf-pins_test.mjs`** -- v1.2.1 construction-shape pins (6 tests). Locks the canonical handle shapes (`signal` 6 own props: peek/set/update/subscribe + NODE_PTR/NODE_GEN; `computed` 4: peek/subscribe + NODE_PTR/NODE_GEN) so a future "let's unify them" change has to be explicit. Locks the 1.2.1 ABA guards: detached `const {set} = signal()` keeps working on a LIVE signal; `read()` returns `undefined` and skips dep-tracking on a stale handle (no phantom subscription to the recycled slot); `set()` on a stale handle is a no-op across three corruption tiers (disposed slot, recycled slot, downstream propagation); `peek()` returns `undefined` for stale signal and computed handles.
833
- - **`22-mutation-hook_test.mjs`** -- 1.2.1 `onGraphMutation` semantics (12 tests across 2 suites). Registration: unsubscribe returns a function; `null` argument clears and the unsub restores the prior listener; non-function/non-null throws `TypeError`; multiple registrations stack LIFO; registries are isolated (no cross-talk). Opcode emission: `1` node-create fires with `(id, flags)` for signal (32) / computed (1) / effect (2); `2` node-dispose fires for cascade-disposed owned children; `3` link-add fires with `(source.id, target.id)` on dependency record; `4` link-remove fires when a dep-set flip severs the tail; `5` recompute fires on initial eval AND re-eval; the hook fires synchronously inside the mutation (listener sees its own event before the caller returns); payload is always three plain numbers -- no objects, no closures.
834
- - **`23-owner-introspection_test.mjs`** -- 1.2.1 owner-tree introspection + effect-disposer regression (22 tests across 4 suites). `ownerOf`: undefined for top-level / garbage input / stale handle; returns the enclosing effect's descriptor for a child created inside an effect body. `forEachOwned`: no-op for handles with no owned children / garbage input / stale handle; iterates owned children as `{id, kind, value}` descriptors. Gen-guarded introspection (ABA fix): `nodeId` / `describe` / `hasObservers` return undefined / false for stale handles; `observeObservers` throws `TypeError`; `forEachObserver` / `forEachSource` are no-ops; descriptors returned by `describeNode` are themselves gen-stamped so a descriptor obtained pre-recycle correctly walks as a no-op post-recycle (the "descriptors are re-walkable handles" contract survives the guard). Plus the 1.2.1 effect-dispose-handle fix: passing the effect's disposer directly to `describe` / `nodeId` / `forEachSource` / `forEachOwned` / `ownerOf` / `hasObservers` works as a first-class introspection handle (pre-fix it was a bare closure and returned `undefined` for a *live* effect); after `fx()` dispose the same handle correctly goes stale on every entry point; the disposer's `NODE_GEN` mirrors the effect node's birthGen exactly.
835
- - **`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.
836
- - **`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.
837
- - **`28-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.
838
- - **`25-devtools-real-boot_test.mjs`** -- Devtools/Studio contract (10 tests). Boots the actual `Devtools.js` against the 1.5.0 engine and exercises all 19 Devtools exports plus the 10 symbols Studio imports from Devtools. Pins the ghost contract: heavy introspection (graph walk, owner-tree, observer descriptors) adds **zero** nodes to the live graph. Catches the real-rig failure mode where importing the package by its own name from a repo whose `package.json` declares `name: "@zakkster/lite-signal"` resolves to the published build instead of the local engine.
839
- - **`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%).
814
+ - **`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.
815
+ - **`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`).
816
+ - **`03-pool.test.mjs`** -- `CapacityError` under both `"throw"` and `"grow"` policies, the 16× link ceiling, stable pool reuse across thousands of create/dispose cycles, registry isolation, (1.3.0) the lazy-prealloc paths: on-demand construction reaching the same steady state as eager, a never-allocated lazy registry surviving `destroy()`, and `"grow"` extending both pool ledgers past their initial capacity, and (1.4.0) the `stats()` lifecycle counters: the 11-key shape, `totalAllocations` / `totalDisposals` tracking the `activeNodes` live invariant, `poolGrowths` firing on growth and staying 0 on a correctly-sized eager pool, and `destroy()` resetting all three.
817
+ - **`05-scheduler.test.mjs`** -- scheduler-deferred effects, dispose-during-schedule races, microtask integration, 32-bit version wrap (simulated), `setDefaultRegistry`, `onCleanup` inside computeds.
818
+ - **`06-nested-objects.test.mjs`** -- array mutation patterns (push/splice/spread), deep nested paths, Map/Set/Date inside signals, custom structural equality, computed memoisation cutoffs over object slices, signal-of-signals composition, high-frequency object updates, batched immutable updates.
819
+ - **`07-dispose.test.mjs`** -- unified `dispose(api)` across signals, computeds and effect handles, idempotency, cross-registry isolation (per-registry Symbol prevents pool corruption), foreign-value safety, top-level helper routing, 500-cycle balanced churn leaving pool and stats stable.
820
+ - **`08-watch.test.mjs`** -- Validates the user-land observer utilities (watch, when, whenAsync). Covers lifecycle teardown, old/new value tracking, and Promise-based asynchronous state resolution.
821
+ - **`09-conformance.test.mjs`** -- Industry-standard conformance tests. Validates the engine against extreme edge cases from the johnsoncodehk reactive test suite, ensuring strict zero-GC invariants, correct cleanup isolation, and re-entrant stability.
822
+ - **`10-is-tracking.test.mjs`** -- The `isTracking()` observer-context predicate. 11 tests across 5 describe blocks: true inside effect/computed bodies; false inside `untrack`, `subscribe` callbacks, `onCleanup` bodies, and `watch` callbacks (the untracked-window cases that catch an observer-only misimplementation); false outside any observer including at the call site of an unobserved computed read; state-restoration after a thrown body; per-registry isolation; top-level binding.
823
+ - **`11-adopted-reactive.test.mjs`** -- 24 engine-agnostic edge cases adopted from across the ecosystem: alien-signals' parent-child link-integrity regression (#226-228), equality-predicate corners (preact/solid/vue), `signal.update(fn)` functional setter (vue/solid), `peek()` non-subscription depth (preact/vue), and the `subscribe` behavioral contract (preact/mobx).
824
+ - **`12-coverage.test.mjs`** -- 18 targeted exercises for public surface and hot-path branches the behavioral suites don't incidentally hit: top-level routing to the default registry, the computed clean-read short-circuit (`markEpoch` O(1) skip), dependency-set shrink severing the stale tail, error/structural edge paths, scheduler ABA across a recycled pool slot, and the v1.2 owner-tree paths (direct-child detach, cascade tolerates an already-freed child). Capability-gated via a runtime probe, so the same file runs unchanged across engines.
825
+ - **`13-introspection.test.mjs`** -- The observer-lifecycle surface (1.1.4). 10 tests across 3 describe blocks: `hasObservers` (live observation reflects; a peek doesn't count), `observeObservers` auto-pause lifecycle (start-on-first / stop-on-last, no extra connect for a 2nd observer, re-observe fires again, no churn on re-track, conditional reads toggle honestly, transition-only registration, works for computeds), and `forEachObserver`/`forEachSource` enumeration (both directions; descriptor carries kind + value).
826
+ - **`14-lifecycle-teardown.test.mjs`** -- Effect-teardown guards against the alien-signals@3.2.1 regressions (4 tests). A stopped effect must not re-subscribe to a signal read later in the same run; self-dispose must leave no orphaned link (clean `activeLinks`); a throwing setup must leave no live subscription; normal and dynamic re-tracking stay unaffected by the `allocateLink` eligibility gate.
827
+ - **`15-owner-lazy-alloc.test.mjs`** -- Owner-adoption contract for the 1.2.0 owner tree (5 tests). A signal allocated lazily *inside* a computed/effect must **not** be owner-adopted (it survives the owner's re-run -- the lite-store/lite-form lazy-field shape) and sibling lazy signals must not cross-wire, while observers (nested effect/computed) *are* still auto-disposed on the owner's re-run.
828
+ - **`16-alien-parity.test.mjs`** -- Differential regression guards (3 tests) reproducing the *properties* behind alien-signals@3.2.0 fixed bugs: reads inside a cleanup create no spurious dependencies (the dispose-cleanup fix); an inner-effect write does not block later propagation through a computed chain (#112); a dynamic dependency-set change stays correct under dirty-check (#109/#110).
829
+ - **`17-reactivity.test.mjs`** -- Behavioral suite (~30 tests across 11 groups) mirroring universal signal-system bug classes: subscription lifecycle, cleanup ordering, stale-dependency tracking, batching/timing (incl. set-then-revert), equality cutoff (NaN/+/-0/custom), nested invalidation + glitch-free diamond, memory/retained nodes, the synchronous async-boundary, scheduler & loops (self-write termination, self-reading computed), and differential-review additions (cached computed errors, mid-batch pull, self-disposing getter, pooled-slot return). SSR hydration is a documented N/A -- lite has no DOM layer.
830
+ - **`18-identity.test.mjs`** -- Node identity (1.1.5; 5 tests). Unique/stable ids; `nodeId`/`describe` return `undefined` for a non-handle; the descriptor's visible shape is `{ id, kind, value }`; `forEach*` descriptors carry `id` and are **re-walkable** (`nodeId`/`forEachSource` accept a descriptor); identity walks are non-perturbing (add no observers).
831
+ - **`19-v12-additions.test.mjs`** -- v1.2.0 release-prep regressions (24 tests across 8 suites). Shared `peek` (one closure per registry, identical reference across primitives, no tracking, two registries hold independent peeks). Owner-adoption rule (signals not adopted, computeds/effects adopted, cascade drains correctly). Pre-batch revert (signal-level, propagates through computeds, respects custom `equals`, nested batches, final-different-value still fires). Multi-throw aggregation (`AggregateError` with both errors carried, single-throw unwrapped, engine survives). `CycleError` via `maxFlushPasses` (default + custom). `maxLinks` config branch under `throw` and `grow`. Documented disposed-signal semantics (read undefined, set silent no-op, dispose idempotent). Scheduler-thunk ABA guard across a recycled pool slot.
832
+ - **`20-axis-stress.test.mjs`** -- engine-invariant regression guards along eight orthogonal "axes" (16 tests across 9 suites). Pins lite-signal's actual contract on: batch semantics under exception (writes commit; pre-batch revert holds; effects see the post-throw value), connect/disconnect lifecycle re-entrancy (`observeObservers` from inside an `onConnect`, transition-only registration), untrack does NOT suppress owner adoption (a nested effect created via `untrack` is still owner-cascaded), untrack inside a computed body (no hidden dep leaks; tracked source re-evaluates), queue safety under self-dispose mid-flush (no UAF), value-dependent cycle detection (computed graph closes a cycle, `CycleError` thrown), nested-effect creation order (effects run synchronously on creation; immediately-stopped one still ran), synchronous flush (no scheduler in the default path; batch coalesces). Plus a bonus suite: 1,000 effect-create-then-dispose cycles return pool to baseline; `dispose()` idempotent; `dispose()` on foreign values safe.
833
+ - **`21-perf-pins.test.mjs`** -- v1.2.1 construction-shape pins (6 tests). Locks the canonical handle shapes (`signal` 6 own props: peek/set/update/subscribe + NODE_PTR/NODE_GEN; `computed` 4: peek/subscribe + NODE_PTR/NODE_GEN) so a future "let's unify them" change has to be explicit. Locks the 1.2.1 ABA guards: detached `const {set} = signal()` keeps working on a LIVE signal; `read()` returns `undefined` and skips dep-tracking on a stale handle (no phantom subscription to the recycled slot); `set()` on a stale handle is a no-op across three corruption tiers (disposed slot, recycled slot, downstream propagation); `peek()` returns `undefined` for stale signal and computed handles.
834
+ - **`22-mutation-hook.test.mjs`** -- 1.2.1 `onGraphMutation` semantics (12 tests across 2 suites). Registration: unsubscribe returns a function; `null` argument clears and the unsub restores the prior listener; non-function/non-null throws `TypeError`; multiple registrations stack LIFO; registries are isolated (no cross-talk). Opcode emission: `1` node-create fires with `(id, flags)` for signal (32) / computed (1) / effect (2); `2` node-dispose fires for cascade-disposed owned children; `3` link-add fires with `(source.id, target.id)` on dependency record; `4` link-remove fires when a dep-set flip severs the tail; `5` recompute fires on initial eval AND re-eval; the hook fires synchronously inside the mutation (listener sees its own event before the caller returns); payload is always three plain numbers -- no objects, no closures.
835
+ - **`23-owner-introspection.test.mjs`** -- 1.2.1 owner-tree introspection + effect-disposer regression (22 tests across 4 suites). `ownerOf`: undefined for top-level / garbage input / stale handle; returns the enclosing effect's descriptor for a child created inside an effect body. `forEachOwned`: no-op for handles with no owned children / garbage input / stale handle; iterates owned children as `{id, kind, value}` descriptors. Gen-guarded introspection (ABA fix): `nodeId` / `describe` / `hasObservers` return undefined / false for stale handles; `observeObservers` throws `TypeError`; `forEachObserver` / `forEachSource` are no-ops; descriptors returned by `describeNode` are themselves gen-stamped so a descriptor obtained pre-recycle correctly walks as a no-op post-recycle (the "descriptors are re-walkable handles" contract survives the guard). Plus the 1.2.1 effect-dispose-handle fix: passing the effect's disposer directly to `describe` / `nodeId` / `forEachSource` / `forEachOwned` / `ownerOf` / `hasObservers` works as a first-class introspection handle (pre-fix it was a bare closure and returned `undefined` for a *live* effect); after `fx()` dispose the same handle correctly goes stale on every entry point; the disposer's `NODE_GEN` mirrors the effect node's birthGen exactly.
836
+ - **`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.
837
+ - **`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.
838
+ - **`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.
839
+ - **`25-devtools-real-boot.test.mjs`** -- Devtools/Studio contract (10 tests). Boots the actual `Devtools.js` against the 1.5.0 engine and exercises all 19 Devtools exports plus the 10 symbols Studio imports from Devtools. Pins the ghost contract: heavy introspection (graph walk, owner-tree, observer descriptors) adds **zero** nodes to the live graph. Catches the real-rig failure mode where importing the package by its own name from a repo whose `package.json` declares `name: "@zakkster/lite-signal"` resolves to the published build instead of the local engine.
840
+ - **`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%).
840
841
 
841
842
  ```bash
842
843
  npm test
@@ -844,7 +845,7 @@ npm test
844
845
 
845
846
  ### Tier 2 -- Memory (allocation-free verification)
846
847
 
847
- `npm run test:gc` runs `test/04-zero-gc_test.mjs` with `--expose-gc`:
848
+ `npm run test:gc` runs `test/04-zero-gc.test.mjs` with `--expose-gc`:
848
849
 
849
850
  - 100,000 `set()` calls on a graph with effects retain **< 200 KB** of heap.
850
851
  - 1,000 create/dispose cycles retain **< 50 KB**.
@@ -859,7 +860,7 @@ npm run test:gc
859
860
 
860
861
  ### Tier 3 -- Performance (comparative benchmark)
861
862
 
862
- `npm run bench` runs the comparative benchmark (9 scenarios -- stable fan-in/out + dynamic/layered DAGs) against alien-signals (results.txt). `npm run bench-reactive` runs the cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, and solid (resultsReactive.txt). Output is plain text -- easy to copy into PRs and changelogs.
863
+ `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes (`bench/results.txt`). 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. 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).
863
864
 
864
865
  ```bash
865
866
  npm run bench
@@ -1269,7 +1270,7 @@ npm test # behavior suite, ~1.3s
1269
1270
  npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1270
1271
  npm run test:harness # profiler-tools hardening suite
1271
1272
  npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1272
- npm run bench-reactive # 5-framework reactivity suite (resultsReactive.txt)
1273
+ node --expose-gc bench/mirror.mjs --self-verify # cross-framework mirror sweep (bench protocol v3)
1273
1274
  npm run harness:smoke # flushStrategy semantics -- asserts
1274
1275
  npm run harness:all # smoke + field + dispose + churn probes
1275
1276
  npm run gate # cold-process version-matrix regression gate (also runs on prepublish)
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.8.0
2
+ * @zakkster/lite-signal v1.8.0-alpha.0 (ledger #18 corrected)
3
3
  * Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
4
4
  * MIT License
5
5
  * --------------------
@@ -461,6 +461,14 @@ export function createRegistry(config) {
461
461
  if (linkPool.length > currentLinkCapacity) {
462
462
  let doubled = currentLinkCapacity;
463
463
  while (doubled < linkPool.length) doubled *= 2;
464
+ // The `> maxLinkLimit` arm is provably unreachable, retained as a clamp.
465
+ // Proof: maxLinkLimit === initialLinkCapacity * 16, currentLinkCapacity is
466
+ // only ever assigned a power-of-2 multiple of that same initial capacity,
467
+ // so 16x is ON the doubling chain (m, 2m, 4m, 8m, 16m). The guard above
468
+ // (`linkPool.length >= maxLinkLimit -> CapacityError`) plus the chunk math
469
+ // (`chunk = limit - linkPool.length`) cap linkPool.length AT maxLinkLimit,
470
+ // so `doubled` terminates at exactly 16m and can never exceed it.
471
+ /* c8 ignore next -- unreachable clamp; see proof above + COVERAGE-NOTES.md */
464
472
  currentLinkCapacity = doubled > maxLinkLimit ? maxLinkLimit : doubled;
465
473
  statPoolGrowths++; // 1.4: link capacity ledger crossed
466
474
  }
@@ -493,7 +501,12 @@ export function createRegistry(config) {
493
501
 
494
502
  /** Return a link to the free pool and unlink it from the source's sub list. @private */
495
503
  function freeLink(link, target, source) {
496
- if (mutationHook !== null) mutationHook(4, link.source !== null ? link.source.id : -1, link.target !== null ? link.target.id : -1);
504
+ // Every caller (allocateLink sever, severTail, disposeNode dep-walk) passes a
505
+ // LIVE link: `source === link.source`, `target === link.target`. The 1.3.x
506
+ // `link.source !== null ? ... : -1` guards existed only to survive a cursor
507
+ // dangling at an already-freed link -- a state disposeNode's CURSOR REPAIR now
508
+ // makes unreachable. Reading the params directly is equivalent and branch-free.
509
+ if (mutationHook !== null) mutationHook(4, source.id, target.id);
497
510
  const pSub = link.prevSub;
498
511
  const nSub = link.nextSub;
499
512
  if (pSub !== null) pSub.nextSub = nSub; else source.headSub = nSub;
@@ -604,6 +617,17 @@ export function createRegistry(config) {
604
617
  if (pDep !== null) pDep.nextDep = nDep; else target.headDep = nDep;
605
618
  if (nDep !== null) nDep.prevDep = pDep; else target.tailDep = pDep;
606
619
 
620
+ // CURSOR REPAIR (1.4.0): `target` may be an observer that is MID-RUN with
621
+ // its re-tracking cursor parked on this very link -- it linked `source` on
622
+ // the previous run, has not reached that read yet on this one, and now
623
+ // disposes `source` from its own body. Splicing the link out and handing it
624
+ // to the free list would leave activeObserverCurrentDep dangling at a freed
625
+ // slot: severTail would then read a nulled prevDep, wipe target.headDep
626
+ // (orphaning every surviving dep), and double-free the link -- freeLink
627
+ // null-derefs on `source.headSub`. Advance the cursor to the next surviving
628
+ // dep instead. Disposal path only; no steady-state cost.
629
+ if (activeObserverCurrentDep === sLink) activeObserverCurrentDep = nDep;
630
+
607
631
  sLink.source = null;
608
632
  sLink.target = null;
609
633
  sLink.prevDep = null;
@@ -943,6 +967,25 @@ export function createRegistry(config) {
943
967
  * gen-snapshot guard is the v1.2 conformance fix for #141.
944
968
  * @private
945
969
  */
970
+ // 1.12.1 (ledger #18): the cleanup-return APPEND LADDER lives here, OUT OF LINE.
971
+ // 1.8.0 inlined all 15 lines of it into executeEffect -- a hot body -- which pushed that
972
+ // body past V8's inline/code-size budget and cost 11-23% on effect-dense graphs
973
+ // (bisected: reverting ONLY that hunk restored 1.7.0 exactly). Same failure mode as
974
+ // ledger #17: BYTES, not instructions. The hot body now carries a single branch --
975
+ // `if (ret !== undefined)` -- and the common case (an effect returning nothing) is one
976
+ // undefined-compare. This cold function is entered only when a body actually returns
977
+ // something, i.e. it rides a branch that is already cold: the counter-placement rule.
978
+ // Semantics are IDENTICAL to 1.8.0: auto-detected (no API change), conditional returns
979
+ // work on any run, composes with imperative onCleanup in call order, and a self-disposed
980
+ // body (gen advanced) registers nothing -- the slot may already host a new resident.
981
+ function registerCleanupReturn(node, ret, savedGen) {
982
+ if (typeof ret !== "function" || node.gen !== savedGen) return;
983
+ const existing = node.cleanupFn;
984
+ if (existing === undefined) node.cleanupFn = ret;
985
+ else if (typeof existing === "function") node.cleanupFn = [existing, ret];
986
+ else existing.push(ret);
987
+ }
988
+
946
989
  function executeEffect(node) {
947
990
  if ((node.flags & FLAG_COMPUTING) !== 0) throw new Error("CycleError: Infinite effect loop detected.");
948
991
 
@@ -990,22 +1033,8 @@ export function createRegistry(config) {
990
1033
  const savedGen = node.gen;
991
1034
  if (mutationHook !== null) mutationHook(5, node.id, 0);
992
1035
  try {
993
- // 1.8.0 (Reflex pattern A): an effect body may RETURN a cleanup
994
- // function -- Solid/Vue-compatible ergonomics for the existing
995
- // imperative onCleanup(fn). The returned fn runs before the next
996
- // re-run and on dispose, appended with the exact onCleanup append
997
- // semantics (single fn -> pair array -> push), so the two
998
- // registration styles compose in call order. Non-function returns
999
- // are ignored; a self-disposed body (gen advanced) registers
1000
- // nothing -- the slot may already host a new resident. One typeof
1001
- // per effect run, entirely off the mark/pull path.
1002
1036
  const ret = node.computeFn();
1003
- if (typeof ret === "function" && node.gen === savedGen) {
1004
- const existing = node.cleanupFn;
1005
- if (existing === undefined) node.cleanupFn = ret;
1006
- else if (typeof existing === "function") node.cleanupFn = [existing, ret];
1007
- else existing.push(ret);
1008
- }
1037
+ if (ret !== undefined) registerCleanupReturn(node, ret, savedGen);
1009
1038
  } finally {
1010
1039
  if (node.gen === savedGen) {
1011
1040
  severTail(node);
@@ -1585,6 +1614,10 @@ export function createRegistry(config) {
1585
1614
  function batch(fn) {
1586
1615
  if (batchDepth === 0) {
1587
1616
  batchEpoch = (batchEpoch + 1) | 0;
1617
+ // 2^32 wraparound sentinel: batchEpoch is bumped ONLY here (and reset to 1 by
1618
+ // destroy()), so reaching 0 costs 4,294,967,295 top-level batch() calls. Kept
1619
+ // because revertEpoch comparisons treat 0 as "no capture".
1620
+ /* c8 ignore next -- 2^32 wraparound; unreachable without ~4.3e9 batches */
1588
1621
  if (batchEpoch === 0) batchEpoch = 1;
1589
1622
  }
1590
1623
  batchDepth = (batchDepth + 1) | 0;
package/llms.txt CHANGED
@@ -100,14 +100,15 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
100
100
  sweeps cold cost per level, confirms cached reads are O(1) via markEpoch;
101
101
  exports `pullStressScenario` + `probeOverflow`. Both import only
102
102
  `./Signal.js` + public `onGraphMutation`, run against any engine build.
103
- **Tests:** 443 total, 442 pass, 0 fail, 1 skip (only the architecturally-N/A
104
- SSR case in `17-reactivity`); +4 `createScope` tests in `test/28-scope_test.mjs`
105
- and the 1.4.0 pool tests carry the 11-key shape pin forward to the new 12-key
106
- shape with `flushPasses`. **Coverage:** `Signal.js` 100% statements / 96.96%
107
- branches / 100% functions / 100% lines; `Watch.js` 100%. The branch drop vs
108
- 1.5.0 (97.35% -> 96.96%) is the `mutationHook !== null` gate on `flushPasses`
109
- / opcodes 6+7 -- the listener-attached branch is not exercised by the
110
- default suite (which never attaches a hook). Drop-in over 1.5.0.
103
+ **Tests:** 484 total, 483 pass, 0 fail, 1 skip (only the architecturally-N/A
104
+ SSR case in `17-reactivity`); the `createScope` tests live in
105
+ `test/29-scope.test.mjs` and the pool tests carry the 12-key `flushPasses` shape
106
+ pin. **Coverage:** `Signal.js` 100% statements / 100% branches / 100% functions
107
+ / 100% lines; `Watch.js` 100% (reconfirm under codify). The box/owner/opcode
108
+ closure suite was ported forward, the source-disposal cursor-repair crash fixed,
109
+ and the new cleanup-return array-append arm covered; the two provably-unreachable
110
+ clamps (link-ledger, `batchEpoch` wraparound) carry `/* c8 ignore */`. Drop-in
111
+ over 1.5.0.
111
112
 
112
113
  - **1.5.0** (drop-in over 1.4.0): the **API-surface minor**. Two non-callable,
113
114
  allocation-light primitives -- `signalBox(initial, opts?)` returning
@@ -138,7 +139,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
138
139
  total, 438 pass, 0 fail, **1 skip** (only the architecturally-N/A SSR case in
139
140
  `17-reactivity`; the 9 originally-staged signalBox tests are now active and
140
141
  the suite carries +3 box-coverage additions for a 12-test file, +7 `createRoot`
141
- tests in `test/27-create-root_test.mjs`). **Coverage:** `Signal.js`
142
+ tests in `test/27-create-root.test.mjs`). **Coverage:** `Signal.js`
142
143
  100% statements / 97.35% branches / 100% functions / 100% lines; `Watch.js` 100%.
143
144
  Drop-in over 1.4.0.
144
145
 
@@ -160,7 +161,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
160
161
  rate (delta totalAllocations / delta t), pool-reuse ratio
161
162
  (1 - poolGrowths*initialCap/totalAllocations), and churn without the engine
162
163
  computing rates -- the series lite-devtools 1.2 / lite-studio 1.2 plot. **Tests:**
163
- 429 total, 419 pass, 0 fail, 10 skip (6 new counter tests in `test/03-pool_test.mjs`
164
+ 429 total, 419 pass, 0 fail, 10 skip (6 new counter tests in `test/03-pool.test.mjs`
164
165
  cover the 11-key shape, the live invariant, poolGrowths firing on growth vs staying
165
166
  0 on a sized eager pool, and destroy() reset). **Coverage:** `Signal.js` 100%
166
167
  statements / 98.26% branches / 100% functions / 100% lines; `Watch.js` 100%.
@@ -199,8 +200,8 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
199
200
  allocation counters (`totalAllocations` / `totalDisposals` / `poolGrowths`) remain
200
201
  reserved for 1.4.0 and are still absent. **Tests:** 423 total, 413 pass, 0 fail,
201
202
  10 skip (the 10 skips are 9 signalBox-staged-for-1.5.0 in
202
- `test/24-signalbox_test.mjs` plus 1 architecturally-N/A SSR case in
203
- `17-reactivity`); 4 new pool tests in `test/03-pool_test.mjs` cover the lazy
203
+ `test/24-signalbox.test.mjs` plus 1 architecturally-N/A SSR case in
204
+ `17-reactivity`); 4 new pool tests in `test/03-pool.test.mjs` cover the lazy
204
205
  on-demand / never-allocated-destroy / grow-extends-ledger / link-ceiling paths.
205
206
  **Coverage** (c8@11, Node 22): `Signal.js` 100% statements / 98.26% branches /
206
207
  100% functions / 100% lines; `Watch.js` 100% across all four. Behavior-
@@ -218,17 +219,17 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
218
219
  the `ReactiveNode` constructor initializes them to the same values on the
219
220
  fresh-pool-growth path -- so the redundant writes in `createNode` were
220
221
  defense against a state that cannot exist. **No public surface change, no
221
- semantic change.** New `test/26-free-list-invariant_test.mjs` (3 invariant
222
+ semantic change.** New `test/26-free-list-invariant.test.mjs` (3 invariant
222
223
  tests + 1 targeted coverage test for the swallow-on-self-dispose-then-throw
223
224
  branch in `pullComputed`) asserts the invariant directly by inspecting
224
225
  freshly-allocated nodes via the documented `describe()` -> `NODE_PTR`
225
- introspection protocol; new `test/25-devtools-real-boot_test.mjs` (10 tests)
226
+ introspection protocol; new `test/25-devtools-real-boot.test.mjs` (10 tests)
226
227
  boots the actual `Devtools.js` against the 1.2.2 engine and pins the 1.2.x
227
228
  introspection contract for downstream tooling, including the 8-key
228
229
  `stats()` shape (`signals`, `computeds`, `effects`, `activeNodes`,
229
230
  `activeLinks`, `pooledLinks`, `nodePoolCapacity`, `linkPoolCapacity`).
230
231
  408 tests total: 398 pass, 10 skip, 0 fail (the 10 skips are 9
231
- signalBox-staged-for-1.5.0 in `test/24-signalbox_test.mjs` plus 1
232
+ signalBox-staged-for-1.5.0 in `test/24-signalbox.test.mjs` plus 1
232
233
  architecturally-N/A SSR case in `17-reactivity`). Coverage on `Signal.js`:
233
234
  100% statements / 98.43% branches / 100% functions / 100% lines; `Watch.js`
234
235
  100% across all four (c8@11, Node 22) -- a branch-coverage gain over the
@@ -237,7 +238,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
237
238
  Version lineage:
238
239
  this is the engine previously labeled `1.2.3` in dev -- renumbered to
239
240
  `1.2.2` because the deletion is small, isolated, and intentionally
240
- non-behavioral. Drop-in over 1.2.1. **Bench position** (third-party
241
+ non-behavioral. Drop-in over 1.2.1. **Bench harness (protocol v3):** rebuilt around three fixed-config instruments -- microscope (`benchmark.mjs`, recommended eager config, six first-party shapes), mirror (`mirror.mjs` + `sweep.mjs`, Andrii's canonical adapter verbatim, rows diff 1:1 against his log), version-economics (`harness/toe-to-toe`) -- each output carrying a machine-generated `#STAMP` (engine + harness sha256, live registry config, host, node). Pre-v3 five-framework suite removed after 1.5.1. Methodology in `bench/README.md`. **Bench position** (third-party
241
242
  [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark),
242
243
  15 frameworks, 47 tests): #4 by geomean (75.5) at 1.77x behind alien-signals
243
244
  (1.00x), reflex (1.15x), @reactively (1.39x); now ahead of 5th-place Preact
@@ -330,7 +331,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
330
331
  own `{ id, kind, value }` descriptor, **re-walkable** (pass it back into
331
332
  `forEachObserver`/`forEachSource` to walk the full DAG); `forEach*` descriptors now carry
332
333
  `id`. One SMI write at allocation, node shape kept monomorphic -- **zero steady-state
333
- cost**. Drop-in over 1.1.4, no breaking changes. New `test/18-identity_test.mjs` (5 tests); plus `14-lifecycle-teardown`, `16-alien-parity`, and the `17-reactivity` behavioral suite.
334
+ cost**. Drop-in over 1.1.4, no breaking changes. New `test/18-identity.test.mjs` (5 tests); plus `14-lifecycle-teardown`, `16-alien-parity`, and the `17-reactivity` behavioral suite.
334
335
 
335
336
  - **1.1.4**: combined release -- a retracking rewrite plus an observer-lifecycle
336
337
  introspection surface. Drop-in over 1.1.3. **Retracking:** version-stamped O(1)
@@ -341,7 +342,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
341
342
  wide dense` 5115ms->912ms (verified by `retracking.difftest.mjs`: 20k direct + 10k batched, 0
342
343
  disagreements; no regressions elsewhere). **Introspection:** `hasObservers`,
343
344
  `observeObservers`, `forEachObserver`, `forEachSource` (top-level + per-registry), gated by
344
- an internal counter so zero steady-state cost when unused. New `test/13-introspection_test.mjs`
345
+ an internal counter so zero steady-state cost when unused. New `test/13-introspection.test.mjs`
345
346
  (10 tests). Internally staged as 1.1.4 + 1.1.5; ships as a single 1.1.4.
346
347
 
347
348
  - **1.1.3**: adds `isTracking()` (top-level + per-registry). Returns true iff a
@@ -633,32 +634,32 @@ function dumpOwnerTree(handle, depth = 0) {
633
634
 
634
635
  - `Signal.js` -- full implementation, single file.
635
636
  - `Signal.d.ts` -- TypeScript declarations for all public API.
636
- - `test/01-core_test.mjs` -- signal/computed/effect basics, equality, untrack.
637
- - `test/02-topology_test.mjs` -- diamonds, chains, fan-out/in, cycle detection.
638
- - `test/03-pool_test.mjs` -- capacity errors, grow policy, pool reuse.
639
- - `test/04-zero-gc_test.mjs` -- heap retention (run with --expose-gc).
640
- - `test/05-scheduler_test.mjs` -- scheduler races, dispose, gen counter, version wrap.
641
- - `test/06-nested-objects_test.mjs` -- nested-object & reference-identity behaviours.
642
- - `test/07-dispose_test.mjs` -- universal disposal: registry.dispose(api).
643
- - `test/08-watch_test.mjs` -- new watch reactivity tests.
644
- - `test/09-conformance_test.mjs` -- johnsoncodehk/reactive-framework-test-suite conformance fixes tests.
645
- - `test/10-is-tracking_test.mjs` -- `isTracking()` across observer bodies, untracked windows, and outside any observer.
646
- - `test/11-adopted-reactive_test.mjs` -- engine-agnostic edge cases adopted from the wider ecosystem (alien-signals link-integrity #226-228, equality-predicate corners, `update()`/`peek()`/`subscribe` contracts).
647
- - `test/12-coverage_test.mjs` -- targeted public-surface + hot-path branch coverage (top-level routing, clean-read short-circuit, tail severance, scheduler ABA); owner-tree block capability-gated.
648
- - `test/13-introspection_test.mjs` -- observer-lifecycle surface: `hasObservers`, `observeObservers` auto-pause, `forEach*` enumeration (10 tests).
649
- - `test/14-lifecycle-teardown_test.mjs` -- effect-teardown guards: stopped effect doesn't re-subscribe to a signal read later in the same run, self-dispose leaves no orphan link, throwing setup leaves no live subscription (4 tests).
650
- - `test/15-owner-lazy-alloc_test.mjs` -- owner-adoption contract for the 1.2.0 owner tree (lazy signals never adopted; observers still auto-disposed); capability-gated, skipped on 1.1.x (4 tests).
651
- - `test/16-alien-parity_test.mjs` -- differential guards vs alien-signals@3.2.0 fixed-bug classes: cleanup reads create no deps, inner write doesn't block computed-chain propagation, dynamic dep-set correct under dirty-check (3 tests).
652
- - `test/17-reactivity_test.mjs` -- behavioral suite over universal signal-system bug classes (subscription lifecycle, cleanup ordering, stale-dep tracking, batching, equality, nested invalidation, memory, sync async-boundary, scheduler/loops, + differential-review additions); SSR is N/A (~30 tests).
653
- - `test/18-identity_test.mjs` -- node identity (1.1.5): `nodeId`/`describe`, descriptor `id`, re-walkable descriptors, non-perturbing (5 tests).
654
- - `test/19-v12-additions_test.mjs` -- 1.2.0 surface coverage: shared-peek, owner-adoption rule, pre-batch revert (24 tests).
655
- - `test/20-axis-stress_test.mjs` -- eight orthogonal stress axes (batch-under-exception, connect/disconnect re-entrancy, untrack vs owner cascade, etc.) (23 tests).
656
- - `test/21-perf-pins_test.mjs` -- 1.2.1 construction-shape + ABA-guard pins (6 tests).
657
- - `test/22-mutation-hook_test.mjs` -- 1.2.1 `onGraphMutation` registration + opcode emission (12 tests).
658
- - `test/23-owner-introspection_test.mjs` -- `ownerOf`, `forEachOwned`, gen-guarded introspection (14 tests).
659
- - `test/24-signalbox_test.mjs` -- staged for 1.5.0; all tests `{skip: true}` on 1.2.x.
660
- - `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).
661
- - `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).
637
+ - `test/01-core.test.mjs` -- signal/computed/effect basics, equality, untrack.
638
+ - `test/02-topology.test.mjs` -- diamonds, chains, fan-out/in, cycle detection.
639
+ - `test/03-pool.test.mjs` -- capacity errors, grow policy, pool reuse.
640
+ - `test/04-zero-gc.test.mjs` -- heap retention (run with --expose-gc).
641
+ - `test/05-scheduler.test.mjs` -- scheduler races, dispose, gen counter, version wrap.
642
+ - `test/06-nested-objects.test.mjs` -- nested-object & reference-identity behaviours.
643
+ - `test/07-dispose.test.mjs` -- universal disposal: registry.dispose(api).
644
+ - `test/08-watch.test.mjs` -- new watch reactivity tests.
645
+ - `test/09-conformance.test.mjs` -- johnsoncodehk/reactive-framework-test-suite conformance fixes tests.
646
+ - `test/10-is-tracking.test.mjs` -- `isTracking()` across observer bodies, untracked windows, and outside any observer.
647
+ - `test/11-adopted-reactive.test.mjs` -- engine-agnostic edge cases adopted from the wider ecosystem (alien-signals link-integrity #226-228, equality-predicate corners, `update()`/`peek()`/`subscribe` contracts).
648
+ - `test/12-coverage.test.mjs` -- targeted public-surface + hot-path branch coverage (top-level routing, clean-read short-circuit, tail severance, scheduler ABA); owner-tree block capability-gated.
649
+ - `test/13-introspection.test.mjs` -- observer-lifecycle surface: `hasObservers`, `observeObservers` auto-pause, `forEach*` enumeration (10 tests).
650
+ - `test/14-lifecycle-teardown.test.mjs` -- effect-teardown guards: stopped effect doesn't re-subscribe to a signal read later in the same run, self-dispose leaves no orphan link, throwing setup leaves no live subscription (4 tests).
651
+ - `test/15-owner-lazy-alloc.test.mjs` -- owner-adoption contract for the 1.2.0 owner tree (lazy signals never adopted; observers still auto-disposed); capability-gated, skipped on 1.1.x (4 tests).
652
+ - `test/16-alien-parity.test.mjs` -- differential guards vs alien-signals@3.2.0 fixed-bug classes: cleanup reads create no deps, inner write doesn't block computed-chain propagation, dynamic dep-set correct under dirty-check (3 tests).
653
+ - `test/17-reactivity.test.mjs` -- behavioral suite over universal signal-system bug classes (subscription lifecycle, cleanup ordering, stale-dep tracking, batching, equality, nested invalidation, memory, sync async-boundary, scheduler/loops, + differential-review additions); SSR is N/A (~30 tests).
654
+ - `test/18-identity.test.mjs` -- node identity (1.1.5): `nodeId`/`describe`, descriptor `id`, re-walkable descriptors, non-perturbing (5 tests).
655
+ - `test/19-v12-additions.test.mjs` -- 1.2.0 surface coverage: shared-peek, owner-adoption rule, pre-batch revert (24 tests).
656
+ - `test/20-axis-stress.test.mjs` -- eight orthogonal stress axes (batch-under-exception, connect/disconnect re-entrancy, untrack vs owner cascade, etc.) (23 tests).
657
+ - `test/21-perf-pins.test.mjs` -- 1.2.1 construction-shape + ABA-guard pins (6 tests).
658
+ - `test/22-mutation-hook.test.mjs` -- 1.2.1 `onGraphMutation` registration + opcode emission (12 tests).
659
+ - `test/23-owner-introspection.test.mjs` -- `ownerOf`, `forEachOwned`, gen-guarded introspection (14 tests).
660
+ - `test/24-signalbox.test.mjs` -- staged for 1.5.0; all tests `{skip: true}` on 1.2.x.
661
+ - `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).
662
+ - `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).
662
663
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
663
664
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
664
665
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.8.0-alpha.1",
3
+ "version": "1.8.0-alpha.3",
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",
@@ -45,7 +45,6 @@
45
45
  "profile:burst": "node --expose-gc harness/burst-dag.mjs ./Signal.js",
46
46
  "profile:pull": "node --expose-gc harness/pull-stress.mjs",
47
47
  "gate": "node harness/VersionMatrix/pre-publish.mjs",
48
-
49
48
  "verify": "npm test && npm run harness:smoke && npm run bench"
50
49
  },
51
50
  "keywords": [
@@ -83,11 +82,11 @@
83
82
  },
84
83
  "sideEffects": false,
85
84
  "devDependencies": {
86
- "c8": "^11.0.0",
87
- "@zakkster/lite-devtools": "^1.1.0",
88
- "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
85
+ "@zakkster/lite-devtools": "^1.2.0",
89
86
  "@zakkster/lite-profiler": "^1.1.0",
90
- "@zakkster/lite-profiler-signal": "^1.2.0"
87
+ "@zakkster/lite-profiler-signal": "^1.2.0",
88
+ "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
89
+ "c8": "^11.0.0"
91
90
  },
92
91
  "overrides": {
93
92
  "@zakkster/lite-time": {