Skip to content

Refuse the Wait-Only and Check-Threshold Flags on Other pr_review Subcommands - #3626

Merged
ptr727 merged 2 commits into
developfrom
feature/wait-only-flags-3496
Oct 29, 2026
Merged

ptr727 merged 2 commits into
developfrom
feature/wait-only-flags-3496

Conversation

@ptr727

@ptr727 ptr727 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Summary

Implements #3496. The promotion pull request carries the closing line.

FLAG_OWNERS refuses a flag on a subcommand that does not own it, since an ignored flag reads as one that took effect. Five flags read only by wait, or by status and wait, were missing from it, so every other subcommand accepted them silently.

  • --timeout, --min-rounds, and --ignore-quota-signal get rows owned by wait.
  • --check-grace and --check-stall get rows owned by status and wait. The issue left these two out because status reads them too. The table already takes more than one owner, so they close the same defect on claims, attest, comment, and reply.

Every new row is late, so the first error printed for a command line that was already wrong stays the same. test_a_command_line_with_two_bad_flags_names_the_same_one_first pins that, including its --timeout 5 cleanup ... case. The four valued flags no longer carry argparse defaults. They default to None until the ownership check has read them, so an explicit default such as status --timeout 2700 is refused too. The defaults are filled in right after that check, before the negative-value and grace-versus-stall checks that read them. So status and wait see the same values as before.

Verification

  • python -m unittest discover -s tests ran 3084 tests, OK (skipped=7).
  • New cases refuse each wait-only flag, at its default value, on status, reply, comment, claims, and attest. They refuse each threshold on reply, comment, claims, and attest. They also pin what wait reads: 2700, 0, and the two threshold constants when the flags are left off. Explicit values pass through unchanged.
  • ruff format, ruff check, mypy, and prose_lint.py --diff are clean.
  • The local strict review ran two rounds at the frontier tier. Round one found the threshold flags, fixed in the second commit. It also raised a style note about putting the defaults in module constants, which was declined because nothing reads them wrong today. Round two found nothing.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 29, 2026 13:11
`--timeout`, `--min-rounds`, and `--ignore-quota-signal` are read only by
`wait`, and any other subcommand accepted them silently. Each now has a
late `FLAG_OWNERS` row owned by `wait`, so the first error printed for an
existing bad command line is unchanged. The two valued flags default to
None until the ownership check has read them, so an explicit default is
refused too, and `wait` still reads 2700 and 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`--check-grace` and `--check-stall` are read by `status` and `wait` and
were silently ignored by every other subcommand, the same defect #3496
names for the wait-only flags. Each gets a late row owned by both, with
its default filled in after the ownership check, before the threshold
validation that reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 29, 2026 20:24
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • 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

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head e99775260e5cf2439461b584513d78f7f1e019a3, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active issues remain, with the change focused on flag ownership and supported by regression tests covering invalid combinations, error ordering, and preserved defaults.

No open issues 🎉

What changed in this PR

This pull request closes a command-line validation gap by rejecting wait-only and check-threshold flags on unrelated pr_review subcommands while preserving existing defaults and error ordering.

Changes:

  • Adds ownership rules for timeout, round, quota, and check-threshold flags.
  • Defers default assignment until after flag ownership validation.
  • Adds regression tests for invalid flag combinations, error ordering, and preserved wait defaults.
File Description
tests/​test_pr_review.py Tests foreign-flag rejection, error ordering, and default propagation.
scripts/​pr_review.py Enforces flag ownership and restores defaults after validation.

Review effort: Lite

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.62%. Comparing base (9b5dbcf) to head (e997752).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3626   +/-   ##
========================================
  Coverage    81.61%   81.62%           
========================================
  Files           26       26           
  Lines         9073     9077    +4     
========================================
+ Hits          7405     7409    +4     
  Misses        1668     1668           
Flag Coverage Δ
python-3.13 81.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 3172314 into develop Oct 29, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/wait-only-flags-3496 branch October 29, 2026 20:36
ptr727 added a commit that referenced this pull request Oct 29, 2026
…her pr_review Subcommands (#3627)

Promotes the #3496 flag-ownership rows from `develop` to `main`.

- [#3626](#3626) Refuses
the wait-only and check-threshold flags on other pr_review subcommands.

Closes #3496

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants