Skip to content

Feature/core improvements#25

Merged
hexplus merged 29 commits intomainfrom
feature/core-improvements
Apr 18, 2026
Merged

Feature/core improvements#25
hexplus merged 29 commits intomainfrom
feature/core-improvements

Conversation

@hexplus
Copy link
Copy Markdown
Owner

@hexplus hexplus commented Apr 18, 2026

Description

Hardens the reactivity core to close four real correctness gaps surfaced by a deep audit:

  • Effect re-entry: effects that write to a signal they subscribe to no longer silently drop the update — they re-run after the current body via a rerunPending flag, with a 100-iteration safety cap to bail loudly on true cycles.
  • Stale-dep leak in derived(): conditional getters like () => flag() ? a() : b() no longer keep both branches' signals subscribed forever. retrack() now tags each dep edge with a per-evaluation epoch and unsubscribes stale edges at end of run.
  • Sibling-effect convergence: the fast and slow paths of notifySubscribers used to diverge on whether cross-writing effects could re-run; unified into a single drain with dedup-cleared-before-invoke so sibling effects reliably converge on consistent state.
  • Cycle detection: replaced the coarse 100k-total-iteration cap (which conflated real cycles with large legitimate fan-out) with per-subscriber repeat counting. Default cap 50, configurable via new setMaxSubscriberRepeats(n).

Also: empty __s subscriber sets are now released, subscriberStack shrinks when idle, and __f/__s fast-path bookkeeping is centralized in a syncFastPath() helper.

Internal _deps storage migrated from Set<signal> to Map<signal, epoch> to carry the epoch tags. Public API is unchanged; devtools introspect.getDependencies() updated for the new layout.

201/201 test files, 2187/2187 tests passing. No behavior changes to user code that was already correct.

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • I have read CONTRIBUTING.md
  • My code builds without errors
  • I have tested my changes
  • I have updated documentation if needed

hexplus added 29 commits March 28, 2026 15:11
@hexplus hexplus merged commit ddfbf62 into main Apr 18, 2026
1 check passed
@hexplus hexplus deleted the feature/core-improvements branch April 18, 2026 03:06
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