You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fold pr_review.py's Repeated Refusal, Subprocess, Write-Confirmation, and Ref Checks Into Helpers #3459
scripts/pr_review.py repeats four shapes at each site that needs them:
The write refusal. A refusal prints status=<KIND> nothing was written: <why> and returns its code at about sixteen sites across comment_on_pr, attest, reply_to_thread, and wait. Four of those are the same out-of-scope block that returns 64.
The subprocess call.origin_owner, receipt_reading, _git, _gh_run, and head_carries each repeat capture, UTF-8 decoding, a timeout, check=False, and turning OSError or SubprocessError into a failed result.
The write confirmation.comment_on_pr and both steps of answer_thread each dig the mutation result out through .get(k) or {}, then print the status and a truncated response on failure.
The ref check.UNSAFE_REF.search(x) or DOT_SEGMENT.search(x) appears three times, and pr_cleanup.py reaches DOT_SEGMENT through the gate.
Suggested Change
Add not_written(status, why, code) and scope_refusal(owner).
Add one _run(argv, timeout, ...). _git, _gh_run, and head_carries stay defined as thin wrappers, since tests patch them, and origin_owner keeps its broad except, since a decode error is not an OSError.
Add mutated(...) and unconfirmed(...) beside gh_graphql, which tests patch in place.
Add safe_ref(ref) and use it at every site, pr_cleanup.py included.
Done When
Each shape has one primitive, every site uses it, and every printed status= line and exit code is unchanged.
Activity
Split pr_review.py's Check and Round Readers Into Leaf Modules (#3462)
Fold pr_review.py's Repeated Refusal, Subprocess, Confirmation, and R…
Promote the pr_review.py Shared Helpers to Main (#3499)