gabriel / muse public
fix patch pack dev
AI Agent gabriel · 143 days ago · Apr 27, 2026 · Diff

fix(pack): Phase 7 — topological commit retry in apply_mpack

Bundles may arrive with commits in BFS order (newest-first). Phase 2's MissingParentError guard correctly rejects a commit whose parent hasn't been written yet, but apply_mpack was iterating commits in the received order without retrying deferred commits.

Fix: parse all commits first, then write in a retry loop. Each pass defers commits that raise MissingParentError. If a full pass makes no progress (the parent isn't in the bundle or the local store), log and skip rather than crashing apply_mpack.

Also imports MissingParentError from store into pack.py so the retry loop can distinguish dangling-parent rejections from other errors.

4-test suite in test_phase7_bundle_atomicity.py: newest-first ordering succeeds (3 commits), correct order still works, absent parent skipped gracefully, commits readable before ref advance.

sha256:2244e33366cb0702264c6d4de441f5dc343a3ab18b56c34a1889a8a0785258bb sha
+26 ~14 symbols
sha256:9c3e42d1bf2a878b47c6ca546a45bfbcce91779b316ba20df43827facb292566 snapshot
+26
symbols added
~14
symbols modified
0
dead code introduced
Semantic Changes 40 symbols
~ tests/test_phase7_bundle_atomicity.py .py 25 symbols added
+ TestObjectsBeforeRefs class class TestObjectsBeforeRefs L184–214
+ test_apply_mpack_writes_commits_before_caller_advances_refs method method test_apply_mpack_writes_commits_before_caller_advances_refs L185–214
+ TestTopologicalRetry class class TestTopologicalRetry L97–177
+ test_absent_parent_skipped_gracefully method method test_absent_parent_skipped_gracefully L151–177
+ test_correct_order_still_works method method test_correct_order_still_works L131–149
+ test_newest_first_ordering_writes_all_commits method method test_newest_first_ordering_writes_all_commits L98–129
+ _BRANCH variable variable _BRANCH L51–51
+ _REPO_ID variable variable _REPO_ID L50–50
+ _fake_id function function _fake_id L54–55
+ _make_real_commit function function _make_real_commit L58–90
+ CommitRecord import import CommitRecord L35–35
+ MPackBundle import import MPackBundle L34–34
+ SnapshotRecord import import SnapshotRecord L35–35
+ annotations import import annotations L26–26
+ apply_mpack import import apply_mpack L34–34
+ commit_exists import import commit_exists L35–35
+ compute_commit_id import import compute_commit_id L43–43
+ compute_snapshot_id import import compute_snapshot_id L43–43
+ datetime import import datetime L28–28
+ msgpack import import msgpack L31–31
+ pathlib import import pathlib L29–29
+ pytest import import pytest L32–32
+ read_commit import import read_commit L35–35
+ write_commit import import write_commit L35–35
+ write_snapshot import import write_snapshot L35–35
← Older Oldest on dev
All commits
Newer → Latest on dev

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