emrg: scripts/sync-master-from-api.py — auto-fetch missing blobs/trees via Git Data API - #998
Conversation
…s) + renderer 129 (master)
argszero
commented
Aug 26, 2026
Maintainer conflict resolution pushed ( |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260826-175425
First approval. Reviewed resolved head 7cf3ea6 (conflict resolution by maintainer):
- Real diff (vs merge-base 67d5508): 3 files +205/-7 — sync-master-from-api.py blob/tree auto-fetch (_fetch_blob via git hash-object -w with sha verification, _fetch_tree recursive bottom-up via git mktree, --no-fetch-objects opt-out) + 3 new hermetic tests (6→9)
- Blob handling covers both base64 and raw utf-8 API encodings; mktree input uses API's canonical ordering; sha-mismatch fails loud — consistent with the script's byte-exact philosophy (#988/#989)
- Local:
pytest test_doc_counts + test_sync_master_from_api13/13, py_compile OK, client import OK - CI double-green: test + test-windows (run 32955653198)
- Mergeable: CLEAN (Agent.md: python 1102 + renderer 129)
how2how2how2-arch
commented
Aug 26, 2026
Independent technical verification (cycle cyc20260826-1758,
This closes the documented blind spot from cyc20260826-154904 cleanly. No issues found. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260826-180509
Second consecutive approval (175425 → 180509). Re-verified on unchanged head 7cf3ea6:
- Head/CLEAN/MERGEABLE unchanged; CI double-green (run 32955653198)
- Agent.md python 1102 + renderer 129 counts intact
- Local: pytest test_doc_counts + test_sync_master_from_api 13/13 previously verified
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260826-181205
Third consecutive approval (175425 → 180509 → 181205). Head 7cf3ea6 unchanged / CLEAN / CI double-green (run 32955653198). Local checks green (pytest 13/13 doc-count + sync tests). Ready to merge.
…nderer 151 (Batch 3 Sidebar)
argszero
commented
Aug 26, 2026
Maintainer conflict resolution pushed again ( |
Uh oh!
There was an error while loading. Please reload this page.
…#1004) The doc-count line was a single contention point: python-test PRs bump the python count on line 1 while renderer-test PRs bump the renderer count embedded in the GUI line — any two in-flight PRs conflict on Agent.md (observed 3x this week: #997/#998/#999/#1001/#1002/#1003). Split into three lines (Python / GUI / Renderer) so each suite's PR only touches its own line. Side effect: the renderer breakdown was previously unguarded (test_doc_counts._gui_breakdowns only parses the first (N: ...) per line, which was the GUI count); on its own line it is now validated by the existing guard (format (168: ...) so all parts parse). Co-authored-by: EMRG Evolution <emrg@argszero.dev>
scripts/sync-master-from-api.py — auto-fetch missing blobs/trees via Git Data API
Fixes the documented blind spot from cycle
cyc20260826-154904(#990 follow-up): the sync script only reconstructs commit objects. When the head commit's tree references blobs/trees that don't exist locally (e.g. a parallel PR introduced files this repo never had — first hit with #994's GUI assets), the old code failed loud with "rungit fetchwhen https returns", forcing a manual gh-api blob fetch +git mktreetree-rebuild recovery dance.Changes
_fetch_blob(repo, sha)— fetches one missing blob viaGET /git/blobs/{sha}(base64 or utf-8 encoding handled) and writes it byte-exact viagit hash-object -w, verifying the sha matches._fetch_tree(repo, sha)— recursively materializes a missing tree: fetches missing blobs, recurses into missing subtrees (bottom-up), then rebuilds the tree viagit mktree(git canonical ordering), verifying the sha. Idempotent — objects already present are never re-requested. Rejectstruncatedtrees.--no-fetch-objects(previous behavior)._auth_token()via env /gh auth token, memory-only) — anonymous rate-limit protection still applies to the longer object walks.Tests (3 new, hermetic, no network)
test_script_auto_fetches_missing_content_objects— text wiring: blob path + mktree + opt-out flag present.test_fetch_missing_tree_and_blobs_hermetic— empty repo + fake API serves root tree → sub tree → blobs; asserts all objects materialize with matching shas (recursion + mktree ordering).test_fetch_missing_objects_idempotent— second run issues zero API calls.Verification
pytest tests/test_sync_master_from_api.py: 8/8 passedpy_compileOK67d5508): no-op sync path intact