Skip to content

fix: harden Dominator core against peak-failure bugs and remove WASM complexity - #6

Merged
renderffx merged 101 commits into
mainfrom
fix/bugfixes-deep-check
Aug 6, 2026
Merged

fix: harden Dominator core against peak-failure bugs and remove WASM complexity#6
renderffx merged 101 commits into
mainfrom
fix/bugfixes-deep-check

Conversation

@renderffx

Copy link
Copy Markdown
Owner

What
Ruthless, invariant-first audit and hardening of the Dominator reactive engine. Every fix is proven by regression tests under the exact condition that previously broke it.
The Invariant

Any signal write that changes value runs exactly the effects whose current dependency set includes that signal, exactly once per dispatch; a throw in any one effect neither stops the rest nor corrupts tracking — regardless of batching, reentrancy, disposal, subscriber count, or id range. Strings/objects round-trip through the value store without panic, leak, or alias.
Fixes
P0 -> reactive core (signal.ts, arena.ts)

  • Single JS flat-array authority for subscribers/deps, deleting all WASM subscriber coupling and the 255-subscriber cap.
  • Strings/objects live in JS value maps no WASM writes, no memcpyAlias panic, no unbounded WASM growth.
  • try/finally + per-effect guard so a throwing effect can't abort dispatch.
  • Depth-scoped snapshots so reentrant set() can't clobber the outer dispatch.
  • Removed a provably-dead O(n) membership scan (deps are cleared each run) → 1000-effect fan-out 119 → 400+ ops/sec.
    P1 -> guards
  • dom-cmd.ts: elemId reuse detaches the old occupant; ring buffer never silently wraps.
  • render-graph.ts: _intern no longer clobbers slot 0 (could alias a live string); overflow sets a degraded flag.
  • worker-pool.ts: blob URL revoked only after all workers report ready (load race).
  • arena.ts: arenaCompact refuses while string/object values are live.
  • events.ts: bubble path released via try/finally (leak on throw).
  • compute-graph.ts + frame-scheduler.ts: per-effect/stage isolation so a throw can't stop the rest.
    Hygiene
  • Compiler passes propagate else-if branches; reorder places exprs before appends.
  • ECS bounds guards, engine destruction guard + partial-init teardown, wasm-glue view-rebind on growth.
  • Benchmarks: replaced machine-flaky throughput gates with sanity asserts; time-boxed slow-op probes.
    Verification
  • pnpm typecheck clean.
  • Full suite: 236/236 pass (includes new adiabatic signal-failure/string-probe regression suites).
  • Removed obsolete root bench harness; kept WASM only where it's the coherent number-value store.

@renderffx
renderffx merged commit 8d43f98 into main Aug 6, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant