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

feat(phase2): wire all push paths to write musehub_object_refs

_upsert_object_refs(session, repo_id, object_ids) — single helper that bulk-upserts (repo_id, object_id) rows ON CONFLICT DO NOTHING. Called at all 6 push entry points:

- wire_push (inline bundle objects) - wire_push_objects (chunked pre-upload) - wire_push_object_pack (small-object pack — primary CLI path) - wire_repair_object - wire_confirm_objects (presigned PUT confirm) - worker_register_objects (Cloudflare Worker callback)

Key correctness invariant: refs are upserted for ALL incoming object_ids (new + already-present/deduplicated). A repo that deduplicates an object from another repo still gets a ref row so per-repo quota, GC, and audit queries return correct results.

Also: object_id FK on musehub_object_refs gains ondelete=CASCADE so deleting a musehub_objects row cascades to its refs cleanly.

Tests (6 new): pack new, pack dedup, push/objects, wire_push bundle, confirm, idempotent re-push. 162 wire-path tests pass.

sha256:c99042c649dd3f16bf9f914be5f9d147aafa35fe16e497f4da3088e5e525b2f2 sha
sha256:f5b9da8604ba523c27932257579fa525d2e5df5b3c204e118ec39229a9d9eb7d snapshot
← Older Oldest on task/object-refs-phase2
All commits
Newer → Latest on task/object-refs-phase2

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