Skip to content

fix(cargo-target-janitor): readers raise SafetyError on malformed shapes (#6844) - #7005

Merged
dezren39 merged 1 commit into
mainfrom
queue/11061-6844-janitor-safetyerror
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11061-6844-janitor-safetyerror

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #6844

parse_fallback_scan, queue_claims and queue_task_states in the cargo-target janitor validated nothing about the shapes they read: a malformed fallback scan or broker row raised raw AttributeError/KeyError/TypeError/ValueError, which main() does not catch, so the janitor died with a traceback and no refused run record -- the #6812 invisible-death mode, second door.

  • All three readers now validate shapes (page/row/item list+object checks, integer id/number via a shared _shape_int helper that rejects bools/dicts/non-numeric strings, payload must be an object, status must be a string) and raise SafetyError naming the reader and the bad field/shape. SafetyError is caught by main(), producing the refused run record and exit 2.
  • Well-formed inputs return identical results (control tests added).
  • Tests: RawQueueModule stub plus malformed-shape cases for all three readers (error-dict page, string row/item/claim/payload, missing/dict/non-int id/number, dict status, list scan, dict items), asserting SafetyError and that the message names the reader.

Verified on the laptop: python3 infra/cargo-target-janitor/tests/test_cargo_target_janitor.py -- 35 tests, OK.

Queue: task 11061 (repo-health-code-pilot), lane code-v.


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:50
@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 25 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: ea22beb4-168e-4414-9250-65265c78fa95
Commits

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

Files selected for processing: 2

  • infra/cargo-target-janitor/bin/cargo_target_janitor.py
  • infra/cargo-target-janitor/tests/test_cargo_target_janitor.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:48.967660Z c1c8942 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.

@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

🤖 Agent note · parked

@developing-today

Copy link
Copy Markdown
Contributor

agent-note:v1
event: handed_off
task: 13323 (pr_shepherd, repo-health-code-pilot; worker repo-worker-code; lane code-u)
by: repo-worker-code lane code-u
at: 2026-11-08T17:03Z

Picked up task 13323 (shepherd PR #7005, issue #7297 batch part 1). Execution lane assigned opencode — handing off to the laptop claimant, which launches the bound opencode session; this lane did not work the PR itself. Fresh revalidation: PR #7005 OPEN, not draft, head c1c8942, 2 files, mergeable=true (unstable = checks pending), labels [] — no held / user/owned / do-not-merge / do-not-auto-edit hard stops. Expectation: claimant launches the bound session and drives task 13323 to a terminal state; if not launched before lease expiry, the task returns to the queue. Parked 1200s per handoff practice. (Posted via the developing.today app route: the user token is under a secondary rate limit for comment creation this shift.)

@dezren39 dezren39 added work/assigned Queue worker lifecycle state queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition labels Nov 8, 2026
@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

agent-note:v1
event: picked_up → done (fixed_merged)
queue: repo-health-code-pilot
task: 13323 (pr_shepherd, batch #7297 part 1)
by: repo-worker-code (openchamber scheduled lane 02cafe76-eafd-4d0b-aaa6-2b7a737d68dc)
at: 2026-11-08T19:20Z

Fresh revalidation (2026-11-08T19:15Z): PR #7005 OPEN, not draft, head c1c894287b, 2 files +158/-2, labels status/parked + queue/parked + work/assigned (queue lifecycle only). No hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit absent). The dezren39 author is the fleet account — this PR was opened by queue task 11061 on branch queue/11061-6844-janitor-safetyerror (see the 2026-11-08T00:55Z note), not a personal Drew PR.

Verification on the laptop (worktree ~/git/fleet/queue-13323-7005-janitor-safetyerror, head c1c894287b):

  • python3 tests/test_cargo_target_janitor.py — 35 tests, OK, including the new #6844 shape tests (queue_claims_malformed_shapes_raise_safety_error, queue_task_states_malformed_shapes_raise_safety_error, queue_readers_well_formed_controls_unchanged).
  • Codex review on this head: completed, no findings (has_any_findings: false).
  • Merge-tree against current origin/main: CLEAN. infra/cargo-target-janitor/ has no upstream changes since the branch point, so the 385-commit divergence does not touch this diff.

CI: the basic: checks have been queued since 2026-11-08T00:50Z (~18h) with no runner pickup — the fleet-wide runner stall, not a pending run. Freshly created runs are queued too. Merged under the standing criteria on local evidence, matching the precedent set on #6545.

Diff: readers (queue_claims, queue_task_states, parse_fallback_scan) now raise SafetyError naming reader + field on malformed page/row shapes instead of dying on raw TypeError/ValueError; _shape_int rejects bools and non-int/non-str. Matches #6844's stated intent.

@dezren39
dezren39 merged commit daa4451 into main Nov 8, 2026
2 of 4 checks passed
@dezren39
dezren39 deleted the queue/11061-6844-janitor-safetyerror branch November 8, 2026 19:16
@dezren39 dezren39 removed status/parked Deliberately paused with a recorded resume condition queue/parked Queue task is parked (waiting on CI, time, or an event) work/assigned Queue worker lifecycle state labels Nov 8, 2026
@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

agent-note:v1 lane code-o task 13323 (pr_shepherd, PR #7005): verified PR #7005 is MERGED on fresh read 2026-11-08; shepherd outcome already_done, completing task 13323.

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