feat: add cleanup subcommand to reap stale copies on hosts - #31
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
git-supervisor cleanupsubcommand that reaps the stale*.to-be-removedcopydirectories which
check-push.shmoves aside but never deletes (therm -rfwas
deliberately deferred), so they accumulate indefinitely on controlled hosts.
statusalready surfaces these; this command finishes the deletion.
--applydeletes.--host <glob>— same scoping semantics asstatus(repeatable,union).
cleanup_probe.shruns once per host: enumerates*.to-be-removeddirs,emits a fixed 6-column TSV, and (only with
APPLY=1) deletes each itselfvia a safe-rm guard
ported from
check-push.sh— refuses the copies root and anything notresolving strictly
under
<dir_base>/copies/(incl. symlinks escaping the tree).with aggregate
non-zero exit if any host or deletion fails.
*.to-be-removedonly — notunknowndirs, notactive reaping.
Test Plan
cargo test— 97 passed, 2 ignoredcargo clippy— no issuesbash core/tests/scripts/test-cleanup-probe.sh— 0 failures (incl.safe-rm out-of-tree refusal)
localhost: dry-run lists w/o deleting;--applydeletes only stale,
spares live copies;
--hostno-match errors; empty host → "(nothing toclean)";
--applyrefuses out-of-tree symlink and exits non-zero