Skip to content

Add cleanup ordering tests (#237/#238/#241/#242/#243) + sibling-order probe (#244)#11

Merged
johnsoncodehk merged 3 commits into
masterfrom
cleanup-ordering
May 14, 2026
Merged

Add cleanup ordering tests (#237/#238/#241/#242/#243) + sibling-order probe (#244)#11
johnsoncodehk merged 3 commits into
masterfrom
cleanup-ordering

Conversation

@johnsoncodehk
Copy link
Copy Markdown
Owner

@johnsoncodehk johnsoncodehk commented May 14, 2026

Summary

Translates the cleanup-ordering tests added in alien-signals#116 into cross-framework form. The original strict assertions were too tied to alien-signals's specific model (nested ownership + LIFO siblings); this PR relaxes them to universal invariants and moves model-specific choices to behavioral-difference probes.

Tests added

Main suite (universal invariants — pass for any valid model):

  • #237 cleanup ordering on outer re-run: outer cleanup must precede outer re-run; inner cleanup (if cascaded) must precede outer cleanup
  • #238 cleanup ordering on dispose: same invariant for the dispose path
  • #241 three-level cleanup: depth-first if cascaded, outer cleanup always fires
  • #242 effect in computed: old inner cleanup (if any) before new eval
  • #243 cleanup ordering correct after a prior inner-only re-run (regression)

Behavioral probe:

  • #244 sibling cleanup order on dispose: returns "LIFO" / "FIFO" / "no cascade" / "partial cascade"

Dropped from original PR draft:

  • #239 / #240 (strict LIFO siblings) — moved to #244 probe instead
  • The computed unwatched LIFO test from PR #116 — not portable (auto-disposal of unobserved computeds isn't shared)

Findings

Sibling cleanup probe (#244):

  • LIFO: alien-signals, anod
  • FIFO: reatom
  • no cascade (flat effect model): preact-signals, vue/reactivity, svelte, solid-js, S.js, signal-polyfill, angular, pota

Remaining failures on relaxed tests now indicate real cleanup bugs:

  • pota doesn't fire outer cleanup at all on outer re-run (#237/#243)
  • anod has issues with cleanup ordering on dispose
  • angular has issues with #235 (pre-existing)

Test plan

  • All 2910 cross-framework runs pass (no regressions)
  • alien-signals passes all 5 new main-suite tests
  • README.md regenerated; sibling order shown in Behavioral Differences table

Translates the cleanup-ordering tests added in alien-signals PR #116
into cross-framework form. Existing suite had no coverage of cleanup
ordering contracts (inner-before-outer, sibling LIFO, depth-first
reverse on multi-level nesting).

- #237 cleanup order on outer re-run: inner before outer, before new run
- #238 cleanup order on dispose: inner before outer
- #239 sibling cleanup on dispose: reverse creation (LIFO)
- #240 sibling cleanup on outer re-run: reverse creation (LIFO)
- #241 three-level nested cleanup on dispose: deepest first
- #242 effect created in computed: old inner cleanup before new inner setup
- #243 cleanup order correct on outer re-run after prior inner-only re-run

The computed-unwatched LIFO test from PR #116 is intentionally skipped
because auto-disposal of unobserved computeds is not a contract shared
across frameworks.
The strict equality assertions over-constrained the tests to
alien-signals's specific model (nested ownership + LIFO siblings).
Frameworks with flat-effect models (no parent-child cascade) failed
not because they have bugs, but because they have a different valid
design.

Changes:
- #237/#238/#241/#242/#243: relax to universal invariants
  - outer cleanup must fire and must precede outer re-run
  - inner cleanup (if framework cascades) must precede outer cleanup
  - frameworks without cascade simply don't fire inner cleanup;
    that's accepted
- #239/#240: removed (sibling order is a model choice, not contract)
- Added #244 probe in behaviorDifferences: returns "LIFO" / "FIFO" /
  "no cascade" / etc. — characterizing each framework's choice

Remaining failures now reflect real cleanup bugs (e.g. pota not
firing outer cleanup at all) rather than design differences.
@johnsoncodehk johnsoncodehk changed the title Add cleanup ordering tests (#237-#243) Add cleanup ordering tests (#237/#238/#241/#242/#243) + sibling-order probe (#244) May 14, 2026
@johnsoncodehk johnsoncodehk merged commit 571acdf into master May 14, 2026
@johnsoncodehk johnsoncodehk deleted the cleanup-ordering branch May 23, 2026 05:37
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