Skip to content

Read a Null GraphQL Node as Unread and Name a Closed Pull Request's State in pr_review.py - #3689

Merged
ptr727 merged 8 commits into
developfrom
feature/burndown-3392-3677
Oct 31, 2026
Merged

ptr727 merged 8 commits into
developfrom
feature/burndown-3392-3677

Conversation

@ptr727

@ptr727 ptr727 commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two fixes to scripts/pr_review.py's readings. They are grouped because they touch the same reader modules.

A null GraphQL node no longer crashes wait (#3392)

GitHub can return null for a list item it could not resolve at read time, with no entry in errors. reviewer_nodes() called n.get("author") on every node, so wait ended in a traceback rather than a documented outcome.

  • Decision: a null node makes the whole read unread, not blind. A null can stand in any connection, including the threads, the check rollup, and the request state that decide exit codes. A first design here dropped the null and marked its connection blind, the way window_blind treats a cut window. The local strict review showed why that fails. The readers that decide exit codes do not read blindness. So a null standing for an unresolved thread on an attested held head exited 0 rather than 46, a silent false green where the crash had at least been loud.
  • gh_graphql() now checks every response with the new pr_review_rounds.null_node(), which names the first connection holding a null. A query holding one is read again on READ_RETRY_DELAYS through the existing backoff helper, since the null has been transient where it was seen. A null that stays ends the run at exit 1, the documented outcome of a GraphQL read that failed, naming where it sat. A mutation is never sent twice. Its null ends the run saying the write it answers was sent.
  • That one check at the transport covers every sibling that iterates a nodes list, since every read and write goes through gh_graphql(). So no reader carries a guard of its own.
  • No exit code changes.

status and wait name a pull request's state once it is no longer open (#3677)

  • HELD_FIELDS now reads mergedAt closedAt mergeCommit{ oid }, and Q_LIVE reads state.
  • On a pull request whose state is not OPEN, the digest carries state=MERGED merged_at=<ts> merge_commit=<sha8> after pr=, or state=CLOSED closed_at=<ts>. An open pull request prints none of these.
  • wait on a pull request found no longer open, on its first read or on any Copilot poll, neither requests a review nor polls further. It prints the digest and exits as status does, through a shared run_status().
  • No new exit code. The issue suggested one. The state is carried in the payload instead, since an exit code is a contract that every caller keyed on non-zero inherits. The polling hazard the issue describes is removed because wait no longer polls a closed pull request, so it never returns 30 for one. The wait docstring says that its 0 there says nothing about review coverage, and that state= says why.
  • merge-and-release step 2 now reads state=MERGED as a promotion merged since step 1 found it open, and stops re-reading. It confirms merge_commit= per step 4, runs the ready-report comparison against head=, and reports both. It dispatches no release from there, since whoever merged it may already have released it, which is the case that surfaced Name a Merged or Closed Pull Request's State in pr_review.py status #3677. state=CLOSED is a stop to report.

Size ceilings

pr_review_digest.py is at 339 of its 350 ceiling, pr_review_rounds.py at 663 of 700, and pr_review.py at 2141 of 2200. No ceiling was raised.

Not changed here

Findings left open by the local strict review

  • No introduced finding is open. The inline open-state test is now the single pr_review_rounds.is_open helper at every site in the gate and the digest (5e48f53, 98b6a68). The step 8 cleanup, the second full_read, and the unpinned first-read return were fixed in 0d05854, ab8849b, and 3893b23 after Copilot raised them too.
  • Accepted as designed: a null that outlasts the about 7 s re-read ends a long wait poll at exit 1, and a re-run recovers. A null echoed in the review-request mutation's response also ends the run, saying the write was sent, and a re-run skips the re-request. The repository-wide Copilot history read fails closed on a null as well. A pull request merged in the seconds between wait's first read and its review request still gets the request, which fails loudly. No test covers a held attested head merging mid-poll, although that path ends through held_checks_open's existing non-open arm.

Dropped findings

  • scripts/pr_review_checks.py held_checks_open and checks_never_ran: they keep their inline open-state test rather than is_open. Consolidation on a file this change does not touch.

Test plan

  • tests/test_pr_review.py gains new TestNullNodes and TestPullRequestNotOpen cases. They cover:
    • null_node naming the connection.
    • A query read again past a null.
    • A null that stays ending the run after every scheduled read.
    • A mutation never re-sent.
    • The merged, closed, and open state fields.
    • wait on a merged pull request neither requesting nor sleeping.
    • wait stopping after one poll once the pull request merges under it.
  • tests/test_pr_review.py, tests/test_pr_review_size.py, and tests/test_pr_review_copilot.py pass, and the full tests/ suite passed on the first round.
  • The pre-commit hook passes: ruff format and check, mypy, the prose gate, and the eol gate.
  • scripts/build_dist.py --check reports the generated skill distributions current.
  • The local strict review ran a pass over the full diff before each push and after each fix round, and each is recorded.

Closes on promotion: #3392, #3677

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 30, 2026 20:41
…review.py

A null entry in a GraphQL `nodes` list crashed `wait` in `reviewer_nodes`. The transport now
drops each one and counts it on its connection, which then reads blind the way a cut window
does. The digest names it in `null_nodes=`.

`status` and `wait` now lead the digest with `state=`, `merged_at=`, `merge_commit=`, or
`closed_at=` on a pull request no longer open. `wait` neither requests nor polls one and exits
as `status` does. merge-and-release step 2 reads `state=MERGED` as already merged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A dropped null left the threads, checks, and request-state readings deciding exit codes off a
list that read short, so a null standing for an open thread exited 0. A query holding a null
node is now read again on the re-read schedule, and one still holding it ends the run naming
where it sat. A mutation is never sent twice.

The Copilot poll also ends once the pull request is no longer open, and the final read routes
it to the `status` reading. merge-and-release keeps its ready-report comparison on a promotion
merged before step 2 ran.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…erged Promotion

The transport's null re-read now uses the existing `backoff` schedule rather than a loop of its
own. The digest's open-state test reads `state` the way every other site does, and a check the
non-open return made dead is dropped. merge-and-release now stops and reports on a promotion
merged since step 1 rather than going on to dispatch a release someone may already have run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 31, 2026 04:02
@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

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

@coderabbitai

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

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

Active issues remain: cleanup can be skipped after a concurrent merge, merged payloads may trigger redundant file reads, and the first-read early-return test does not distinguish the intended control flow.

3 open issues
What changed in this PR

This PR hardens pr_review.py against unresolved GraphQL nodes and makes merged or closed pull request states explicit in status and wait output. It also updates merge-and-release guidance and adds focused tests.

Changes:

  • Retries GraphQL reads containing null nodes and reports persistent unread responses without retrying mutations.
  • Adds non-open pull request state, timestamps, and merge commit details to digests.
  • Stops wait from requesting reviews or polling closed and merged pull requests.
  • Updates merge-and-release skill distributions and adds coverage for null nodes and non-open states.
  • Review follow-ups remain: run cleanup after an already-merged promotion (.agents/skills/merge-and-release/SKILL.md, nit, 4 votes); reuse the supplied full payload instead of repeating full_read (scripts/pr_review.py, moderate, 4 votes); and strengthen first-read early-return coverage (scripts/pr_review.py, nit, 1 vote; tests/test_pr_review.py, nit, 3 votes).
File Description
tests/​test_pr_review.py Adds tests for null GraphQL nodes and merged or closed pull request behavior.
scripts/​pr_review.py Adds null-node transport handling, state-aware status and wait behavior, and shared status execution.
scripts/​pr_review_rounds.py Adds recursive detection and location reporting for null GraphQL nodes.
scripts/​pr_review_digest.py Adds merged and closed pull request state fields to digests.
.github/​skills/​merge-and-release/​SKILL.md Updates the generated merge-and-release skill distribution.
.claude-plugin/​fleet-skills/​skills/​merge-and-release/​SKILL.md Updates the generated Claude skill distribution.
.claude-plugin/​fleet-skills/​.source-digests/​merge-and-release Updates the generated skill source digest.
.agents/​skills/​merge-and-release/​SKILL.md Updates the canonical merge-and-release procedure for merged and closed promotions.

Review effort: Lite

Comment thread scripts/pr_review.py Resolved
Comment thread tests/test_pr_review.py Resolved
… After a Merged Promotion

`run_status` now renders a payload it is handed rather than reading it again. A new case drives
`wait --ignore-quota-signal` over a head refusal on a merged pull request, which only the
first-read return keeps from requesting a review. merge-and-release's stop on a promotion
already merged goes on to step 8's cleanup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.91%. Comparing base (96475c1) to head (98b6a68).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3689      +/-   ##
===========================================
+ Coverage    81.74%   81.91%   +0.16%     
===========================================
  Files           27       27              
  Lines         9139     9224      +85     
===========================================
+ Hits          7471     7556      +85     
  Misses        1668     1668              
Flag Coverage Δ
python-3.13 81.91% <100.00%> (+0.16%) ⬆️

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 and others added 2 commits October 30, 2026 21:14
The stop on a promotion already merged now goes through step 7, which gates itself on scope,
before step 8, and step 8's lead names that way in. The first-read test's mock returns a request
result, so a regression fails on its own assertion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge Stop

Step 8 removes the promotion worktree wherever one exists, not only where this session made it,
and step 2's merged stop reaches step 7 only where a release scope was chosen. The mid-poll test
now lands no review, so only the merged state ends its poll, and it is bounded by --timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 3893b23ea9d355921a428f4e8882dafddb270ecb, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

On the resolved thread Use the supplied full payload (P2) at scripts/pr_review.py: this was fixed in 0d05854. run_status now renders a payload it is handed (full_read(...) if pr is None else pr), so the post-poll route no longer reads it a second time.

ptr727 and others added 2 commits October 30, 2026 21:41
`pr_review_rounds.is_open` replaces the inline `state` test at every site in the gate and the
digest, so they cannot disagree on a payload naming no state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`await_registered_head` was the last inline open-state test in the gate, read with the opposite
default for a payload naming no state. The `not ref` test beside it already covers a payload
with neither, so no reachable reading changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

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

@ptr727
ptr727 merged commit 10c5cc3 into develop Oct 31, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/burndown-3392-3677 branch October 31, 2026 05:00
ptr727 added a commit that referenced this pull request Oct 31, 2026
…de, Read Compose and Renamed Paths, and Exempt a Delete-Only Push (#3693)

Promotes the changes merged into `develop` since promotion #3681 to
`main`, the first round of a backlog burndown.

- [#3683](#3683) Carries a
newly declared verbatim section in `carry.py` instead of refusing. The
missing section is inserted in hub order: after the nearest preceding
held section, else before the nearest following one, else at the end of
the file. A rename is refused only for an unchanged body under a target
H2 the hub does not carry, and the plans apply in two phases.
- [#3689](#3689) Reads a
null GraphQL node in `pr_review.py` as unread, re-reading and then
exiting 1 naming the path. Names a closed pull request's state in the
digest, and ends `wait` on a pull request that is no longer open the way
`status` does. `merge-and-release` step 2 stops on `state=MERGED`.
- [#3685](#3685) Skips the
container side of a compose volume entry in the prose gate's home-path
rule. Pins `--find-renames` in the gate's diff, and reads a renamed file
whole only when it came from a generated tree or an excluded path.
- [#3691](#3691) Exempts a
delete-only push from the write guard's primary-checkout rule: a named
remote, every refspec a delete of a branch other than `main`, `master`
or `develop`, and only the delete, dry-run, quiet and verbose options.
The branch's live protection rules still apply. Adds regression cases
for #1628.

Deferred review findings: #3694 (a YAML block scalar in a Compose file's
volume scan) and #3690 (the `scripts/README.md` apply-time refusal
sentence). #3695 records a pre-existing write-guard question raised
while verifying them.

Fixes #3614
Fixes #3392
Fixes #3677
Fixes #3220
Fixes #1586
Fixes #1642
Fixes #1628

🤖 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants