gabriel / musehub public
fix patch fix/object-dedup-corruption #1 / 1
gabriel · 67 days ago · Apr 14, 2026 · Diff

fix: heal corrupt objects on push — on_conflict_do_update in wire_push_objects and wire_push_object_pack

Previously, both push paths used on_conflict_do_nothing when inserting MusehubObject rows. If a corrupted DB row already existed (bytes in R2 don't match the object_id), any fresh push of the correct bytes would be silently dropped because the DB row already existed.

Changed both paths to on_conflict_do_update: - wire_push_object_pack: updates content_cache + resets storage_uri to 'pending' so the background R2 upload re-runs with the correct bytes. - wire_push_objects (presigned path): updates storage_uri to the new R2 URI (correct bytes were already uploaded to R2 before the DB insert) and clears content_cache.

Content-addressed objects are immutable by definition: sha256(content) == object_id is verified by _verify_object_hash before storage, so overwriting is always safe and idempotent.

This prevents silent data corruption where an object pushed with wrong bytes in a previous session could never be repaired by a subsequent correct push.

sha256:7dfb3db13f9bec7339bd0ae4177b6d1fd90c484db9bcbeac1b2e6027f421bac5 sha
sha256:28f5bfc9b5ec990ee2a032f882b8b0e3929a6ab9550c8bb88dfe2b406906886b snapshot
← Older Oldest on fix/object-dedup-corruption
All commits
Newer → Latest on fix/object-dedup-corruption

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