Skip to content

Move wait Out of pr_review.py's main and Check Subcommand Flags From a Table #3458

Closed

Description

@ptr727

Context

main in scripts/pr_review.py holds the argparse setup, the per-subcommand flag checks, and the whole wait body. That body is the Copilot poll, the held poll, and the exit sequence, about three hundred lines. Roughly seven flag checks there each test by hand whether a flag belongs to the subcommand it was given with, and four more reject a negative number one at a time.

Suggested Change

  • Move the wait body into run_wait(owner, repo, a) -> int inside pr_review.py, which leaves main as parsing and dispatch.
  • Check flag ownership from a table of (flag, attr, owners, owners_text). owners_text is stored as data because one message names more subcommands than the check passes.
  • Reject negative values in one loop over the numeric flags.
  • Keep the first error argparse prints the same for a command line carrying several bad flags. Today the cleanup and number checks sit between the flag checks, so the table needs two passes around them.

Done When

Every existing CLI test passes unchanged, a new flag that belongs to one subcommand is one table row, and a case with two bad flags still prints the same first error.

Activity

  1. added
    enhancement
    script
    on Oct 25, 2026
  2. added a commit that references this issue on Oct 26, 2026
    d7041d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions