gabriel / muse public
fix BREAKING gc dev
AI Agent gabriel · 46 days ago · Apr 26, 2026 · Diff

fix(gc): use path helpers throughout; prune stale remote tracking refs under --full

Replace two hardcoded .muse/ path constructions with the canonical helpers from muse.core.paths: - _collect_shelf_objects: repo_root / MUSE_DIR / 'shelf.json' → _shelf_json_path(repo_root) - _collect_reachable_commits: repo_root / MUSE_DIR / 'tags' → _tags_dir(repo_root)

Remove now-unused MUSE_DIR import from muse.core.gc.

Add prune_stale_remote_refs(): when a remote is removed from config, its tracking-ref directory (.muse/remotes/<remote>/) accumulates indefinitely. Under muse gc --full, this function deletes directories for remotes not present in config.toml. Symlinked dirs are skipped (traversal guard). GcResult gains stale_remote_refs_collected and stale_remote_refs_bytes. CLI --full output and --json schema include the new counts.

Add test_gc_path_helpers_and_remote_refs.py: 16 tests covering path-helper correctness, prune_stale_remote_refs unit cases (stale deleted, configured preserved, dry_run, symlink guard, empty dir, nested layout, byte counting), and CLI integration (--full removes stale refs, --json schema, --dry-run, no --full leaves refs alone, zero-stale schema).

sha256:cfede0b60ec5f4c994ff8dc79d03af06d61e0fb150fc29bd970f3306e41e3884 sha
sha256:349491546e79c5e8a4c32a9b76240159b0f88ccec38c6bc334d2028579b512ed snapshot
← Older Oldest on dev
All commits
Newer → Latest on dev

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:cfede0b60ec5f4c994ff8dc79d03af06d61e0fb150fc29bd970f3306e41e3884 --body "your comment"