@zakkster/lite-signal 1.5.0 → 1.5.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 +69 -0
- package/Signal.js +1 -1
- package/llms.txt +10 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,75 @@ 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.5.1] -- 2026-09-05
|
|
8
|
+
|
|
9
|
+
Docs + verification patch. `Signal.js` is byte-identical to 1.5.0 except the
|
|
10
|
+
version banner comment; no API change, no behavior change. Ships the corrected
|
|
11
|
+
allocation economics below to the `latest` line while `1.6.0-rc` bakes.
|
|
12
|
+
|
|
13
|
+
### Added -- mint-cycle allocation anatomy probe (harness, no engine change)
|
|
14
|
+
|
|
15
|
+
A dedicated probe (`harness/mint-anatomy.mjs`, dispatched as `mint`) pins the
|
|
16
|
+
per-op heap cost of every creation primitive's mint+dispose cycle on a pre-grown
|
|
17
|
+
fixed-ceiling registry (`createRegistry({maxNodes:1<<16, maxLinks:1<<18,
|
|
18
|
+
onCapacityExceeded:"throw"})`). Fresh child process per (variant, warmup) cell --
|
|
19
|
+
JIT tier state poisons same-process comparisons. `Signal.js` / `Signal.d.ts`
|
|
20
|
+
untouched; this is verification + attribution only.
|
|
21
|
+
|
|
22
|
+
**Corrected numbers** (all-space B/op, node v26.3.1 darwin/arm64, pre-grown
|
|
23
|
+
throw-policy registry, slope over ops windows {1000,4000,16000} so the sampler
|
|
24
|
+
constant cancels):
|
|
25
|
+
|
|
26
|
+
| cycle (mint + dispose) | all-space B/op | note |
|
|
27
|
+
| ---------------------- | -------------: | --------------------------------------- |
|
|
28
|
+
| `signal(1)` + dispose | 264 | tier-invariant |
|
|
29
|
+
| `computed(fn)` + dispose | 208 | 4 own props, no `set`/`update` |
|
|
30
|
+
| `effect(fn)` + disposeFn() | 160 | 2-prop disposer + 3-slot context |
|
|
31
|
+
| `signalBox(1)` + dispose | 56 | `Object.create(proto)` handle, 0 closures |
|
|
32
|
+
| `computedBox(fn)` + dispose | 56 | same |
|
|
33
|
+
| dispose side (all forms) | 0 | mint-and-hold equals the cycle to +-0.3 B |
|
|
34
|
+
|
|
35
|
+
LiteStore LS-06's ~209 B for the signal cycle was a **new-space-only reading at a
|
|
36
|
+
pre-TurboFan tier**: below ~15-25k lifetime mints, ~56 B/op of closure-feedback
|
|
37
|
+
plumbing lands in OLD space, invisible to a `new_space` delta. The total was
|
|
38
|
+
always 264. `--no-turbofan` freezes the new-space witness at 208 forever;
|
|
39
|
+
`--no-maglev` shows 264 immediately; all-space totals never move (264.3 at every
|
|
40
|
+
tier). Hence the methodology rule this probe enforces (P3, and the sampling-profiler
|
|
41
|
+
cross-check in the findings): **allocation accounting must sum `space_used_size`
|
|
42
|
+
over ALL heap spaces** -- a new-space-only delta is valid only for scavenge-churn
|
|
43
|
+
characterization, never for per-op cost.
|
|
44
|
+
|
|
45
|
+
**Pooling accessor closures with their nodes -- evaluated and REJECTED (fail-open).**
|
|
46
|
+
Reusing one accessor-closure identity across dispose/reuse makes a retained stale
|
|
47
|
+
handle and a fresh handle *the same object* (`a === b`), so both holders share one
|
|
48
|
+
captured `birthGen` and the ABA gen-guard -- checked at the only place it runs and
|
|
49
|
+
pinned by `probe-c1-stale-set` / `probe-c1-stale-read` -- becomes undecidable: a
|
|
50
|
+
stale `a()` reads the recycled slot's new resident, a stale `a.set()` overwrites
|
|
51
|
+
it. That fails open; suite law is fail closed. **Fresh accessor identity per mint
|
|
52
|
+
is load-bearing** for the stale-handle contract and cannot be repaired by any stamp
|
|
53
|
+
placement. The callable path's ~264 B is therefore the documented, irreducible
|
|
54
|
+
price of `count()` / `count.set(x)` ergonomics; **`signalBox` (56 B/op, same graph,
|
|
55
|
+
same but DECIDABLE guard -- each box carries its own `NODE_GEN`) is the sanctioned
|
|
56
|
+
cheap path** (-79%). FinalizationRegistry-gated recycling is semantically sound but
|
|
57
|
+
allocates per mint, makes reuse GC-scheduled, and retains every accessor until
|
|
58
|
+
finalization -- rejected too.
|
|
59
|
+
|
|
60
|
+
Run it: `node harness/run.mjs mint [--verify]` (`--verify` applies relative pins
|
|
61
|
+
P1..P5; exit 0 iff every cell succeeded and every pin passed).
|
|
62
|
+
|
|
63
|
+
### Added -- attribution instrument set (harness-only, none ship in the tarball)
|
|
64
|
+
|
|
65
|
+
- `harness/costmodel.mjs`, `creation-anatomy.mjs` (+ child), `floors.mjs`
|
|
66
|
+
(+ `floors-history.json`), `jit-health.mjs` (+ `jit-baseline.json`),
|
|
67
|
+
`trend.mjs`, `visit-anatomy.mjs`; VersionMatrix `creation-churn` workload +
|
|
68
|
+
same-host 1.3.0/1.5.0 reference baselines. Verification instruments only.
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
|
|
72
|
+
- devDependencies: `@zakkster/lite-devtools` ^1.2.0 -> ^1.3.1,
|
|
73
|
+
`@zakkster/lite-gc-profiler` ^1.15.0 -> ^1.16.0 (the instrument versions the
|
|
74
|
+
suite is gated with). Runtime dependencies remain zero.
|
|
75
|
+
|
|
7
76
|
## [1.5.0] -- 2026-08-21
|
|
8
77
|
|
|
9
78
|
**Stable 1.5.0.** Graduates `1.5.0-rc.3` to the release line with **no further engine
|
package/Signal.js
CHANGED
package/llms.txt
CHANGED
|
@@ -16,7 +16,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
16
16
|
- **Signal**: root reactive cell. `signal(initial, { equals? })` returns a function. Call it to read (tracked), use `.peek()` to read without tracking, `.set(v)` to notify downstream, `.update(fn)` for read-modify-write, `.subscribe(fn)` for an effect-backed listener.
|
|
17
17
|
- **Computed**: lazy memoized derivation. `computed(fn, { equals? })`. Cache hits return in O(deps) (version comparison only). Cache misses re-run the body and refresh `evalVersion`. Errors are cached via `FLAG_HAS_ERROR` and re-thrown on every read until a dep changes.
|
|
18
18
|
- **Effect**: side-effect runner. `effect(fn, { scheduler? })`. Runs immediately on creation, then on any tracked dep change. Returns a dispose function. Optional scheduler defers execution (e.g., to rAF, microtask, custom frame loop).
|
|
19
|
-
- **Box (1.5.0)**: non-callable, allocation-light variants. `signalBox(initial, { equals? })` returns `{ get, set, peek, update, subscribe }`; `computedBox(fn, { equals? })` returns `{ get, peek, subscribe }` (no set/update -- derived). Same `ReactiveNode` and zero-GC read/write path as the callable forms, full interop in one graph (a callable can read `box.get()` and vice versa). Construction is ~1.7x cheaper than the callable (an `Object.create(proto)` handle, not a closure). Built on a shared prototype from the start -- never `setPrototypeOf` (which would deopt the method-call ICs to megamorphic). Exported as registry methods and top-level helpers.
|
|
19
|
+
- **Box (1.5.0)**: non-callable, allocation-light variants. `signalBox(initial, { equals? })` returns `{ get, set, peek, update, subscribe }`; `computedBox(fn, { equals? })` returns `{ get, peek, subscribe }` (no set/update -- derived). Same `ReactiveNode` and zero-GC read/write path as the callable forms, full interop in one graph (a callable can read `box.get()` and vice versa). Construction is ~1.7x cheaper than the callable (an `Object.create(proto)` handle, not a closure): measured at **56 B/op per mint+dispose cycle vs 264 B/op for the callable** (all-space, node v26.3.1; the callable's cost is two accessor closures + shared context + property store + closure feedback -- see `harness/run.mjs mint`). The box guard stays DECIDABLE because each box is a fresh identity carrying its own `NODE_GEN`, so pooling closure identity is not needed to cut the cost. Built on a shared prototype from the start -- never `setPrototypeOf` (which would deopt the method-call ICs to megamorphic). Exported as registry methods and top-level helpers.
|
|
20
20
|
- **createRoot (1.5.0)**: `createRoot(fn)` runs `fn` in a detached ownership scope and returns `fn`'s value. Effects/computeds created directly in `fn` are NOT adopted by the enclosing owner, so they survive its re-runs/disposal (the caller owns their lifecycle). Both ownership and tracking are detached for `fn`'s direct body; inner effect/computed bodies still establish their own scopes. The escape hatch for lazily spawning a long-lived node from inside a consumer effect (e.g. `lite-query`'s query-watcher) -- without it, the consumer owns the watcher and cascade-disposes it on its next re-run. Mirrors Solid's `createRoot`.
|
|
21
21
|
- **getOwner / runWithOwner (1.5.0-beta.2)**: the re-attach companion. `getOwner()` returns the current lifecycle owner as an opaque gen-stamped handle (`undefined` outside any effect/computed body); `runWithOwner(handle, fn)` runs `fn` with that owner reinstated so effects/computeds created directly in `fn` are adopted by it (and cascade-dispose when it re-runs). Nulls the tracking observer for `fn`'s direct body (same pairing as `createRoot`). Handles are **safe to hold across async boundaries**: they use the `describeNode` / `liveNode` ABA-guard machinery (`NODE_GEN` stamp checked against the pool slot's current gen), so stale handles -- owner disposed, slot recycled by an unrelated effect via the LIFO free list -- degrade to rooted execution rather than corrupting the graph. A raw-pointer implementation would (i) silently adopt continuations into the recycled slot's new resident (measured: continuation dies with a stranger on its next disposal), or (ii) crash the engine with `RangeError: Maximum call stack size exceeded` on a corpse handle (owner disposed, slot not yet recycled -- the disposal walk recurses without termination). Both hazards pinned in `test/28-run-with-owner.test.mjs`, empirically reproduced via `harness/owner-hazard-repro.mjs`. Also exported as registry methods + top-level helpers.
|
|
22
22
|
- **dispose(api)**: universal disposal. Accepts a signal, computed, or effect dispose handle; idempotent; cross-registry calls are silent no-ops (per-registry `Symbol("node_ptr")` keys the node-identity slot on the returned API function, foreign signals fail the lookup and fall through). Passing an unrelated value is also safe; passing an arbitrary function invokes it (effect-handle contract).
|
|
@@ -53,7 +53,13 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
53
53
|
|
|
54
54
|
## Version notes
|
|
55
55
|
|
|
56
|
-
- **1.5.
|
|
56
|
+
- **1.5.1** (current): docs + verification patch -- engine byte-identical to 1.5.0
|
|
57
|
+
past the version banner; no API or behavior change. Adds the mint-cycle allocation
|
|
58
|
+
anatomy probe (`node harness/run.mjs mint [--verify]`) and ships the corrected
|
|
59
|
+
creation economics it measured (callable mint+dispose 264 B/op all-space,
|
|
60
|
+
tier-invariant; `signalBox`/`computedBox` 56 B/op; dispose adds 0). devDeps:
|
|
61
|
+
devtools ^1.3.1, gc-profiler ^1.16.0. See CHANGELOG `[1.5.1]`.
|
|
62
|
+
- **1.5.0**: stable. Graduates rc.3 with **no further engine change** --
|
|
57
63
|
`Signal.js`/`Signal.d.ts` byte-identical to rc.3 past the header, `bench/torture/run.mjs`
|
|
58
64
|
unchanged at 22/22. First stable to carry the **1.4.5 `createRegistry` input
|
|
59
65
|
validation** (folded in at rc.3) atop the 1.5.0 surface (`signalBox`/`computedBox`,
|
|
@@ -791,7 +797,8 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
791
797
|
- `bench/torture/` -- the complete **16-scenario superset (13 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, so the whole set is safe on the 1.5.0 engine and stays green from 1.4.x forward. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **9 that execute on 1.5.0**: `oracle-fuzzer` (every computed vs an independent uncached reference, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeups), `work-accounting` (minimum body-execution counts over 10 topologies), `concurrent-storm` (8 reentrancy / flush-ordering contracts), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing-scheduler containment), `box-torture` (1.5.0: signalBox/computedBox interop -- the oracle differential fuzz with every node realised as callable OR box, plus box-only subscribe/update and the allocation-light representation contract), `async-torture` (watch / when / whenAsync contracts + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary -- exact ceilings, re-throw-on-read, `grow` crossing the same boundary), `op-accounting` (structural work counted from the engine's own `onGraphMutation` opcode lane, not wall-clock); plus **4 that skip cleanly** as later-version features: `scope-torture` (1.6.0 `createScope`), `flush-torture` (1.7.0 `flushStrategy`), `cleanup-return-torture` (1.8.0 effect-return cleanup), `dispose-torture` (1.9.0 `Symbol.dispose`). `soak` (wall-clock bound, asserts on RESOURCES; 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. Runner spawns each scenario as a child process (several assert on global pool accounting) and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
792
798
|
- `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 carrying 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.
|
|
793
799
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
794
|
-
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (field, dispose, churn, owner, creation, all).
|
|
800
|
+
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (field, dispose, churn, owner, creation, mint, all).
|
|
801
|
+
- `harness/mint-anatomy.mjs` -- mint+dispose cycle allocation anatomy (`mint` / `mint --verify`): per-op all-space vs new-space heap bytes for every creation primitive on a pre-grown throw-policy registry, fresh child per (variant, warmup) cell. Documents the 264 B/op callable cycle vs 56 B/op signalBox and the ALL-space accounting rule (a new-space-only witness undercounts by ~56 B/op of pre-TurboFan closure-feedback -- the LS-06 correction). `--verify` applies relative pins P1..P5.
|
|
795
802
|
- `harness/fieldkit.mjs` -- single-file portable verify + cold-child A/B bench across six shapes.
|
|
796
803
|
- `harness/owner-hazard-repro.mjs` -- async-gap owner-recycling hazard verdict (cited by getOwner/runWithOwner).
|
|
797
804
|
- `harness/VersionMatrix/` -- cold-process-per-version performance regression gate (wired as prepublishOnly).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.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",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
},
|
|
85
85
|
"sideEffects": false,
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@zakkster/lite-devtools": "^1.
|
|
88
|
-
"@zakkster/lite-gc-profiler": "^1.
|
|
87
|
+
"@zakkster/lite-devtools": "^1.3.1",
|
|
88
|
+
"@zakkster/lite-gc-profiler": "^1.16.0",
|
|
89
89
|
"@zakkster/lite-profiler": "^1.1.0",
|
|
90
90
|
"@zakkster/lite-profiler-signal": "^1.2.0",
|
|
91
91
|
"@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
|