gabriel / muse public
feat BREAKING task/mpack-phase2-apply-writes-pack #1 / 1
AI Agent gabriel · 114 days ago · May 18, 2026 · Diff

feat: apply_mpack writes MPack pack file instead of loose objects (issue #70 Phase 2)

Wire-received objects now land in a single .mpack + .idx file pair via write_pack() — 2 file writes regardless of object count.

Eliminates the XL clone hang caused by 14,000 individual write_object() calls (~1ms each on macOS = 14s+ of syscall overhead).

Integrity checks (dedup, size cap, content/ID hash) still run per-object before collecting into the pack list — all safety invariants preserved. has_object() is used to skip already-present objects so the pack never stores duplicates. Commits and snapshots still write to their own dirs.

PF-2 test updated: patches write_pack instead of write_object.

sha256:dedbc830bb9742683245ab1e59b29883aa01c889ff600f075c27420b10e6207a sha
+40 ~3 −1 symbols
sha256:7785dafbdbc374dd5639baf43437efb3460582faa537ed58f63fa80364538b26 snapshot
+40
symbols added
~3
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 44 symbols
~ tests/test_apply_mpack_pack_store.py .py 38 symbols added
+ TestApplyMpackWritesPack class class TestApplyMpackWritesPack L93–164
+ test_apply_mpack_idempotent method method test_apply_mpack_idempotent L155–164
+ test_apply_mpack_result_counts_objects_written method method test_apply_mpack_result_counts_objects_written L148–153
+ test_commits_still_written_to_commits_dir method method test_commits_still_written_to_commits_dir L126–131
+ test_has_object_finds_packed_objects method method test_has_object_finds_packed_objects L119–124
+ test_objects_readable_via_read_object method method test_objects_readable_via_read_object L112–117
+ test_snapshots_still_written_to_snapshots_dir method method test_snapshots_still_written_to_snapshots_dir L133–138
+ test_writes_exactly_one_pack_and_one_idx method method test_writes_exactly_one_pack_and_one_idx L102–110
+ test_writes_no_loose_objects method method test_writes_no_loose_objects L94–100
+ test_xl_objects_produce_two_files_not_thousands method method test_xl_objects_produce_two_files_not_thousands L140–146
+ TestSafetyInvariantsPreserved class class TestSafetyInvariantsPreserved L172–252
+ test_duplicate_object_ids_skipped method method test_duplicate_object_ids_skipped L220–233
+ test_empty_objects_list_writes_no_pack method method test_empty_objects_list_writes_no_pack L248–252
+ test_oserror_on_write_pack_aborts_cleanly method method test_oserror_on_write_pack_aborts_cleanly L206–218
+ test_oversized_object_tracked_as_failed method method test_oversized_object_tracked_as_failed L235–246
+ test_poisoned_object_skips_its_snapshot_and_commit method method test_poisoned_object_skips_its_snapshot_and_commit L173–204
+ _DT variable variable _DT L32–32
+ _init_repo function function _init_repo L40–48
+ _make_mpack function function _make_mpack L51–85
+ CommitRecord import import CommitRecord L24–24
+ MPack import import MPack L20–20
+ SnapshotRecord import import SnapshotRecord L24–24
+ annotations import import annotations L11–11
+ apply_mpack import import apply_mpack L20–20
+ blob_id import import blob_id L30–30
+ compute_commit_id import import compute_commit_id L23–23
+ compute_snapshot_id import import compute_snapshot_id L23–23
+ datetime import import datetime L13–13
+ has_object import import has_object L21–21
+ json import import json L14–14
+ muse_dir import import muse_dir L22–22
+ packs_dir import import packs_dir L22–22
+ patch import import patch L16–16
+ pathlib import import pathlib L15–15
+ pytest import import pytest L18–18
+ read_commit import import read_commit L24–24
+ read_object import import read_object L21–21
+ read_snapshot import import read_snapshot L24–24
~ muse/core/mpack.py .py 2 symbols added, 1 symbol removed, 2 symbols modified
write_object import import write_object L38–38
+ has_object import import has_object L38–38
+ write_pack import import write_pack L39–39
← Older Oldest on task/mpack-phase2-apply-writes-pack
All commits
Newer → Latest on task/mpack-phase2-apply-writes-pack

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