fix(cache-clean): harden orphan sweep + surface remove failures (v3.2.21)#64
Merged
Conversation
…me (no silent swallow)
…ketplaces are swept
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
Closes the 3 verify-then-harden items reopened in the plugin-update-robustness design (the v3.2.16 cache sweeper).
clean_plugin_cacheruns unconditionally on every real Claudeonebrain plugin update(orchestrate.rs Step 8+9,if harness == Claude) — not gated on a version change; only--dry-runskips (it short-circuits the whole vault-sync). Added a clarifying comment.discover_onebrain_cache_dirsglobbed the cache onlyif dirs.is_empty(), so an orphan under an unregistered marketplace was missed whenever a registered marketplace also existed (the real 2.2.4 shape). Now always unions JSON-registered + glob-discovered dirs, thensort()+dedup().remove_dir_allfailures were silently swallowed.clean_plugin_cachenow returnsCacheCleanOutcome { removed, failed },eprintln!s avault-sync:-prefixed warning per failed path, and both callers (vault-sync progress +doctor --fix) surface the failure count.Why dedup is load-bearing
With the always-union glob, a registered marketplace surfaces via both the JSON path and the glob. Without
sort+dedupthe same version dir would be enumerated twice →remove_dir_allruns twice → the 2nd hitsNotFound→ a phantomfailed++. Reverting the dedup makes 3 tests fail (verified), so it's guarded.Testing
glob_catches_orphan_under_unregistered_marketplace(item 2),remove_failure_is_counted_and_surfaced_not_swallowed(#[cfg(unix)], chmod 0o500 parent, item 3)..removed/.failed.cargo test -p onebrain-fs→ 564 passed ·cargo test -p onebrain-cli→ 589 passed · clippy clean · fmt clean.Patch bump (bugfix, no new command). Known out-of-scope follow-up: enumeration failure of an unreadable
.../onebrain/dir is still silent (the 2.2.4 bug was removal/shadowing, not unreadable-dir).Plan:
01-projects/onebrain/cli/2026-05-30-cache-clean-hardening-plan.md(vault).🤖 Generated with Claude Code