Skip to content

fix(core): wire persistence cleanup into startup — completes #218#421

Merged
devinoldenburg merged 1 commit into
mainfrom
fix/issue-218-cleanup-wiring
Jun 21, 2026
Merged

fix(core): wire persistence cleanup into startup — completes #218#421
devinoldenburg merged 1 commit into
mainfrom
fix/issue-218-cleanup-wiring

Conversation

@devinoldenburg

Copy link
Copy Markdown
Owner

#420 implemented and unit-tested persistence.cleanup() (prunes orphaned state snapshots left by worktrees that no longer run, by TTL/mtime, preserving the current/fresh file), but it was never called — so the orphaned-files accumulation that #218 reports still happened. This wires it into guard startup (right after rehydrate), best-effort and optional-chained so an injected test persistence (which omits cleanup) is unaffected and a cleanup failure can never break startup.

Completes the fix for #218 (auto-closed by #420; this lands the missing call).

Verification

  • node --test "tests/*.test.mjs" → 650 pass, 0 fail.
  • New test asserts createGuard invokes persistence.cleanup() exactly once at startup.

#420 added and unit-tested persistence.cleanup() (prunes orphaned snapshot
files from worktrees that no longer run) but never called it, so orphans still
accumulated. Wire it into guard startup (best-effort, optional-chained so test
doubles are unaffected) and assert the wiring.
@devinoldenburg devinoldenburg merged commit ab34312 into main Jun 21, 2026
10 checks passed
@devinoldenburg devinoldenburg deleted the fix/issue-218-cleanup-wiring branch June 21, 2026 11:40
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