Repository navigation
github-backup: mirror contract remainder (#3238, #3270, #3240, #3283) - #7723
Merged
Merged
Conversation
developing-today
Bot
requested review from
a team and
dezren39
as code owners
November 8, 2026 14:12
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
4 tasks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3238, closes #3270, closes #3240, closes #3283 — the four open children of design #3282 ("a mirror is what it can prove"), driven by queue task 12622. The other phase children (#3233, #3250, #3219, #3257, #3229) are already closed, so this PR completes the design's acceptance: no surface of the system can report coverage, success, or health the underlying mirrors, records, or inventory do not support.
#3238 — validity is resolvability (design rule 1–2)
ghb_common.valid_mirrornow requires bareness AND a resolvable HEAD (rev-parse --verify -q HEAD). No emptiness exception: planned repos are never legitimately empty (build_plan excludes zero-commit repos), documented in the docstring.ghb_common.is_skeleton_mirror(bare + unresolvable HEAD + zero refs);clone_all.dest_is_confirmed_partialtreats a skeleton as a confirmed partial, so a killed clone's skeleton is cleared and re-cloned instead of being preserved forever by the github-backup(clone_all): a clone killed mid-flight leaves a partial destination every rerun rejects — the 'resumable' driver never resumes that repo #3233 policy guard. A bare repo WITH refs is still preserved.#3270 — a missing mirror reaches the alarm (design rule 5)
fetch_mirrors.fetch_reporecords a missing mirror as an unavailable day through the samefail_daysstreak as failures (github-backup(fetch): fail_days counts every failure day since the last success, not 3 days in a row — intermittent failures weeks apart trip the chronic alarm and latch exit 1 #3257 semantics): 3 consecutive missing days now make the daily run exit 1. Success clears the record via the existing reset. The drainer shares the recorder, and same-day repeats count once.#3240 — state written atomically, loaded tolerantly, only through ghb_common (design rule 6)
ghb_common:atomic_write_text(temp file in the same directory + fsync +os.replace+ last-good copy),save_json,load_json_tolerant(torn file → last-good copy, else empty, always with a loud named problem), andstate_lock(shared flock).load_plan/load_stateroute through the tolerant loader — a torn plan.json/state.json no longer wedges fetch, drainer, clone pass, manifest, or reconcile at startup.state_lockacross their whole load→modify→save cycle, closing the lost-update window.#3283 — closing audit
json.load/open("w")/ filejson.dumpininfra/github-backup/bin/is posted on Phase 3 (audit) of #3282 — closing state-access inventory + contract statement for infra/github-backup #3283 with a disposition for every hit: after this PR the only file-IO hits are the ghb_common helpers themselves,load_config(repo source file, not generated state), subprocess/API payload parsing, and append-only logs (out of the torn-write class by the audit's own scope).worker/src/index.js) — out of scope, KV is its store (recorded on Phase 3 (audit) of #3282 — closing state-access inventory + contract statement for infra/github-backup #3283).infra/github-backup/README.md, cross-referenced from the DR section ofdocs/RUNBOOK.md. Completion evidence is posted on umbrella github-backup: estate mirror system (laptop mirrors + dedicated App + Worker webhooks + weekly sweep) #3215.Tests
tests/test_mirror_contract.py: skeleton invalid + complete mirror valid (real git repos), skeleton confirmed-partial vs complete preserved, manifest reports a skeletonmissing, missing-day streak accumulation + chronic exit 1 throughmain()+ clear-on-ok, atomic roundtrip/last-good fallback/torn-without-backup/intact-on-failed-replace, state lock.test_plan_state_shape.py::test_main_survives_state_top_level_list— the saved state now also carries the github-backup(fetch): a missing mirror can never trip the chronic alarm — 'missing' returns before any fail_days record, so the daily run exits 0 forever #3270 missing-day record for the (patched-invalid) repo; the github-backup(fetch): a valid-JSON but wrong-shape plan/state entry crashes the whole daily fetch — one poison entry in plan.json or state.json wedges every repo, every day #6637 wrong-shape contract it guards is unchanged.test_clone_all_partial.py,test_reconcile_clone_pass.py,test_reconcile_retention.py): their "valid mirror" fixtures weregit init --bareskeletons — the exact shape github-backup(valid_mirror): a bare skeleton with zero refs passes as a verified mirror — clone_all records it ok and MANIFEST.json reports it 'mirrored' #3238 makes invalid — so they now seed one real commit. The behaviours those suites guard (github-backup(clone_all): a clone killed mid-flight leaves a partial destination every rerun rejects — the 'resumable' driver never resumes that repo #3233 partial clearance, github-backup(reconcile): a failed clone pass exits 0 and is absent from the dated report — clone_all's verdict is dropped by its only scheduled caller #3300 clone-pass propagation, github-backup(inventory): a null repositoryOwner is silently read as 'this owner has no repos' — reconcile drops the owner's mirrors from plan.json and MANIFEST.json and exits 0 #3229 retention) are unchanged.🤖 Queue worker lane code-g, task 12622.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.