Skip to content

github-backup: validate plan reference/branch/parent field shapes - #7004

Merged
dezren39 merged 1 commit into
mainfrom
queue/11053-6834-validate-plan-field-shapes
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11053-6834-validate-plan-field-shapes

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #6834 (task 11053).

validate_plan (#6637) checked only that a plan entry is an object with a string repo — the consumed reference / branch / parent fields passed at any JSON shape, and one poison entry crashed every consumer:

  • list/dict reference: unhashable TypeError in clone_all's scheduler (state.get(ref)) and in manifest's families.setdefault
  • int reference: mixed-type TypeError in manifest's sorted(families), or a bogus ## anchor: 123 family
  • non-string branch: TypeError in manifest head_sha ("refs/heads/" + branch) for present mirrors

Change

  • ghb_common.validate_plan: per entry, each of reference / branch / parent must be a string or null/absent. A wrong-shape value is reported as a named problem (source, entry index, repo, field, actual shape) and neutralized to None — the entry is kept, only the poisoned field is dropped. Entries are copied, never mutated in place. Contract is explicit in the docstring.

Tests

  • test_plan_state_shape.py: list/dict/int/bool reference, int/list branch, list/dict parent neutralized + named; string/null controls unchanged; input not mutated; manifest build with poisoned fields (no bogus anchor, MANIFEST.json + FAMILIES.md still written); branch shape with a present mirror.
  • test_clone_all_references.py: scheduler completes (DONE, all ok, no --reference) with list/int references.
  • Full infra/github-backup/tests/ suite green on the laptop (all 11 test files).

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 00:49
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef1c9ec3-32d1-4051-b9bd-fd462b85ea5b
Commits

Reviewing files that changed from the base of the PR and between 8169bbd and ea0f944.

Files selected for processing: 3

  • infra/github-backup/bin/ghb_common.py
  • infra/github-backup/tests/test_clone_all_references.py
  • infra/github-backup/tests/test_plan_state_shape.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T00:51:34.718283Z ea0f944 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant