gabriel / musehub public
fix BREAKING task/fix-delta-compressed-base #1 / 1
gabriel · 69 days ago · Apr 13, 2026 · Diff

fix: decompress zlib-compressed delta bases before apply_delta

Old-wire-path objects were stored zlib-compressed in R2. When a new object is pushed as delta+zlib against such a base, the server fetched the raw R2 bytes (compressed) and passed them directly to apply_delta(). The delta was applied against wrong bytes — producing garbage — and hash verification was skipped for non-sha256:-prefixed IDs, so it passed.

Real-world failure: staging README showed '0!' after a one-line README edit was pushed as delta+zlib against the old zlib-compressed README.

Fix: - Move decompress_if_needed() to muse_contracts/compression.py (canonical home) - Apply decompress_if_needed() to base_raw before apply_delta() in wire_push_object_pack so deltas are always applied against plain bytes - Add POST /{owner}/{slug}/repair-object endpoint (owner/write-only) to replace a corrupt stored object with SHA-256-verified correct bytes - Update ui_tree.py and _ui_helpers.py to import from compression module

Tests: 45 pass — 18 new regression tests cover both delta base scenarios (content_cache path and storage path) and the repair endpoint.

sha256:aaf5f76dd4004e6d4a0ff70dd68960b118fb032175aef5cb3745e385d9084ebd sha
sha256:69dda09485a1e1f5eb78486b22daefe0b54511197804272addeec386e949cc66 snapshot
← Older Oldest on task/fix-delta-compressed-base
All commits
Newer → Latest on task/fix-delta-compressed-base

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