gabriel / musehub public
feat BREAKING gc task/phase3-gc-object-refs #1 / 1
gabriel · 164 days ago · Apr 13, 2026 · Diff

feat(gc): phase 3 — prune object refs and globally unreferenced objects

Extended GCResult with object_refs_deleted, objects_deleted, storage_bytes_freed. GC now walks orphaned snapshot manifests to identify stale ref rows, deletes them, then finds objects with zero remaining refs globally and removes them from both musehub_objects and storage. Shared objects (refs from other repos) are preserved.

Added 6-test suite in tests/test_gc_object_refs.py covering: - stale ref deletion after force push - ref retention when object is still in a live snapshot - global object deletion when no refs remain - shared object retention when another repo holds a ref - clean-repo no-op invariant - GCResult field accuracy

sha256:6aa4ede3e0fe46a9ddef4c41015bed0195ef2a8f904417a772f293f9a7fc3bb2 sha
+31 ~2 symbols
sha256:7fb36d48044faa193e8696eb5560803e3b96162e9e6e572a3221e3493e33cf00 snapshot
+31
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 33 symbols
~ tests/test_gc_object_refs.py .py 28 symbols added
+ _insert_branch function async_function _insert_branch L123–136
+ _insert_commit function async_function _insert_commit L100–120
+ _insert_object function async_function _insert_object L49–65
+ _insert_ref function async_function _insert_ref L68–79
+ _insert_snapshot function async_function _insert_snapshot L82–97
+ _manifest function function _manifest L40–42
+ _now function function _now L32–33
+ _object_exists function async_function _object_exists L149–153
+ _oid function function _oid L36–37
+ _ref_exists function async_function _ref_exists L139–146
+ AsyncSession import import AsyncSession L25–25
+ annotations import import annotations L16–16
+ create_repo import import create_repo L29–29
+ datetime import import datetime L20–20
+ db import import db L27–27
+ hashlib import import hashlib L18–18
+ msgpack import import msgpack L22–22
+ pytest import import pytest L23–23
+ run_gc import import run_gc L28–28
+ sa import import sa L24–24
+ timezone import import timezone L20–20
+ uuid import import uuid L19–19
+ test_gc_clean_repo_does_not_touch_refs function async_function test_gc_clean_repo_does_not_touch_refs L308–333
+ test_gc_deletes_globally_orphaned_object function async_function test_gc_deletes_globally_orphaned_object L233–258
+ test_gc_keeps_object_when_other_repo_holds_ref function async_function test_gc_keeps_object_when_other_repo_holds_ref L266–300
+ test_gc_keeps_ref_for_live_object function async_function test_gc_keeps_ref_for_live_object L199–225
+ test_gc_removes_stale_ref_for_orphaned_object function async_function test_gc_removes_stale_ref_for_orphaned_object L161–191
+ test_gc_result_fields function async_function test_gc_result_fields L341–371
~ musehub/services/musehub_gc.py .py 3 symbols added, 2 symbols modified
+ _decode_manifest function function _decode_manifest L71–83
+ get_backend import import get_backend L38–38
+ msgpack import import msgpack L32–32
~ run_gc
← Older Oldest on task/phase3-gc-object-refs
All commits
Newer → Latest on task/phase3-gc-object-refs

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:6aa4ede3e0fe46a9ddef4c41015bed0195ef2a8f904417a772f293f9a7fc3bb2 --body "your comment"