Repository navigation
Fold pr_review.py's Repeated Refusal, Subprocess, Confirmation, and Ref Checks Into Helpers - #3498
Conversation
…ef Checks Into Helpers Each of the four shapes #3459 names now has one primitive: - `not_written` prints a refusal that wrote nothing, with any detail lines after it, and `scope_refusal` is the out-of-scope refusal `comment_on_pr`, `attest`, `reply_to_thread`, and `run_wait` shared. - `_run` captures one command and returns a failure to start or finish as exit 1. `_git`, `_gh_run`, `head_carries`, `receipt_reading`, and `origin_owner` call it, and `origin_owner` keeps its broad `except` for a decode error. - `mutated` walks a mutation's response and `unconfirmed` reports one that did not confirm the write, in `comment_on_pr` and both steps of `answer_thread`. - `safe_ref` is the REST-path ref check, used by `required_contexts`, `attest`, `await_registered_head`, and `pr_cleanup.branch_rules`. Every printed line and exit code is unchanged. Each touched function's return value and stdout, recorded over the pr_review and pr_cleanup suites before and after, match, and so does each subprocess wrapper's answer to a missing binary, a timeout, and a decode error. Closes #3459 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omment The local strict-review pass found one more hand-written walk of a mutation response, in `request_copilot_review`, and it now uses `mutated` like the other sites. It also found that `origin_owner`'s comment named a missing git and a timeout as reaching its `except`, which `_run` now absorbs, so the comment says what still lands there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review findings were identified, and all member assessments indicate approval readiness.
No open issues 🎉
What changed in this PR
This pull request consolidates repeated refusal, subprocess, write-confirmation, and reference-validation logic across the PR review and cleanup scripts while preserving existing behavior.
Changes:
- Adds shared helpers for refusals, mutation responses, subprocess execution, and safe reference validation.
- Updates affected
pr_review.pypaths to use the centralized helpers. - Reuses
pr_review.safe_refinpr_cleanup.py.
| File | Description |
|---|---|
scripts/pr_review.py |
Adds and applies shared refusal, mutation, subprocess, and safe-reference helpers across review workflows. |
scripts/pr_cleanup.py |
Reuses pr_review.safe_ref for branch reference validation. |
Review effort: Lite
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3498 +/- ##
===========================================
+ Coverage 81.07% 81.10% +0.03%
===========================================
Files 26 26
Lines 8928 8907 -21
===========================================
- Hits 7238 7224 -14
+ Misses 1690 1683 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
## Summary Promotes the pull requests merged into develop since release 2.0.1192. - [#3498](#3498): `scripts/pr_review.py`'s repeated refusal, subprocess, write-confirmation, and ref-check shapes each get one primitive, `not_written` and `scope_refusal`, `_run`, `mutated` and `unconfirmed`, and `safe_ref`, and every site moves onto them, `pr_cleanup.branch_rules` included. Every printed line and exit code is unchanged, which a before-and-after recording of each touched function over the `pr_review` and `pr_cleanup` suites shows, along with a probe of each subprocess wrapper's start-failure paths. - [#3500](#3500): dependabot's `actions-deps` group bumps `docker/login-action` from 4.6.0 to 4.7.0, plus `astral-sh/setup-uv` and `actions/setup-python`, across the workflows and composite actions that pin them. Closes #3459 ## Constituent coverage Each change this promotion carries had coverage on its own pull request into develop: | Pull request | Merged head | Coverage | | --- | --- | --- | | [#3498](#3498) | `7e63bc09` | attested local pass at the merged head, base `develop`, and a Copilot table on the merged head naming exactly its 2 changed files, no open findings | | [#3500](#3500) | `79f11c72` | merged by the `ptr727-codegen` app, with no local pass or Copilot round on its own pull request, so this promotion's own Copilot round covers it | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
Each of the four shapes #3459 names in
scripts/pr_review.pynow has one primitive, and every site uses it:not_written(status, why, code, *details)prints a refusal that wrote nothing, with any detail lines after it.scope_refusal(owner)is the out-of-scope refusal thatcomment_on_pr,attest,reply_to_thread, andrun_waiteach wrote out._run(argv, timeout, unrun, **options)captures one command and returns a failure to start or finish as exit 1._git,_gh_run,head_carries,receipt_reading, andorigin_ownercall it._git,_gh_run, andhead_carriesstay as thin wrappers, since tests patch them.origin_ownerkeeps its broadexceptfor a decode error.mutated(data, *path)walks a mutation's response.unconfirmed(status, why, response, code)reports a response that did not confirm the write. They are used incomment_on_pr, both steps ofanswer_thread, andrequest_copilot_review's response walk.safe_ref(ref)is the REST-path ref check, used byrequired_contexts,attest,await_registered_head, andpr_cleanup.branch_rules.Verification
Every printed line and exit code is unchanged:
mainandpr_cleanup.branch_rules, and recorded its return value and stdout keyed by test id. I ran the fulltest_pr_reviewandtest_pr_cleanupsuites before and after the change, 1132 records each. After normalizing commit SHAs and temp paths, the records match. The one difference is a frozenset's repr order, which comes from string hash randomization._git,_gh_run,receipt_reading, ororigin_ownerfail to start. So I stubbedsubprocess.runto raiseFileNotFoundError,TimeoutExpired, andUnicodeDecodeError, and ran each of those four plushead_carriesagainst both versions. All 15 results are identical.python -m unittest discover -s tests) passes: 2965 tests, 7 skipped. ruff and mypy are clean.Two local strict-review passes ran at the
frontiertier. The first found one missed mutation walk and one stale comment, and 7e63bc0 fixes both. The second found nothing in this change.This PR carries the
commentslabel for the one comment line it rewrites, inorigin_owner.Dropped findings
scripts/pr_review.py,answer_thread: the REPLY_NOT_CONFIRMED text says "Read the response above", but the response prints below it. This is wording on text this change did not touch, and this change keeps the string byte-identical by contract (style).Refs #3459
🤖 Generated with Claude Code