Skip to content

Render pr_review.py's Digest From a Pure Leaf and Build Its Header From a Field List #3457

Closed

Description

@ptr727

Context

digest in scripts/pr_review.py is the gate's largest function. It builds the status header by chaining conditional string pieces, about eight of them as + (... if x else ""), and each new header field has been added the same way. It also renders its fixed advisory lines (the window, truncation, and blindness notes) as separate if cond: lines.append(...) blocks. The check lines already moved to check_lines in scripts/pr_review_checks.py, keyed by a table.

Suggested Change

  • Keep digest in pr_review.py as a thin shell. Tests patch it there, and it is where the reads happen: full_read, check_nodes, and confirmed_quota when a refusal is present.
  • Move the rendering into a pure render in a new leaf module, which takes those results as arguments, makes no call, and never imports the gate.
  • Build the header from an ordered list of (key, value) pairs joined by one space, so a new field is one entry.
  • Render the fixed advisory lines from an ordered table of (value, template), in the order they print today.

Done When

The status and wait output is byte-identical over the existing fixtures, a test pins that equality, and adding a header field is a one-line change.

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