Skip to content

Give the pr_review Readers One Accessor Each for Commit Oid, Page Info, and Head Reviews #3460

Closed

Description

@ptr727

Context

The payload readers in scripts/pr_review_rounds.py and scripts/pr_review_checks.py, and digest in scripts/pr_review.py, spell three accessors out at each site:

  • (n.get("commit") or {}).get("oid") appears about nine times.
  • ((pr.get(field) or {}).get("pageInfo") or {}).get(key) appears about six times.
  • The filter selecting one reviewer's reviews on the head appears four times.

Suggested Change

Add commit_oid(node), page_flag(pr, field, key), and one head-reviews filter in the readers, and move every lenient site onto them. One site in digest reads pr["reviewThreads"]["nodes"] strictly, so a malformed payload ends the run at exit 1. Keep that site strict rather than moving it onto a lenient accessor that would turn the failure into an empty reading.

Done When

Each accessor has one definition, every lenient site uses it, the strict site is unchanged, and the test suite passes unchanged.

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