gabriel / muse public
feat BREAKING feat/wire-compression-tier1-tier2 #1 / 1
gabriel · 168 days ago · Apr 12, 2026 · Diff

feat: add Tier 1 (zlib) and Tier 2 (delta+zlib) wire compression

- muse/core/compression.py: new module — compress_zlib, decompress_zlib, compute_delta (COPY/DATA rolling hash), apply_delta (decoder). Raises ValueError when delta >= zlib(target) (unprofitable). - muse/core/pack.py: ObjectPayload gains optional encoding + base_id fields via two-class TypedDict; _WalkResult gains oid_to_path dict populated from snapshot manifests during walk_commits. - muse/core/transport.py: filter_objects returns FilterObjectsResult with missing + bases; HttpTransport sends object_hints and parses bases; LocalFileTransport decodes zlib/delta+zlib when writing objects. - muse/cli/commands/push.py: _encode_object helper selects delta+zlib when a base is available (falls back to zlib when delta is not profitable); _push_objects_as_packs wired through oid_to_path + oid_to_base. - tests/test_compression.py: 21 unit tests covering zlib round-trips, delta round-trips, profitability guard, and decoder edge cases.

sha256:938f2700dc28c205063d67bdc590fc7faa9fcc5067d685a66a2141e06fc6a171 sha
+48 ~12 symbols
sha256:4e008e680764685f596121c640e4304df4e4416e404128daa1d7e334fd19e4d3 snapshot
+48
symbols added
~12
symbols modified
0
dead code introduced
Semantic Changes 60 symbols
~ muse/core/compression.py .py 8 symbols added
+ _COPY_THRESHOLD variable variable _COPY_THRESHOLD L17–17
+ apply_delta function function apply_delta L129–170
+ compress_zlib function function compress_zlib L20–26
+ compute_delta function function compute_delta L38–126
+ decompress_zlib function function decompress_zlib L29–35
+ annotations import import annotations L10–10
+ struct import import struct L12–12
+ zlib import import zlib L13–13
~ tests/test_compression.py .py 31 symbols added
+ TestDelta class class TestDelta L60–211
+ test_apply_delta_corrupt_raises method method test_apply_delta_corrupt_raises L151–154
+ test_apply_delta_empty_target method method test_apply_delta_empty_target L109–119
+ test_apply_delta_pure_data_instruction method method test_apply_delta_pure_data_instruction L88–100
+ test_apply_delta_unknown_instruction_raises method method test_apply_delta_unknown_instruction_raises L156–162
+ test_copy_threshold_respected method method test_copy_threshold_respected L164–191
+ test_delta_smaller_than_zlib_for_small_edit method method test_delta_smaller_than_zlib_for_small_edit L131–139
+ test_large_file_delta_round_trip method method test_large_file_delta_round_trip L193–199
+ test_midi_like_binary_round_trip method method test_midi_like_binary_round_trip L201–211
+ test_round_trip_append method method test_round_trip_append L74–79
+ test_round_trip_empty_base method method test_round_trip_empty_base L102–107
+ test_round_trip_identical_content method method test_round_trip_identical_content L61–65
+ test_round_trip_prepend method method test_round_trip_prepend L81–86
+ test_round_trip_small_edit method method test_round_trip_small_edit L67–72
+ test_round_trip_source_file method method test_round_trip_source_file L121–129
+ test_unprofitable_delta_raises_value_error method method test_unprofitable_delta_raises_value_error L141–149
+ TestZlib class class TestZlib L23–52
+ test_compress_output_is_valid_zlib method method test_compress_output_is_valid_zlib L48–52
+ test_compress_reduces_size_for_text method method test_compress_reduces_size_for_text L38–41
+ test_decompress_corrupt_raises method method test_decompress_corrupt_raises L43–46
+ test_round_trip_binary method method test_round_trip_binary L29–32
+ test_round_trip_empty method method test_round_trip_empty L34–36
+ test_round_trip_source_code method method test_round_trip_source_code L24–27
+ _COPY_THRESHOLD import import _COPY_THRESHOLD L9–9
+ annotations import import annotations L3–3
+ apply_delta import import apply_delta L9–9
+ compress_zlib import import compress_zlib L9–9
+ compute_delta import import compute_delta L9–9
+ decompress_zlib import import decompress_zlib L9–9
+ pytest import import pytest L7–7
+ zlib import import zlib L5–5
~ muse/cli/commands/push.py .py 3 symbols added, 2 symbols modified
+ _encode_object function function _encode_object L262–306
+ compress_zlib import import compress_zlib L104–104
+ compute_delta import import compute_delta L104–104
~ muse/core/pack.py .py 1 symbol added, 3 symbols modified
+ _ObjectPayloadBase class class _ObjectPayloadBase L62–66
~ muse/core/transport.py .py 5 symbols added, 7 symbols modified
+ FilterObjectsResult class class FilterObjectsResult L217–227
+ apply_delta import import apply_delta L168–168
+ compress_zlib import import compress_zlib L168–168
+ compute_delta import import compute_delta L168–168
+ decompress_zlib import import decompress_zlib L168–168
← Older Oldest on feat/wire-compression-tier1-tier2
All commits
Newer → Latest on feat/wire-compression-tier1-tier2

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