gabriel / musehub public
feat patch phase4 task/phase4-disk-negotiate #1 / 1
AI Agent gabriel · 144 days ago · May 1, 2026 · Diff

feat(phase4): wire_negotiate reads disk for have-set resolution

Replace DB musehub_commits query in wire_negotiate have-set acknowledgment with on-disk object existence check (_commit_exists_on_disk). DB is now treated as a cache only — stale after force-resign or partial push failures.

- Add _commit_exists_on_disk(repo_root, commit_id) — plain Path.exists() stat - wire_negotiate: ack = [cid for cid in have_set if _commit_exists_on_disk(...)] - Eliminates the DB-drift bug class that motivated this ticket - 15 TDD tests across 7 tiers

sha256:8ecf2a81455dfa0b96cc1c525ad821e175f9283e5a9b9d67c3d13b7673c8e622 sha
+38 ~1 symbols
sha256:9cc35d67064727e0e3bd43532fa3753fcfbe9fb2f67d11bcdb2d7720e9f4b6d1 snapshot
+38
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 39 symbols
~ tests/test_negotiate_disk_read.py .py 37 symbols added
+ TestCommitExistsOnDiskFalse class class TestCommitExistsOnDiskFalse L91–117
+ test_returns_false_after_file_deleted method method test_returns_false_after_file_deleted L105–117
+ test_returns_false_for_empty_repo method method test_returns_false_for_empty_repo L98–103
+ test_returns_false_for_unknown_commit method method test_returns_false_for_unknown_commit L92–96
+ TestCommitExistsOnDiskTrue class class TestCommitExistsOnDiskTrue L49–86
+ test_returns_true_after_explicit_write method method test_returns_true_after_explicit_write L71–86
+ test_returns_true_for_multiple_commits method method test_returns_true_for_multiple_commits L60–69
+ test_returns_true_when_object_file_exists method method test_returns_true_when_object_file_exists L50–58
+ TestNegotiateAcksDiskPresent class class TestNegotiateAcksDiskPresent L122–164
+ test_acks_commit_present_on_disk_not_in_db method async_method test_acks_commit_present_on_disk_not_in_db L124–142
+ test_acks_multiple_disk_commits method async_method test_acks_multiple_disk_commits L145–164
+ TestNegotiateEmptyHave class class TestNegotiateEmptyHave L225–263
+ test_empty_have_yields_empty_ack method async_method test_empty_have_yields_empty_ack L227–240
+ test_partial_have_only_acks_disk_present method async_method test_partial_have_only_acks_disk_present L243–263
+ TestNegotiateNoDB class class TestNegotiateNoDB L312–351
+ test_no_musehub_commits_query_for_have_ack method async_method test_no_musehub_commits_query_for_have_ack L314–351
+ TestNegotiateReadyFlag class class TestNegotiateReadyFlag L268–307
+ test_ack_set_drives_ready_when_have_present method async_method test_ack_set_drives_ready_when_have_present L287–307
+ test_ready_true_when_no_have_ids method async_method test_ready_true_when_no_have_ids L270–284
+ TestNegotiateRejectsDiskAbsent class class TestNegotiateRejectsDiskAbsent L169–220
+ test_does_not_ack_commit_in_db_but_not_on_disk method async_method test_does_not_ack_commit_in_db_but_not_on_disk L171–203
+ test_does_not_ack_unknown_commit method async_method test_does_not_ack_unknown_commit L206–220
+ _make_repo function async_function _make_repo L356–386
+ _oid function function _oid L27–28
+ _repo_root function function _repo_root L40–44
+ _write_object function function _write_object L31–37
+ AsyncMock import import AsyncMock L16–16
+ AsyncSession import import AsyncSession L20–20
+ MagicMock import import MagicMock L16–16
+ Path import import Path L15–15
+ annotations import import annotations L12–12
+ blob_id import import blob_id L22–22
+ call import import call L16–16
+ patch import import patch L16–16
+ pytest import import pytest L18–18
+ pytest_asyncio import import pytest_asyncio L19–19
+ uuid import import uuid L14–14
~ musehub/services/musehub_wire.py .py 1 symbol added, 1 symbol modified
+ _commit_exists_on_disk function function _commit_exists_on_disk L904–923
← Older Oldest on task/phase4-disk-negotiate
All commits
Newer → Latest on task/phase4-disk-negotiate

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