gabriel / muse public
feat BREAKING push feat/streaming-push #1 / 1
gabriel · 164 days ago · Apr 16, 2026 · Diff

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

Replace the five-phase MWP v1 push sequence with a single bidirectional msgpack stream (push_stream on HttpTransport, _push_stream in push.py).

Transport (muse/core/transport.py — HttpTransport.push_stream): - Builds a single POST body: HEADER | OBJECT* | COMMIT_PACK | END - Objects encoded as SFRAME_OBJECT frames (raw or zlib) - Streams response with msgpack.Unpacker, yields PROGRESS to stderr, raises on ERROR, returns (commits_pushed, objects_pushed) on RESULT - All MWP v1 methods deleted (push_pack, filter_objects, etc.)

CLI (muse/cli/commands/push.py — run → _push_stream): - run() calls _push_stream instead of deleted _push_mwp - Dead code removed: get_remote_pack_origin import, max_workers, pack_origin resolution block - Module docstring updated to describe MWP v2

Tests (tests/test_cli_stream_push.py — 42 tests, 8 tiers): T1 Unit — frame construction helpers (header/object/commit_pack/end) T2 Unit — response parser (progress passthrough, error raise, result) T3 Comp — object batching logic (size limits, batch boundaries) T4 Comp — commit serialization (WireCommit fields, parent linking) T5 Svc — _push_stream() with transport mock (happy path + errors) T6 Intg — HttpTransport._open_url mock (verifies actual HTTP frames) T7 Route — CLI runner invoking push command end-to-end T8 E2E — full push simulation with result frame verification

