gabriel / musehub public
feat patch pack-gc dev
AI Agent gabriel · 123 days ago · May 15, 2026 · Diff

feat(pack-gc): Phase 4 — GC consolidates N push packs into one bundle

process_pack_gc_job merges all distinct packs for a repo into a single content-addressed consolidated bundle and rewrites musehub_pack_index so every object_id maps to the new key. After GC, wire_fetch_bundle returns exactly 1 pack_url regardless of how many pushes the repo had.

- process_pack_gc_job: download all packs, merge objects, write consolidated bundle, delete+reinsert pack index rows pointing at new key - Idempotent: same content → same sha256 key → no duplicate rows - Skips repos already at ≤ 1 pack (single-pack repos are already optimal) - Wire pack.gc job type into worker.py - PG-1..6 TDD tests all green (18/18 across phases 1-4)

sha256:28e1d7ddf80d751ec881b5c8bf57f6259b9b36b829d3ab1730784b626ece4d0e sha
+24 ~1 symbols
sha256:d9f98d094eb2ff75820d490dc2c812739ab7d5ed05158fdcd8aa61ba173d041c snapshot
+24
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 25 symbols
~ tests/test_pack_gc_phase4.py .py 22 symbols added
+ _distinct_pack_count function async_function _distinct_pack_count L151–157
+ _make_bundle function function _make_bundle L43–60
+ _make_commit_chain function function _make_commit_chain L109–148
+ _push_and_index function async_function _push_and_index L69–106
+ _store_bundle function async_function _store_bundle L63–66
+ AsyncSession import import AsyncSession L31–31
+ annotations import import annotations L23–23
+ blob_id import import blob_id L33–33
+ compute_identity_id import import compute_identity_id L35–35
+ create_repo import import create_repo L36–36
+ datetime import import datetime L25–25
+ db import import db L34–34
+ hashlib import import hashlib L26–26
+ msgpack import import msgpack L28–28
+ pytest import import pytest L29–29
+ select import import select L30–30
+ test_pg1_gc_consolidates_multiple_packs function async_function test_pg1_gc_consolidates_multiple_packs L165–199
+ test_pg2_gc_leaves_exactly_one_pack function async_function test_pg2_gc_leaves_exactly_one_pack L207–229
+ test_pg3_consolidated_bundle_contains_all_objects function async_function test_pg3_consolidated_bundle_contains_all_objects L237–274
+ test_pg4_gc_is_idempotent function async_function test_pg4_gc_is_idempotent L282–320
+ test_pg5_gc_skips_single_pack_repo function async_function test_pg5_gc_skips_single_pack_repo L328–352
+ test_pg6_fetch_returns_single_pack_url_after_gc function async_function test_pg6_fetch_returns_single_pack_url_after_gc L360–404
~ musehub/services/musehub_wire.py .py 2 symbols added
+ PackGCResult class class PackGCResult L4473–4479
+ process_pack_gc_job function async_function process_pack_gc_job L4482–4590
~ musehub/worker.py .py 1 symbol modified
← 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:28e1d7ddf80d751ec881b5c8bf57f6259b9b36b829d3ab1730784b626ece4d0e --body "your comment"