gabriel / musehub public
feat BREAKING wire feat/streaming-push #1 / 1
gabriel · 65 days ago · Apr 16, 2026 · Diff

feat(wire): MWP v2 streaming push — 8-tier TDD tests, 43/43 green

Replace five-phase MWP v1 push (filter-objects → presign → push/objects → object-pack → confirm → push) with a single bidirectional msgpack stream over POST /{owner}/{slug}/push/stream — the direct equivalent of git-receive-pack over HTTP smart transport.

Wire protocol (application/x-muse-packstream): Client → Server: HEADER | OBJECT* | COMMIT_PACK | END Server → Client: PROGRESS* | (ERROR | RESULT)

Frame constants added to musehub/models/wire.py: SFRAME_HEADER / OBJECT / COMMIT_PACK / END / PROGRESS / ERROR / RESULT STREAM_MIME_TYPE, STREAM_MAX_OBJECTS, STREAM_MAX_COMMITS, STREAM_MAX_OBJECT_WIRE_BYTES, STREAM_OBJECT_BATCH_SIZE

Service (musehub_wire.wire_push_stream): - Auth + repo lookup before reading any OBJECT frames - Parallel R2 puts batched by STREAM_OBJECT_BATCH_SIZE (64), bounded by _R2_PUT_SEM (100 slots) - Inline SHA-256 verification and polyglot file check per object - Topological commit sort, parent-link validation, FF check - Snapshot bulk-upsert, branch pointer update, background job enqueue - Per-stream object/commit caps prevent unbounded memory use

Route (wire.push_stream): - Pre-buffers request body via await request.body() to avoid httpx ASGI transport deadlock in tests (request.stream() inside StreamingResponse is bidirectional and blocks the test transport) - Old MWP v1 endpoints deleted: /push, /filter-objects, /presign-objects, /push/objects, /push/object-pack, /push/objects/confirm

Tests (tests/test_wire_push_stream.py — 43 tests, 8 tiers): T1 Unit — frame codec helpers (pack/unpack round-trip) T2 Unit — server protocol state machine (pure dispatch, no DB/R2) T3 Comp — object validation (hash check, size limits, enc modes) T4 Comp — commit-pack validation (schema, limits, signature gate) T5 Svc — wire_push_stream() against in-memory stubs T6 Intg — service against real test DB + local storage backend T7 Route — POST /push/stream via ASGI test client T8 E2E — full push → GET /refs + fetch/objects round-trip

sha256:8fd05fc8cbe900ab2155fdbe8a2ebed9ed78f971a3ec2f8abb67334f03571fa2 sha
sha256:d04a105649e4d54bfda193dba360b50b8197e68d21ec6189b08f03fcb5fb1ae3 snapshot
← Older Oldest on feat/streaming-push
All commits
Newer → Latest on feat/streaming-push

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