sha256:ed79ffa437bebcf282be2c4ba23f44bee17ed9c730a89c5fbacb7e985a559167 sha
+87 ~21 −36 symbols
sha256:50ba2927e0f15a0f8898e18f08a754daca35ac45608024910d3615dbe20086fd snapshot
+87
symbols added
~21
symbols modified
−36
symbols removed
0
dead code introduced
Semantic Changes 144 symbols
~ tests/test_cli_stream_push.py .py 83 symbols added
+ TestT1ObjectPayload class class TestT1ObjectPayload L131–162
+ test_object_payload_minimal_construction method method test_object_payload_minimal_construction L134–139
+ test_object_payload_with_path method method test_object_payload_with_path L148–152
+ test_object_payload_with_zlib_encoding method method test_object_payload_with_zlib_encoding L141–146
+ test_push_result_failure method method test_push_result_failure L159–162
+ test_push_result_ok method method test_push_result_ok L154–157
+ TestT2PushStreamWiring class class TestT2PushStreamWiring L169–234
+ _call_push_stream method method _call_push_stream L172–191
+ test_no_old_methods_called method method test_no_old_methods_called L224–234
+ test_returns_push_result_and_counts method method test_returns_push_result_and_counts L216–222
+ test_transport_push_stream_branch_passed method method test_transport_push_stream_branch_passed L198–202
+ test_transport_push_stream_called_once method method test_transport_push_stream_called_once L193–196
+ test_transport_push_stream_force_false_by_default method method test_transport_push_stream_force_false_by_default L204–208
+ test_transport_push_stream_force_true_passed_through method method test_transport_push_stream_force_true_passed_through L210–214
+ TestT3Compression class class TestT3Compression L241–272
+ test_compress_zlib_is_smaller_or_equal_for_random_data method method test_compress_zlib_is_smaller_or_equal_for_random_data L256–262
+ test_compress_zlib_output_is_decompressible method method test_compress_zlib_output_is_decompressible L244–248
+ test_compress_zlib_reduces_size_for_repetitive_data method method test_compress_zlib_reduces_size_for_repetitive_data L250–254
+ test_sha256_of_raw_matches_oid_not_compressed method method test_sha256_of_raw_matches_oid_not_compressed L264–272
+ TestT4CommitWalkBoundary class class TestT4CommitWalkBoundary L279–308
+ test_walk_excludes_commits_reachable_from_branch_have method method test_walk_excludes_commits_reachable_from_branch_have L282–293
+ test_walk_includes_commits_not_in_have method method test_walk_includes_commits_not_in_have L295–301
+ test_walk_returns_oid_to_path_map method method test_walk_returns_oid_to_path_map L303–308
+ TestT5PushStreamLifecycle class class TestT5PushStreamLifecycle L315–436
+ _run method method _run L318–339
+ test_commits_sent_oldest_first method method test_commits_sent_oldest_first L377–436
+ test_objects_encoded_as_zlib_in_transport_call method method test_objects_encoded_as_zlib_in_transport_call L352–375
+ test_sends_commits_and_objects_on_fresh_push method method test_sends_commits_and_objects_on_fresh_push L341–344
+ test_sends_zero_commits_when_already_pushed method method test_sends_zero_commits_when_already_pushed L346–350
+ TestT6HttpTransportEncoding class class TestT6HttpTransportEncoding L450–557
+ _frames_sent method method _frames_sent L453–506
+ test_commit_pack_frame_present method method test_commit_pack_frame_present L532–542
+ test_first_frame_is_header method method test_first_frame_is_header L508–511
+ test_header_contains_branch method method test_header_contains_branch L513–516
+ test_header_force_field method method test_header_force_field L518–521
+ test_last_frame_is_end method method test_last_frame_is_end L544–548
+ test_object_frames_present method method test_object_frames_present L523–530
+ test_zlib_object_enc_field method method test_zlib_object_enc_field L550–557
+ TestT7CliPushCommand class class TestT7CliPushCommand L564–617
+ _patch_transport method method _patch_transport L568–574
+ test_push_401_exits_nonzero_with_message method method test_push_401_exits_nonzero_with_message L595–600
+ test_push_404_prints_helpful_message method method test_push_404_prints_helpful_message L602–607
+ test_push_calls_push_stream_not_push_pack method method test_push_calls_push_stream_not_push_pack L582–586
+ test_push_dry_run_does_not_call_transport method method test_push_dry_run_does_not_call_transport L615–617
+ test_push_exits_zero_on_success method method test_push_exits_zero_on_success L576–580
+ test_push_force_flag_passed_to_transport method method test_push_force_flag_passed_to_transport L609–613
+ test_push_non_fast_forward_exits_nonzero method method test_push_non_fast_forward_exits_nonzero L588–593
+ TestT8ErrorPaths class class TestT8ErrorPaths L624–684
+ _patch_transport method method _patch_transport L628–634
+ test_push_delete_branch_does_not_call_push_stream method method test_push_delete_branch_does_not_call_push_stream L674–684
+ test_push_invalid_format_exits_nonzero method method test_push_invalid_format_exits_nonzero L670–672
+ test_push_stream_transport_error_generic method method test_push_stream_transport_error_generic L640–643
+ test_push_to_unconfigured_remote_exits_nonzero method method test_push_to_unconfigured_remote_exits_nonzero L636–638
+ test_push_up_to_date_is_reported method method test_push_up_to_date_is_reported L645–655
+ test_push_with_json_format_returns_valid_json method method test_push_with_json_format_returns_valid_json L657–668
+ _SFRAME_COMMIT_PACK variable variable _SFRAME_COMMIT_PACK L445–445
+ _SFRAME_END variable variable _SFRAME_END L446–446
+ _SFRAME_HEADER variable variable _SFRAME_HEADER L443–443
+ _SFRAME_OBJECT variable variable _SFRAME_OBJECT L444–444
+ _SFRAME_RESULT variable variable _SFRAME_RESULT L447–447
+ _make_push_result function function _make_push_result L45–50
+ _mock_transport function function _mock_transport L119–124
+ _repo function function _repo L53–74
+ _sha256_oid function function _sha256_oid L41–42
+ Any import import Any L23–23
+ CliRunner import import CliRunner L32–32
+ MagicMock import import MagicMock L24–24
+ ObjectPayload import import ObjectPayload L30–30
+ PushResult import import PushResult L30–30
+ TransportError import import TransportError L31–31
+ __version__ import import __version__ L29–29
+ annotations import import annotations L16–16
+ call import import call L24–24
+ hashlib import import hashlib L18–18
+ io import import io L19–19
+ json import import json L20–20
+ msgpack import import msgpack L26–26
+ patch import import patch L24–24
+ pathlib import import pathlib L21–21
+ pytest import import pytest L27–27
+ zlib import import zlib L22–22
+ repo function function repo L78–116
+ runner variable variable runner L34–34
~ muse/cli/commands/push.py .py 2 symbols added, 24 symbols removed, 19 symbols modified
− PACK_MAX_BYTES variable variable PACK_MAX_BYTES L143–143
− PACK_MAX_OBJECTS variable variable PACK_MAX_OBJECTS L142–142
− PACK_OBJECT_THRESHOLD variable variable PACK_OBJECT_THRESHOLD L134–134
− _PACK_WORKERS variable variable _PACK_WORKERS L149–149
− _PRESIGN_RETRIES variable variable _PRESIGN_RETRIES L121–121
− _encode_object function function _encode_object L266–310
− _push_mwp function function _push_mwp L425–778
− _push_objects_as_packs function function _push_objects_as_packs L313–422
− _upload_chunk function function _upload_chunk L165–183
− _upload_presigned function function _upload_presigned L186–200
− _upload_presigned_curl function function _upload_presigned_curl L203–232
− _upload_presigned_urllib function function _upload_presigned_urllib L235–263
− CHUNK_COMMITS import import CHUNK_COMMITS L109–109
− CHUNK_OBJECTS import import CHUNK_OBJECTS L109–109
− Future import import Future L79–79
− ThreadPoolExecutor import import ThreadPoolExecutor L79–79
− as_completed import import as_completed L79–79
− collect_object_ids_from_walk import import collect_object_ids_from_walk L94–94
− get_remote_pack_origin import import get_remote_pack_origin L82–82
− platform import import platform L74–74
− stream_object_chunks import import stream_object_chunks L94–94
− subprocess import import subprocess L75–75
− error import import urllib.error L77–77
− request import import urllib.request L78–78
+ _push_stream function function _push_stream L125–257
+ _time import import _time L74–74
~ run
~ muse/core/transport.py .py 2 symbols added, 12 symbols removed, 2 symbols modified
− confirm_objects method method confirm_objects L1233–1252
− filter_objects method method filter_objects L1167–1201
− presign_objects method method presign_objects L1203–1231
− push_object_pack method method push_object_pack L1149–1165
− push_objects method method push_objects L1135–1147
− push_pack method method push_pack L1103–1133
− confirm_objects method method confirm_objects L654–681
− filter_objects method method filter_objects L595–621
− presign_objects method method presign_objects L623–652
− push_object_pack method method push_object_pack L558–593
− push_objects method method push_objects L526–556
− push_pack method method push_pack L503–524
+ push_stream method method push_stream L981–1152
+ push_stream method method push_stream L503–559
← 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:ed79ffa437bebcf282be2c4ba23f44bee17ed9c730a89c5fbacb7e985a559167 --body "your comment"