gabriel / muse public
feat patch push task/mwp-cleanup #2 / 7
AI Agent gabriel · 149 days ago · Apr 24, 2026 · Diff

feat(push): Phase D — CF Worker routing via pack_origin

Add _post_object_pack() — sends object batches to the CF Worker's POST /push/object-pack endpoint (native R2 binding, ~3–8 ms/obj via Promise.all), bypassing Cloudflare's 100 MB proxy body limit.

Add pack_origin param to _push_stream(): when RemoteInfo.pack_origin is set, all objects go to the Worker; commits+snapshots go via push/stream (objects=[]). Without pack_origin (local hub), all objects travel in the push/stream body — existing path unchanged.

Wire pack_origin through run_cmd_push() from remote_info.get('pack_origin').

Server side (wire_refs, /internal/register-objects, Settings.pack_worker_url) was already implemented. Phase D completes the CLI half.

TDD: test_wire_pack_post.py — 16 tests covering _post_object_pack unit tests, _parse_remote_info pack_origin parsing, and _push_stream routing.

sha256:da27cf10611acb688714eb4c9d01ba10908640606d2ab0ccf88b61040990a789 sha
+39 ~9 −5 symbols
sha256:cb98f138613f693c1db03ad6ba733f208b1a6b64056f949b1d393cb8fe9b98cf snapshot
+39
symbols added
~9
symbols modified
−5
symbols removed
0
dead code introduced
Semantic Changes 53 symbols
~ tests/test_wire_pack_post.py .py 34 symbols added
+ TestParseRemoteInfoPackOrigin class class TestParseRemoteInfoPackOrigin L27–49
+ _raw method method _raw L28–33
+ test_pack_origin_absent_returns_none method method test_pack_origin_absent_returns_none L39–41
+ test_pack_origin_parsed method method test_pack_origin_parsed L35–37
+ test_pack_origin_stored_in_remote_info method method test_pack_origin_stored_in_remote_info L47–49
+ test_pack_origin_whitespace_only_ignored method method test_pack_origin_whitespace_only_ignored L43–45
+ TestPostObjectPack class class TestPostObjectPack L55–151
+ _make_objects method method _make_objects L58–66
+ _mock_client method method _mock_client L68–76
+ test_accepts_msgpack_response method async_method test_accepts_msgpack_response L116–125
+ test_body_is_msgpack_with_objects_key method async_method test_body_is_msgpack_with_objects_key L92–104
+ test_content_type_header_is_msgpack method async_method test_content_type_header_is_msgpack L146–151
+ test_posts_to_provided_url method async_method test_posts_to_provided_url L79–89
+ test_raises_transport_error_on_4xx method async_method test_raises_transport_error_on_4xx L128–134
+ test_raises_transport_error_on_5xx method async_method test_raises_transport_error_on_5xx L137–143
+ test_returns_stored_skipped_counts method async_method test_returns_stored_skipped_counts L107–113
+ TestPushStreamWorkerRouting class class TestPushStreamWorkerRouting L175–337
+ _fake_transport method method _fake_transport L178–187
+ test_no_worker_call_when_pack_origin_absent method method test_no_worker_call_when_pack_origin_absent L276–306
+ test_objects_sent_to_worker_not_stream_when_pack_origin_set method method test_objects_sent_to_worker_not_stream_when_pack_origin_set L198–239
+ test_push_stream_accepts_pack_origin_param method method test_push_stream_accepts_pack_origin_param L189–196
+ test_stream_carries_objects_when_no_pack_origin method method test_stream_carries_objects_when_no_pack_origin L308–337
+ test_worker_url_constructed_from_pack_origin_and_repo_path method method test_worker_url_constructed_from_pack_origin_and_repo_path L241–274
+ _fresh_repo function function _fresh_repo L157–172
+ AsyncMock import import AsyncMock L18–18
+ MagicMock import import MagicMock L18–18
+ ObjectPayload import import ObjectPayload L20–20
+ RemoteInfo import import RemoteInfo L20–20
+ _parse_remote_info import import _parse_remote_info L21–21
+ annotations import import annotations L12–12
+ msgpack import import msgpack L16–16
+ patch import import patch L18–18
+ pathlib import import pathlib L14–14
+ pytest import import pytest L17–17
~ docs/protocol/musewire-architecture.md .md 4 symbols added, 5 symbols removed, 7 symbols modified
table@L222 section table@L222 L222–237
Phase D — TDD + implement CF Worker path section Phase D — TDD + implement CF Worker path L143–190
code[python]@L146 variable variable code[python]@L146 L146–157
code[python]@L159 variable variable code[python]@L159 L159–168
code[python]@L174 variable variable code[python]@L174 L174–181
+ table@L206 section table@L206 L206–221
+ Phase D — TDD + implement CF Worker path ✅ COMPLETE section Phase D — TDD + implement CF Worker path ✅ COMPLETE L143–174
+ code@L159 variable variable code@L159 L159–165
+ code@L167 variable variable code@L167 L167–171
~ muse/cli/commands/push.py .py 1 symbol added, 2 symbols modified
+ _post_object_pack function async_function _post_object_pack L123–173
~ run

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