gabriel / musehub public
feat patch task/fetch-bundle-wire #1 / 1
AI Agent gabriel · 127 days ago · May 11, 2026 · Diff

feat: wire_fetch_bundle — single-bundle fetch path (issue #47)

Add FetchBundleResult TypedDict and wire_fetch_bundle function to musehub_wire.py.

The function: - BFS-walks the commit DAG (same logic as wire_fetch_presign) - Collects all snapshots + objects for the delta - Loads object bytes from storage in parallel (semaphore=50) - Assembles one MPackBundle: {commits, snapshots, objects, branch_heads} - bundle_id = sha256(bundle_bytes) — the content-addressing proof - Returns inline bytes for small bundles (presign=False) - Returns presigned GET URL for large bundles (presign=True, threshold=500 obj / 50 MB)

6 TDD tests (FB0–FB5) cover: single-commit bundle, sha256 proof, bundle contents, have-cut delta, empty want, and per-object integrity.

sha256:2873ab55a3a0fcccc6cba6c9f7c94787b15c06f10108c80252eebb4d4ec12286 sha
+26 symbols
sha256:e54168dbedac30666d710cbc663f410e6ede7770702bb4173826b60ba234008e snapshot
+26
symbols added
0
dead code introduced
Semantic Changes 26 symbols
~ tests/test_wire_fetch_bundle.py .py 24 symbols added
+ _make_commit function async_function _make_commit L98–139
+ _now function function _now L46–47
+ _store_object function async_function _store_object L72–95
+ _stub_backend function function _stub_backend L50–69
+ AsyncMock import import AsyncMock L34–34
+ AsyncSession import import AsyncSession L33–33
+ annotations import import annotations L26–26
+ blob_id import import blob_id L39–39
+ create_repo import import create_repo L41–41
+ datetime import import datetime L36–36
+ db import import db L40–40
+ fake_id import import fake_id L39–39
+ hashlib import import hashlib L28–28
+ msgpack import import msgpack L30–30
+ pg_insert import import pg_insert L32–32
+ pytest import import pytest L31–31
+ select import import select L38–38
+ timezone import import timezone L36–36
+ test_fb0_single_commit_returns_bundle function async_function test_fb0_single_commit_returns_bundle L147–171
+ test_fb1_bundle_id_equals_sha256_of_bytes function async_function test_fb1_bundle_id_equals_sha256_of_bytes L179–204
+ test_fb2_bundle_contains_commits_and_objects function async_function test_fb2_bundle_contains_commits_and_objects L212–246
+ test_fb3_have_excludes_known_commits function async_function test_fb3_have_excludes_known_commits L254–292
+ test_fb4_empty_want_returns_empty function async_function test_fb4_empty_want_returns_empty L300–315
+ test_fb5_object_content_hashes_to_id function async_function test_fb5_object_content_hashes_to_id L323–351
~ musehub/services/musehub_wire.py .py 2 symbols added
+ FetchBundleResult class class FetchBundleResult L123–139
+ wire_fetch_bundle function async_function wire_fetch_bundle L2382–2577
← Older Oldest on task/fetch-bundle-wire
All commits
Newer → Latest on task/fetch-bundle-wire

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