Skip to content

Render pr_review's Digest From a Pure Leaf Module - #3493

Merged
ptr727 merged 3 commits into
developfrom
digest-render-leaf
Oct 26, 2026
Merged

ptr727 merged 3 commits into
developfrom
digest-render-leaf

Conversation

@ptr727

@ptr727 ptr727 commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Summary

Implements #3457 (the closing keyword goes on the promotion pull request).

  • scripts/pr_review_digest.py is a new pure reader module. Its render takes the payload, the normalized checks, the run log's rate-limit sentence, and the seen set as arguments, and makes no call. It imports only the other readers and the reviewer adapter, never the gate.
  • digest stays in pr_review.py as the shell that does the reads (full_read, check_nodes, and confirmed_quota when a refusal is present), so the tests that patch it there keep working.
  • The status header is an ordered list of (key, value) pairs joined by one space, a None value leaving the field out, so a new field is one entry.
  • The window, threads-truncated, and reviews-truncated advisory lines print from an ordered (value, template) table, in the order they printed before.
  • confirmed_quota is now read once per digest rather than up to twice, so refusal=QUOTA and the RATE LIMIT line can no longer disagree across two run-log reads.
  • The new module joins the readers' import guard, the whole-source guards, and the size ceilings, and scripts/README.md names it.

Verification

  • Every digest output the existing suite produces, 256 renderings across tests/test_pr_review.py, was recorded before and after the move and compared byte for byte, identical.
  • TestDigestRenderIsPinned pins a crowded and a quiet digest whole, with text captured from the pre-move code.
  • The full suite passes, python -m unittest discover -s tests, 2963 tests, 7 skipped. Ruff, mypy, and the pre-commit hook are clean.
  • A local strict review ran two rounds. Round 1 raised two introduced findings, the new helper's name colliding with pr_review_rounds.refusal_of and the pin test's docstring claiming more than it pins, both fixed in 023589f. Round 2 raised none.

Pre-existing findings, not filed

  • scripts/README.md:9, scripts/README.md:190, scripts/pr_review.py:16: pre-existing, each an older sentence over the opt-in sentence-length check's 25 words, flagged only because its line is in this diff.

The comments label is applied because four comment lines moved verbatim from pr_review.py into the new module.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 25, 2026 17:47
Move the digest's rendering into scripts/pr_review_digest.py, whose
render takes the payload, the normalized checks, and the run log's
rate-limit sentence as arguments and makes no call. digest stays in
pr_review.py as the shell that does those reads.

The header is now an ordered list of key and value pairs, so a new
field is one entry, and the window and truncation advisories are an
ordered table. Output is byte-identical over every existing case, and
two new cases pin a crowded and a quiet digest whole.

Closes #3457

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pr_review_rounds already exports a refusal_of that reads one review
node, so the digest's payload-level reader now carries its own name.
The pinned cases' docstring now claims only the fields and lines those
cases print, and the new docstring sentences fit the length rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 26, 2026 00:54
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 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 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 023589f8d61ffacdcffe0c00b6f772168ac0e3d5, 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.

🟡 Changes recommended

Address the moderate refusal-recomputation finding and the two documentation/ownership clarification nits.

1 open issue
What changed in this PR

This pull request extracts digest rendering into a pure pr_review_digest.py module while keeping data reads in pr_review.py and preserving existing output behavior.

Changes:

  • Adds ordered digest header and advisory rendering.
  • Keeps digest as the read-and-delegate shell and consolidates quota-log reads.
  • Expands source guards, size limits, documentation, and byte-for-byte output tests.
File Summary
tests/​test_pr_review.py Updates reader guards, adapter references, and pinned digest output tests.
tests/​test_pr_review_size.py Adds a size ceiling for the new digest module.
scripts/​README.md Documents the new reader module; remove the incidental reader count to avoid stale documentation.
scripts/​pr_review.py Retains digest input acquisition and delegates rendering to the pure module.
scripts/​pr_review_digest.py Provides pure digest rendering; clarify read-shell ownership and avoid recomputing the derived refusal during rendering.

Review effort: Lite

Comment thread scripts/pr_review_digest.py Resolved
The docstring's "Its `digest`" read as a function in the leaf module,
which has none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

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

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.07%. Comparing base (f87bf62) to head (3eb58d6).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3493      +/-   ##
===========================================
+ Coverage    81.04%   81.07%   +0.02%     
===========================================
  Files           25       26       +1     
  Lines         8922     8934      +12     
===========================================
+ Hits          7231     7243      +12     
  Misses        1691     1691              
Flag Coverage Δ
python-3.13 81.07% <100.00%> (+0.02%) ⬆️

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 fb485f6 into develop Oct 26, 2026
13 checks passed
@ptr727
ptr727 deleted the digest-render-leaf branch October 26, 2026 01:12
ptr727 added a commit that referenced this pull request Oct 26, 2026
…3494)

## Summary

Promotes the pull requests merged into develop since release 2.0.1189.

- [#3493](#3493): the
digest's rendering moves out of `scripts/pr_review.py` into a new pure
reader module, `scripts/pr_review_digest.py`. `digest` stays as the
shell that does the reads. The `status` header is an ordered field list
and the window and truncation advisories an ordered table. Output is
byte-identical over every existing case, and two new cases pin a crowded
and a quiet digest whole.
- [#3495](#3495):
`scripts/README.md` drops its incidental count of the reader modules and
names `pr_review.py` as what imports them, which this promotion's first
review found.
- [#3497](#3497): `wait`'s
body moves out of `main` into `run_wait`, and the per-subcommand flag
checks are read from a `FLAG_OWNERS` table in two passes, so a new owned
flag is one row. The first error printed over 1904 bad command lines is
unchanged, and a case pins the multi-flag order.

Closes #3457
Closes #3458

## Constituent coverage

Each change this promotion carries had coverage on its own pull request
into develop:

| Pull request | Merged head | Coverage |
| --- | --- | --- |
| [#3493](#3493) |
`3eb58d60` | attested local pass at the merged head, base `develop`. A
Copilot round on the earlier head `023589f8` opened one finding, fixed
in `3eb58d60` and resolved, so no Copilot round covers the merged head |
| [#3495](#3495) |
`aab59769` | attested local pass at the merged head, base `develop`, and
a Copilot table on the merged head naming exactly its 1 changed file, no
open findings |
| [#3497](#3497) |
`2ca2e75d` | attested local pass at the merged head, base `develop`. A
Copilot round on the earlier head `d145242d` opened one finding, already
fixed in `2ca2e75d` and resolved, so no Copilot round covers the merged
head |

🤖 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

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants