gabriel / musehub public
feat BREAKING phase5 task/phase5-drop-object-repo-id #1 / 1
gabriel · 164 days ago · Apr 13, 2026 · Diff

feat(phase5): drop musehub_objects.repo_id — replace with object_refs JOIN

Migration 0045 removes the legacy repo_id owner column from musehub_objects. Per-repo reachability is now exclusively tracked via musehub_object_refs (composite PK: repo_id, object_id), enabling content-addressed dedup across repos — two repos pushing identical bytes share one row, each gets its own ref.

Changes: - alembic/versions/0045: drops repo_id column, FK, and two indices; downgrade restores them as nullable - musehub_wire.py: remove repo_id from all MusehubObject bulk inserts (5 sites) - musehub_models.py: add MusehubSnapshotEntry ORM model (table dropped in 0043, re-introduced for TDD snapshot entry tests) - object_integrity.py: soft_delete / reap / scan operate on objects table only - orphan_scan.py, repository_service.py, sync.py, ui_view.py: update queries to JOIN object_refs instead of filtering on repo_id - deploy/decompress_objects.py, repair_objects.py: remove repo_id references - tests: remove repo_id= from all MusehubObject() constructors; add ref rows where missing; update migration count assertions to 45; fix object_store tests to match new LocalBackend._write repair semantics; add releases dir fixture so /releases/* tests don't fail in envs without /data/releases

sha256:6b76f58affa66ef710e49b882cf808fc6cd75418e246ebb3c44ec0fae2ef50ea sha
+16 ~47 −8 symbols
sha256:3b785888fa141e55149aa4ee0b155e58786b47a36cb98121ed99af7644706662 snapshot
+16
symbols added
~47
symbols modified
−8
symbols removed
0
dead code introduced
Semantic Changes 71 symbols
+ branch_labels variable variable branch_labels L24–24
+ depends_on variable variable depends_on L25–25
+ down_revision variable variable down_revision L23–23
+ downgrade function function downgrade L42–61
+ annotations import import annotations L17–17
+ op import import op L20–20
+ sa import import sa L19–19
+ revision variable variable revision L22–22
+ upgrade function function upgrade L28–39
~ deploy/decompress_objects.py .py 1 symbol modified
~ deploy/repair_objects.py .py 1 symbol modified
~ repair
~ musehub/db/musehub_models.py .py 1 symbol added, 2 symbols modified
+ MusehubSnapshotEntry class class MusehubSnapshotEntry L320–337
~ musehub/maintenance/orphan_scan.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
− text import import text L24–24
+ _orphan_predicate function function _orphan_predicate L44–48
~ delete
~ select
~ tests/conftest.py .py 1 symbol modified
~ tests/test_data_integrity.py .py 1 symbol added, 3 symbols removed, 1 symbol modified
− test_fk_constraints_defined_on_object_table function function test_fk_constraints_defined_on_object_table L64–74
− test_fk_ondelete_cascade_on_object_table function function test_fk_ondelete_cascade_on_object_table L77–84
− test_orphan_scan_detects_objects_with_deleted_repo function async_function test_orphan_scan_detects_objects_with_deleted_repo L114–146
+ test_orphan_scan_detects_objects_with_no_refs function async_function test_orphan_scan_detects_objects_with_no_refs L89–111
~ tests/test_database.py .py 1 symbol removed
− test_musehub_objects_has_repo_deleted_at_composite function function test_musehub_objects_has_repo_deleted_at_composite L53–58
~ tests/test_gc_object_refs.py .py 1 symbol modified
~ tests/test_mcp_read_tools.py .py 1 symbol modified
~ tests/test_migrations.py .py 2 symbols added, 2 symbols removed, 5 symbols modified
− test_all_44_migrations_present method method test_all_44_migrations_present L267–270
− test_head_revision_is_0044 method method test_head_revision_is_0044 L272–292
+ test_all_45_migrations_present method method test_all_45_migrations_present L267–270
+ test_head_revision_is_0045 method method test_head_revision_is_0045 L272–292
~ _HEAD
~ tests/test_object_store.py .py 2 symbols added, 1 symbol removed, 1 symbol modified
− test_local_backend_write_skips_existing_file function function test_local_backend_write_skips_existing_file L81–94
+ test_local_backend_write_idempotent_for_same_content function function test_local_backend_write_idempotent_for_same_content L81–94
+ test_local_backend_write_repairs_corrupt_file function function test_local_backend_write_repairs_corrupt_file L97–109
← Older Oldest on task/phase5-drop-object-repo-id
All commits
Newer → Latest on task/phase5-drop-object-repo-id

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