gabriel / musehub public
perf patch push task/push-timing-clean #1 / 1
AI Agent gabriel · 125 days ago · May 10, 2026 · Diff

perf(push): replace ghost check MinIO calls with single DB query in phase 3b

Phase 3b previously called backend.exists() for every externally-referenced object not already known to this repo — 8791 MinIO HEAD requests at ~22ms each = ~197s on a 988-commit push.

Replace with _check_missing_objects(): a single SQL IN query against musehub_objects. The content-addressed guarantee (sha256:<hex> IS the content) means DB registry presence is sufficient — if push/confirm wrote the row, R2 bytes were verified then. Storage availability is a read-time and background-job concern, not a push-time gate.

Also remove per-batch session.commit() from phases 7 (snapshots) and 8 (commits) — snapshots and commits now accumulate in a single transaction committed once in phase 10.

Add _tprog() closure for server-elapsed [S+Xs] timestamps on all progress frames for combined client+server timeline visibility.

Tests: flip I2 and C7 to assert ok=True (registered object trusted at push time); all 13 tests pass.

sha256:213e694e0baf7f8773457d42a6b9034151da12feb15e6e652eafb256bf88f88e sha
+3 ~1 −2 symbols
sha256:46d07bd24a5fc88251c21db44f095197f2a95db5d4eb4a2bc56b737ac3b7cf20 snapshot
+3
symbols added
~1
symbol modified
−2
symbols removed
0
dead code introduced
Semantic Changes 6 symbols
~ musehub/services/musehub_wire.py .py 1 symbol added, 1 symbol modified
+ _check_missing_objects function async_function _check_missing_objects L1444–1465
~ tests/test_push_confirm_ghost_guard.py .py 1 symbol added, 1 symbol removed
test_C7_phase_c_rejects_ghost_from_bad_confirm function async_function test_C7_phase_c_rejects_ghost_from_bad_confirm L356–392
+ test_C7_registered_object_trusted_at_push_time function async_function test_C7_registered_object_trusted_at_push_time L356–394
~ tests/test_push_object_integrity.py .py 1 symbol added, 1 symbol removed
test_i2_external_ref_in_db_but_missing_from_storage_is_rejected function async_function test_i2_external_ref_in_db_but_missing_from_storage_is_rejected L160–229
+ test_i2_registered_object_trusted_at_push_time function async_function test_i2_registered_object_trusted_at_push_time L160–217
← Older Oldest on task/push-timing-clean
All commits
Newer → Latest on task/push-timing-clean

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