gabriel / muse public
feat patch task/fetch-presign-client #1 / 1
AI Agent gabriel · 141 days ago · Apr 30, 2026 · Diff

feat: client-side fetch presign routing in pull and clone

- Add HttpTransport.fetch_presign_or_stream(): tries POST /fetch/presign first; if server returns presign=True downloads bundle directly from R2 presigned URL, bypassing Cloudflare streaming timeout; falls back to fetch/stream otherwise - Wire fetch_presign_or_stream into pull.py (via getattr for safe fallback) - Wire fetch_presign_or_stream into clone.py for full clones (depth=None); shallow clones (depth set) still use fetch/stream - Add _FETCH_PRESIGN_OBJECT_THRESHOLD=500 and _FETCH_PRESIGN_BYTE_THRESHOLD=50MB to pull.py — must match server-side constants - 11 TDD tests (FPR0-FPR10) covering threshold routing, presign/stream fallback, on_object dispatch, FetchStreamResult shape, error propagation, constant match - Fix test_cli_clone.py, test_cmd_clone_hardening.py, test_cmd_pull_hardening.py: add fetch_presign_or_stream side_effect alongside fetch_stream; fix stale compute_commit_id(repo_id=...) kwarg that no longer exists in the signature

sha256:5046dc6fc91d1df74486fb3c4a5b194b6e3b9a062c3e0cb18e8a31ecb9285b73 sha
+27 ~19 symbols
sha256:32a2866ef46940db27a07309347116b92b54f2c335c0969e82fdd8f88d3e34f5 snapshot
+27
symbols added
~19
symbols modified
0
dead code introduced
Semantic Changes 46 symbols
~ tests/test_fetch_presign_routing.py .py 24 symbols added
+ _SERVER_BYTE_THRESHOLD variable variable _SERVER_BYTE_THRESHOLD L57–57
+ _SERVER_OBJECT_THRESHOLD variable variable _SERVER_OBJECT_THRESHOLD L56–56
+ _is_loopback function function _is_loopback L60–61
+ _make_bundle function function _make_bundle L79–116
+ _use_fetch_presign function function _use_fetch_presign L64–76
+ AsyncMock import import AsyncMock L32–32
+ MagicMock import import MagicMock L32–32
+ annotations import import annotations L30–30
+ call import import call L32–32
+ io import import io L33–33
+ msgpack import import msgpack L35–35
+ patch import import patch L32–32
+ pytest import import pytest L36–36
+ test_fpr0_below_threshold_uses_stream function function test_fpr0_below_threshold_uses_stream L123–128
+ test_fpr10_threshold_constants_match_server function function test_fpr10_threshold_constants_match_server L42–49
+ test_fpr1_object_threshold_triggers_presign function function test_fpr1_object_threshold_triggers_presign L135–140
+ test_fpr2_byte_threshold_triggers_presign function function test_fpr2_byte_threshold_triggers_presign L147–152
+ test_fpr3_loopback_never_presigns function function test_fpr3_loopback_never_presigns L159–164
+ test_fpr4_server_presign_false_falls_through_to_stream function async_function test_fpr4_server_presign_false_falls_through_to_stream L172–219
+ test_fpr5_server_presign_true_skips_stream function async_function test_fpr5_server_presign_true_skips_stream L227–278
+ test_fpr6_presigned_bundle_dispatches_objects function function test_fpr6_presigned_bundle_dispatches_objects L285–332
+ test_fpr7_small_repo_delegates_to_fetch_stream function function test_fpr7_small_repo_delegates_to_fetch_stream L339–382
+ test_fpr8_large_repo_presign_returns_correct_shape function function test_fpr8_large_repo_presign_returns_correct_shape L389–428
+ test_fpr9_presigned_get_error_raises_transport_error function function test_fpr9_presigned_get_error_raises_transport_error L435–467
~ muse/cli/commands/clone.py .py 1 symbol modified
~ run
~ muse/cli/commands/pull.py .py 2 symbols added, 1 symbol modified
+ _FETCH_PRESIGN_BYTE_THRESHOLD variable variable _FETCH_PRESIGN_BYTE_THRESHOLD L90–90
+ _FETCH_PRESIGN_OBJECT_THRESHOLD variable variable _FETCH_PRESIGN_OBJECT_THRESHOLD L89–89
~ run
~ muse/core/transport.py .py 1 symbol added, 1 symbol modified
+ fetch_presign_or_stream method method fetch_presign_or_stream L1345–1499
← Older Oldest on task/fetch-presign-client
All commits
Newer → Latest on task/fetch-presign-client

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