Repository navigation
Description
github-backup(manifest): a valid-JSON but wrong-shape plan/state entry crashes the whole manifest regeneration — MANIFEST.json (the DR source) is never rewritten
Evidence
infra/github-backup/bin/manifest.py, build() (verified on laptop at origin/main fff580fb1e):
:36/:38—planandstateare loaded with barejson.loadand never shape-checked.:41-42—for item in plan: repo = item["repo"]subscripts every plan entry unguarded.:49—"last_fetch": (state.get(repo) or {}).get("last_fetch")assumes every state value is a dict (or falsy).
Verified this run with a probe on the laptop (~/git/fleet/probe-manifest-shape/probe_manifest.py, real manifest.build() against temp roots, only load_config stubbed):
- Controls pass: valid plan+state →
OK totals={'mirrored': 0, 'missing': 1, 'disk_kb': 0}; empty plan/state → OK. - Malformed shapes all raise, and no
MANIFEST.json/FAMILIES.mdis written:- plan entry
123→TypeError: 'int' object is not subscriptable - plan entry
"o/r"→TypeError: string indices must be integers - plan entry
[]→TypeError: list indices must be integers or slices - plan entry
{"size_kb": 1}(norepo) →KeyError: 'repo' - plan top-level
{"repo": "o/r"}(dict, not list) →TypeError: string indices must be integers - state entry
{"o/r": 123}→AttributeError: 'int' object has no attribute 'get' - state entry
{"o/r": "t"}→AttributeError: 'str' object has no attribute 'get' - state top-level
[]→AttributeError: 'list' object has no attribute 'get'
- plan entry
Why it matters
MANIFEST.json is the disaster-recovery source of record (module docstring: it records what DOES exist, where, and its state; together with config.json it rebuilds the whole backup tree). One poison entry in plan.json or state.json — written by another tool, a hand edit, or a partial migration — wedges every regeneration: the manifest silently goes stale while mirrors keep changing, and the failure surfaces only at DR time, when the stale manifest is trusted. The poison entry also re-crashes every subsequent run until someone hand-edits the JSON. Sibling consumers were hardened/filed separately (#6637 fetch, #6606 reconcile); manifest is the remaining unguarded consumer of the same two files. Distinct from #3240, which covers torn/invalid JSON and non-atomic writes — this is valid JSON with the wrong shape.
Acceptance criteria
build()validates plan/state shape: a non-list plan, a non-dict state, a plan entry that is not a dict with a stringrepo, or a non-dict state value produces a clear, named error (or a per-entry skipped/error record) instead of a rawTypeError/KeyError/AttributeErrortraceback.- Valid entries in the same file still regenerate
MANIFEST.json+FAMILIES.md(or the run fails atomically with the offending entry named — either contract is acceptable if it is explicit and tested). - Regression tests in
infra/github-backup/tests/cover the malformed shapes above against the realbuild().
Activity
developing-today commentedon Nov 7, 2026
CODE-2056
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 7, 2026
Picked up by repo-worker-code-y (Lane Y queue worker shift, FALLBACK MODE — queue backend down: fleet queue health returns HTTP 503 PGRST002; fallback protocol in doc/fleet/queue-fallback-mode.md followed manually via the gh CLI, the fallback subcommand not yet being in the deployed fleet 0.1.0 binary).
🤖 Agent note · picked up
11 remaining items
dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-l— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-lposts progress markers; after 30 minutes of silence any other worker may pick this up.)🤖 Agent note · picked up
dezren39 commentedon Nov 7, 2026
Progress from
repo-worker-code-l: implementation_complete: 4 manifest-specific regression tests added to test_plan_state_shape.py (24/24 pass at head); all 5 ManifestShapeTests error on pre-#6696 main a2e6549 with exactly the documented TypeError/AttributeError shapes; next: full suite, commit, PRMerge pull request #6706 from developing-today/queue/fallback-6653-ma…
dezren39 commentedon Nov 7, 2026
Released by
repo-worker-code-l(outcome: done). Issue #6653 COMPLETED and merged: PR #6706 #6706 (branch queue/fallback-6653-manifest-shape-tests, merge commit 8e20f10). The production validation for manifest build() had already landed via PR #6696 (issue #6637, shared ghb_common validators, per the coordination note); this claim landed the remaining acceptance scope — manifest-specific regression tests against the real build() for every probe shape (plan entry 123 / string / list / missing repo, plan top-level dict, state entry int / string, state top-level list). Verified: 24/24 in test_plan_state_shape.py and full github-backup suite green at head; all 5 ManifestShapeTests error on pre-#6696 main a2e6549 with exactly the documented exceptions. Codex review: no findings. Issue auto-closed by the PR.🤖 Agent note · done