Skip to content

fix(fleet-paperwork): validate GitHub API response shapes (#6864) - #7021

Merged
dezren39 merged 1 commit into
mainfrom
queue/11098-6864-fleet-paperwork-shapes
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11098-6864-fleet-paperwork-shapes

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Validate GitHub API response shapes in fleet-paperwork (issue #6864), so a parseable-but-wrong-shaped body dies with the tool's own diagnostic instead of a raw AttributeError/KeyError/TypeError — including inside http()'s own error handler:

  • http() gains shape validation: a non-object success body (or non-array for the one array endpoint) dies naming method, URL, HTTP status, and received shape (_shape_name); a non-object error body reports the status, the shape, and still surfaces the raw excerpt; a non-JSON success body dies cleanly. The legitimate array response (GET /app/installations) is carved out by name via expect=list.
  • installations() validates its entries are objects; _account_login() tolerates absent/null/non-string account shapes in installation_for, token_for (numeric-id check), and cmd_check.
  • assert_repo_in_scope dies cleanly on a repository entry without a string full_name (and on non-list repositories / non-number total_count) instead of a raw KeyError at the start of every command.
  • find_by_exact_title skips non-object search items instead of crashing on a bare string, and guards the items shape.
  • Downstream .get calls in create/comment/close are safe by construction now that http() guarantees the documented shape.

Tests

New TestResponseShapes (12 tests, transport stubbed as in the probe): error bodies as list/string/number, object error body keeps its message, success bodies with wrong shapes, non-JSON success body, installations dict-instead-of-list and string item, null account tolerance, assert_repo_in_scope with/without full_name, non-object search items. Full suite: python3 -m unittest discover -s infra/fleet-paperwork/tests — 29 tests OK on the laptop.

Merge Danger

Door: Two-way

Blast Radius: Low — the fleet's rate-limit fallback tool; well-shaped flows are unchanged (all pre-existing tests pass), and wrong-shaped flows now fail with a better diagnostic instead of a traceback.

Fixes #6864

🤖 Queue worker lane code-o, task 11098.


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

@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 8, 2026 01:08
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: 26b73416-883c-4d29-b8cd-f91a07ba16d7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@dezren39
dezren39 force-pushed the queue/11098-6864-fleet-paperwork-shapes branch from 28f3ee8 to 8f6c678 Compare November 8, 2026 16:04
@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member

Agent note — task 13328 (pr_shepherd, PR #7021 for issue #6864, batch issue #7297), lane code-g, DIRECT. Rebased this PR onto current main (was 305 commits behind, mergeable_state unstable): new head 8f6c678, single commit, diff unchanged in intent (2 files, +243/-11 — fleet_paperwork.py shape validation + tests). Targeted tests on the laptop: python3 -m unittest discover in infra/fleet-paperwork/tests — 29 tests OK. Review state: no Codex review exists on this PR and CodeRabbit skipped review (bot-authored PR) — no findings to disposition on the old head; a fresh Codex round on 8f6c678 is still owed before merge. CI: 5 basic-tier checks queued on the new head, none started (fleet-wide runner backlog). Parked on CI — resume: fresh checks + Codex on 8f6c678, merge when green.

@developing-today

Copy link
Copy Markdown
Contributor Author

🤖 Agent note · picked up

@dezren39
dezren39 merged commit 7ca8b5d into main Nov 8, 2026
3 of 6 checks passed
@dezren39
dezren39 deleted the queue/11098-6864-fleet-paperwork-shapes branch November 8, 2026 18:09
@developing-today

Copy link
Copy Markdown
Contributor Author

🤖 Agent note · done

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

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

1 participant