From 94d7f8ffc6f6c8779fd53b1de7e77ec072210e82 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 07:44:45 -0700 Subject: [PATCH 1/4] Read an Oversized Finding Count as Unknown in the Copilot Adapter stated() read a section count longer than COUNT_DIGITS as zero, so a body saying 99999 open findings read as a clean round. It returns None, the reader notes the count it cannot believe, and the round's open count reads unknown. The host-setup gates-and-tests row says uv installs the test requirements rather than that there are no packages to install. --- docs/host-setup.md | 2 +- scripts/pr_review_copilot.py | 22 ++++++++++++++++++---- tests/test_pr_review_copilot.py | 11 +++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/host-setup.md b/docs/host-setup.md index b8bee55ce..4e8912224 100644 --- a/docs/host-setup.md +++ b/docs/host-setup.md @@ -384,7 +384,7 @@ Verified on Windows 11 Pro 10.0.26200 with PowerShell 7.6.4, where `python3 scri | --- | --- | | Stand up a new repo through [`STANDUP.md`][standup] | step 0 verifies identity and signing, and its window closes at the first commit | | Run the four linters locally, matching CI | `docker` runs each as the same pinned image CI uses | -| Run the repo's own gates and tests | Python 3 and `uv` cover `scripts/`, `spec/`, and `tests/` with no packages to install, `uv` supplying `tests/requirements.txt` | +| Run the repo's own gates and tests | Python 3 and `uv` cover `scripts/`, `spec/`, and `tests/`, with `uv` installing `tests/requirements.txt` for the tests | | Drive the PR and Copilot review loop | `gh` and an authenticated session | | Let an agent work with the `gh` credentials live | the host-safety kit is installed | | Have the fleet skills surface in every agent session | the skills snapshot is current per `skills_install.py --report` | diff --git a/scripts/pr_review_copilot.py b/scripts/pr_review_copilot.py index 31dfdfbb0..fa60cb0d1 100755 --- a/scripts/pr_review_copilot.py +++ b/scripts/pr_review_copilot.py @@ -199,13 +199,16 @@ def count_state(got: str, of: str) -> str: return "full" if int(got) == int(of) else "partial" -def stated(match: re.Match[str]) -> int: - """The count a matched label states: its `n` group, zero for a spelled none, one without one.""" +def stated(match: re.Match[str]) -> int | None: + """The count a matched label states: its `n` group, zero for a spelled none, one without one. + + A count longer than COUNT_DIGITS is None, since reading it as zero would report a clean round. + """ value = match.groupdict().get("n") if value is None: return 1 if value.isdigit(): - return int(value) if len(value) <= COUNT_DIGITS else 0 + return int(value) if len(value) <= COUNT_DIGITS else None return 0 @@ -376,6 +379,7 @@ def unread(note: str, start: int, end: int) -> None: opaque: list[tuple[int, int]] = [] counted: list[tuple[int, int]] = [] open_count: int | None = None + unbelieved = False entries = linked = 0 for node in found: end = node.end if node.end is not None else len(lines) @@ -403,6 +407,10 @@ def unread(note: str, start: int, end: int) -> None: if kind == "vetted" or any(p.search(summary) for p in vocab["closed_badges"]): continue count = stated(match) + if count is None: + unbelieved = True + notes.append(f"a finding count this reader cannot believe: `{name}`") + count = 0 content = "\n".join( ln.rstrip() for raw in lines[node.body : end] @@ -479,7 +487,11 @@ def placed(n: int, t: Token) -> bool: ) ): if found_kind[0] == "open": - open_count = (open_count or 0) + stated(found_kind[1]) + if (count := stated(found_kind[1])) is None: + unbelieved = True + notes.append(f"a finding count this reader cannot believe: `{name}`") + else: + open_count = (open_count or 0) + count elif matched(vocab["finding_lists"], name): listed += items_after(tokens, i + 3) elif ( @@ -527,6 +539,8 @@ def placed(n: int, t: Token) -> bool: if coverage == "none" or rank[state] > rank[coverage]: coverage, coverage_line = state, said + if unbelieved: + open_count = None named = max(open_count or 0, listed) return Reading( coverage=coverage, diff --git a/tests/test_pr_review_copilot.py b/tests/test_pr_review_copilot.py index 11b0377ec..66d1a51ac 100755 --- a/tests/test_pr_review_copilot.py +++ b/tests/test_pr_review_copilot.py @@ -300,6 +300,17 @@ def test_a_bold_count_line_states_zero(self) -> None: def test_no_count_reads_as_none_rather_than_zero(self) -> None: self.assertIsNone(adapter.read(body()).open) + def test_an_oversized_count_reads_as_none_and_is_noted(self) -> None: + for sections in ( + open_section("99999 open findings"), + "**99999 open findings**", + f"{open_section('1 open issue', ('101',))}\n\n**99999 open findings**", + ): + with self.subTest(sections=sections): + found = adapter.read(body(sections=sections)) + self.assertIsNone(found.open) + self.assertTrue(any("cannot believe" in n for n in found.notes), found.notes) + def test_an_entry_linking_no_thread_on_the_pull_request_is_unthreaded(self) -> None: found = adapter.read(body(sections=open_section()), threads=("101",)) self.assertEqual(1, found.unthreaded) From 8d4ad753922a6744c007c0e4623d9d0f7157ff65 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 07:52:56 -0700 Subject: [PATCH 2/4] Carry an Unbelievable Count Into Every Section Tally as Unknown --- scripts/pr_review.py | 12 +++++--- scripts/pr_review_copilot.py | 52 ++++++++++++++++++++------------- tests/test_pr_review.py | 11 +++++++ tests/test_pr_review_copilot.py | 12 ++++++++ 4 files changed, 63 insertions(+), 24 deletions(-) diff --git a/scripts/pr_review.py b/scripts/pr_review.py index 32e9031fb..145e9afa5 100755 --- a/scripts/pr_review.py +++ b/scripts/pr_review.py @@ -1403,7 +1403,8 @@ def collected(pr: dict, login: str, kind: str) -> tuple[list[tuple[str, adapter. """Each section of `kind` in this login's rounds, with where it was raised, and the field. Every round rather than the head's, since an unanswered finding survives a push. The field - reads `N (on_head=X earlier=Y)`, a trailing `+` on N where the reviews window was cut. + reads `N (on_head=X earlier=Y)`, a trailing `+` on N where the reviews window was cut. A tally + holding a count the reader cannot believe reads `?`. """ head = pr["headRefOid"] found = [] @@ -1417,10 +1418,13 @@ def collected(pr: dict, login: str, kind: str) -> tuple[list[tuple[str, adapter. else f"raised on {oid[:8]}, earlier round" ) found += [(where, s) for s in reading(node, login).sections if s.kind == kind] - total = sum(s.findings for _, s in found) - on_head = sum(s.findings for w, s in found if w == "on head") + + def tally(on: bool | None) -> str: + counts = [s.findings for w, s in found if on is None or (w == "on head") == on] + return "?" if None in counts else str(sum(c or 0 for c in counts)) + mark = "+" if reviews_truncated(pr) else "" - return found, f"{total}{mark} (on_head={on_head} earlier={total - on_head})" + return found, f"{tally(None)}{mark} (on_head={tally(True)} earlier={tally(False)})" def thread_author(t: dict) -> str: diff --git a/scripts/pr_review_copilot.py b/scripts/pr_review_copilot.py index fa60cb0d1..1298ff479 100755 --- a/scripts/pr_review_copilot.py +++ b/scripts/pr_review_copilot.py @@ -83,10 +83,13 @@ class Section(NamedTuple): - """One counted section: its kind, the count its label states, its title, and its text.""" + """One counted section: its kind, the count its label states, its title, and its text. + + `findings` is None where the label states a count this reader cannot believe. + """ kind: str - findings: int + findings: int | None title: str text: str @@ -101,7 +104,8 @@ class Unplaced(NamedTuple): class Reading(NamedTuple): """What one body says, in the fields the gate reads. - `open` is the count of open findings the body states, None where it states none. `unthreaded` + `open` is the count of open findings the body states, None where it states none or one this + reader cannot believe. `unthreaded` is how many findings it names that no thread on the pull request carries. `table` is the paths the body's file table names, None where it carries no table. `unplaced` is each part the reader cannot place, with its text, the subset of `notes` that can hold a finding. @@ -125,12 +129,13 @@ class Reading(NamedTuple): notes: tuple[str, ...] = () unplaced: tuple[Unplaced, ...] = () - def held(self, kind: str) -> int: - """The findings this body holds in sections of `kind`, by the counts their labels state.""" - return sum(s.findings for s in self.sections if s.kind == kind) + def held(self, kind: str) -> int | None: + """The findings in sections of `kind`, by their stated counts, None where one is unbelievable.""" + counts = [s.findings for s in self.sections if s.kind == kind] + return None if None in counts else sum(c or 0 for c in counts) @property - def counts(self) -> dict[str, int]: + def counts(self) -> dict[str, int | None]: """The findings by section: threaded, suppressed, and previously missed.""" return { "threaded": self.open or 0, @@ -192,11 +197,17 @@ def matched(patterns: list[re.Pattern[str]], text: str) -> re.Match[str] | None: return next((m for p in patterns if (m := p.fullmatch(text))), None) +def believed(digits: str) -> int | None: + """`digits` as a count, or None where it is longer than COUNT_DIGITS.""" + return int(digits) if len(digits) <= COUNT_DIGITS else None + + def count_state(got: str, of: str) -> str: """A reviewed-of-changed count as `full`, `partial`, or `unknown` where either is too long or `got` exceeds `of`.""" - if len(got) > COUNT_DIGITS or len(of) > COUNT_DIGITS or int(got) > int(of): + reviewed, changed = believed(got), believed(of) + if reviewed is None or changed is None or reviewed > changed: return "unknown" - return "full" if int(got) == int(of) else "partial" + return "full" if reviewed == changed else "partial" def stated(match: re.Match[str]) -> int | None: @@ -207,9 +218,7 @@ def stated(match: re.Match[str]) -> int | None: value = match.groupdict().get("n") if value is None: return 1 - if value.isdigit(): - return int(value) if len(value) <= COUNT_DIGITS else None - return 0 + return believed(value) if value.isdigit() else 0 class _Details: @@ -324,6 +333,11 @@ def unread(note: str, start: int, end: int) -> None: notes.append(note) unplaced.append(Unplaced(note, "\n".join(lines[start:end]).strip())) + def count_of(match: re.Match[str], name: str) -> int | None: + if (count := stated(match)) is None: + notes.append(f"a finding count this reader cannot believe: `{name}`") + return count + html = [t.content for t in tokens if t.type == "html_block"] + [ c.content for t in tokens @@ -406,11 +420,7 @@ def unread(note: str, start: int, end: int) -> None: counted.append((node.start, end + 1)) if kind == "vetted" or any(p.search(summary) for p in vocab["closed_badges"]): continue - count = stated(match) - if count is None: - unbelieved = True - notes.append(f"a finding count this reader cannot believe: `{name}`") - count = 0 + count = count_of(match, name) content = "\n".join( ln.rstrip() for raw in lines[node.body : end] @@ -418,7 +428,10 @@ def unread(note: str, start: int, end: int) -> None: ) sections.append(Section(kind, count, " ".join(plain(summary).split()), content)) if kind == "open": - open_count = (open_count or 0) + count + if count is None: + unbelieved = True + else: + open_count = (open_count or 0) + count got, links = entries_in(tokens, node.body, end, found, vocab) entries += got linked += sum( @@ -487,9 +500,8 @@ def placed(n: int, t: Token) -> bool: ) ): if found_kind[0] == "open": - if (count := stated(found_kind[1])) is None: + if (count := count_of(found_kind[1], name)) is None: unbelieved = True - notes.append(f"a finding count this reader cannot believe: `{name}`") else: open_count = (open_count or 0) + count elif matched(vocab["finding_lists"], name): diff --git a/tests/test_pr_review.py b/tests/test_pr_review.py index 65068395f..29acab582 100755 --- a/tests/test_pr_review.py +++ b/tests/test_pr_review.py @@ -2067,6 +2067,17 @@ def test_a_previously_missed_finding_is_counted_by_round_and_printed(self) -> No self.assertIn("Guard the write.", out) self.assertIn("suppressed=0 (on_head=0 earlier=0)", out) + def test_an_unbelievable_previously_missed_count_tallies_as_unknown(self) -> None: + missed = ( + f"{OVERVIEW}\n
\nPreviously missed (99999)" + "\n\nIn code that has not changed since last review\n\n[P2] Guard the write.\n
" + ) + rounds = [review(oid=OLD, body=missed, rid="A"), review(rid="B")] + self.status(payload(rounds, files=["a.py"])) + out = self.out.getvalue() + self.assertIn("previously_missed=? (on_head=0 earlier=?)", out) + self.assertIn("a finding count this reader cannot believe", out) + def test_coderabbit_s_outside_diff_findings_are_its_own_field(self) -> None: cr = { "author": {"login": pr_review.CODERABBIT_LOGIN}, diff --git a/tests/test_pr_review_copilot.py b/tests/test_pr_review_copilot.py index 66d1a51ac..b927dcad7 100755 --- a/tests/test_pr_review_copilot.py +++ b/tests/test_pr_review_copilot.py @@ -357,6 +357,18 @@ def test_suppressed_in_both_spellings(self) -> None: 2, adapter.read(body(sections=collapsed(label))).counts["suppressed"] ) + def test_an_unbelievable_section_count_is_none_beside_a_believed_open_count(self) -> None: + for label, kind in ( + ("Comments suppressed due to low confidence (99999)", "suppressed"), + ("Previously missed (99999)", "previously_missed"), + ): + with self.subTest(label=label): + sections = f"{open_section('1 open issue', ('101',))}\n\n{collapsed(label)}" + found = adapter.read(body(sections=sections)) + self.assertIsNone(found.counts[kind]) + self.assertEqual(1, found.open) + self.assertTrue(any("cannot believe" in n for n in found.notes), found.notes) + def test_a_resolved_section_counts_nothing(self) -> None: resolved = open_section("3 resolved since last review", ("1", "2", "3")) found = adapter.read(body(sections=resolved)) From 3f766caa0e718ef1350b42055b0478f8cbeae059 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 08:02:30 -0700 Subject: [PATCH 3/4] Share One None-Aware Total and Document the Unknown Tally --- scripts/README.md | 2 +- scripts/pr_review.py | 8 ++++---- scripts/pr_review_copilot.py | 10 ++++++++-- tests/test_pr_review.py | 9 ++++++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 5dd401b18..c2cbed96d 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -226,7 +226,7 @@ The digest reports the completed head review's effective effort as `lite`, `bala **`coverage=` names how the head's diff is shown read, and only a stated partial is an exit.** `full` and `PARTIAL` are the reviewer's own statement, the `fleet-review` marker the fleet's review instructions ask for, and `UNKNOWN` is a statement this cannot believe, such as one reading more files than changed, or a body the reader failed on, the reason printed beside it. A count Copilot states in a top-level paragraph that opens on it, never a list item and never inside a counted finding section, is read too, and a partial wins over any other reading beside it. A head round stating nothing while an earlier round states partial reads as `PARTIAL`, so a pull request that ever had a partial round goes to the maintainer. Where nothing states coverage, a round covering the head whose own file table names exactly the changed files reads as `table`, and the newest round on any commit whose table does reads as `carried:table`. A table stands in only where no round states partial coverage and the review history is not cut by its window, since a table names the whole changed set on a partial round too. The changed-file list is paged to GitHub's own ceiling of 3,000 files, and a list not read whole, or read empty, is read again before a table is matched against nothing. A table row matches a changed path exactly, or by a `*` or `?` glob. Otherwise `coverage=none` prints with the reason no table stood in, `status` adds a note, and the exit stays `0`, since Merge Gate item 2 in `pr-review-conduct` reads this field rather than an exit code. A partial round is reported and handed over rather than retried into, since every partial on record stayed partial at the identical ratio across every later round. -**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section, read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count. `FINDINGS WITH NO THREAD` names findings the round names, in its count or its findings list, that no open entry links to a thread on the pull request. None of these decides an exit code, and each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on. +**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section, read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. A tally holding a count the reader cannot believe reads `?`. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count or one it cannot believe. `FINDINGS WITH NO THREAD` names findings the round names, in its count or its findings list, that no open entry links to a thread on the pull request. None of these decides an exit code, and each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on. `status` and `wait` exit `50` where the round covering the head opens on a verdict other than the clean one while it states no open finding, lists none, opened no thread, and collapsed nothing, and no thread is open. Its headline prints under `VERDICT WITH NO COUNTED FINDING`, since it is the one place that round names what it flags. The code repeats on that head after the answer, since nothing here reads one, and where a check on that head has not concluded, `wait` names a bounded `gh pr checks --watch` to watch it with. A clean verdict on the same terms prints its headline under `CLEAN VERDICT HEADLINE`, advisory and gating nothing. diff --git a/scripts/pr_review.py b/scripts/pr_review.py index 145e9afa5..f30c416d8 100755 --- a/scripts/pr_review.py +++ b/scripts/pr_review.py @@ -83,10 +83,10 @@ `previously_missed=`, and `cr_outside_diff=N (on_head=X earlier=Y)` count findings collapsed into review bodies over every round, split into the head's and earlier ones, each printed whole since no thread carries it, a trailing `+` marking a cut reviews - window. `qodo_open=N` counts Qodo's findings comment entries with no Resolved or Dismissed badge, `unknown` + window. A tally holding a count the reader cannot believe reads `?`. `qodo_open=N` counts Qodo's findings comment entries with no Resolved or Dismissed badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads that round opened, `?` where it - states no count, and `FINDINGS WITH NO THREAD` names findings the round names that no + states no count or one it cannot believe, and `FINDINGS WITH NO THREAD` names findings the round names that no thread on the pull request carries. Each of these is owed the triage a suppressed finding gets, and none decides an exit code. reply Answer one thread selected by its text, and resolve it on request. Exists @@ -1420,8 +1420,8 @@ def collected(pr: dict, login: str, kind: str) -> tuple[list[tuple[str, adapter. found += [(where, s) for s in reading(node, login).sections if s.kind == kind] def tally(on: bool | None) -> str: - counts = [s.findings for w, s in found if on is None or (w == "on head") == on] - return "?" if None in counts else str(sum(c or 0 for c in counts)) + n = adapter.total(s.findings for w, s in found if on is None or (w == "on head") == on) + return "?" if n is None else str(n) mark = "+" if reviews_truncated(pr) else "" return found, f"{tally(None)}{mark} (on_head={tally(True)} earlier={tally(False)})" diff --git a/scripts/pr_review_copilot.py b/scripts/pr_review_copilot.py index 1298ff479..f6207c579 100755 --- a/scripts/pr_review_copilot.py +++ b/scripts/pr_review_copilot.py @@ -26,6 +26,7 @@ import re import sys import unicodedata +from collections.abc import Iterable from pathlib import Path from typing import NamedTuple @@ -131,8 +132,7 @@ class Reading(NamedTuple): def held(self, kind: str) -> int | None: """The findings in sections of `kind`, by their stated counts, None where one is unbelievable.""" - counts = [s.findings for s in self.sections if s.kind == kind] - return None if None in counts else sum(c or 0 for c in counts) + return total(s.findings for s in self.sections if s.kind == kind) @property def counts(self) -> dict[str, int | None]: @@ -197,6 +197,12 @@ def matched(patterns: list[re.Pattern[str]], text: str) -> re.Match[str] | None: return next((m for p in patterns if (m := p.fullmatch(text))), None) +def total(counts: Iterable[int | None]) -> int | None: + """The sum of `counts`, or None where any of them is a count the reader cannot believe.""" + found = list(counts) + return None if None in found else sum(c or 0 for c in found) + + def believed(digits: str) -> int | None: """`digits` as a count, or None where it is longer than COUNT_DIGITS.""" return int(digits) if len(digits) <= COUNT_DIGITS else None diff --git a/tests/test_pr_review.py b/tests/test_pr_review.py index 29acab582..a21583659 100755 --- a/tests/test_pr_review.py +++ b/tests/test_pr_review.py @@ -2073,11 +2073,18 @@ def test_an_unbelievable_previously_missed_count_tallies_as_unknown(self) -> Non "\n\nIn code that has not changed since last review\n\n[P2] Guard the write.\n" ) rounds = [review(oid=OLD, body=missed, rid="A"), review(rid="B")] - self.status(payload(rounds, files=["a.py"])) + self.assertEqual(0, self.status(payload(rounds, files=["a.py"]))) out = self.out.getvalue() self.assertIn("previously_missed=? (on_head=0 earlier=?)", out) self.assertIn("a finding count this reader cannot believe", out) + def test_an_unbelievable_open_count_reads_unknown_and_holds_the_round(self) -> None: + text = overview_v2(open_count="99999 open findings", entries=0) + self.assertEqual(50, self.status(payload([review(body=text)], files=["a.py"]))) + out = self.out.getvalue() + self.assertIn("overview=?/0 ", out) + self.assertIn("a finding count this reader cannot believe", out) + def test_coderabbit_s_outside_diff_findings_are_its_own_field(self) -> None: cr = { "author": {"login": pr_review.CODERABBIT_LOGIN}, From 743010e68a22cb5b51bacccb30fa51e82bfd43ed Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 08:15:22 -0700 Subject: [PATCH 4/4] Sum Open Counts Through total and Split the Overview Sentences --- scripts/README.md | 2 +- scripts/pr_review.py | 7 ++++--- scripts/pr_review_copilot.py | 20 ++++++-------------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index c2cbed96d..1add2febe 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -226,7 +226,7 @@ The digest reports the completed head review's effective effort as `lite`, `bala **`coverage=` names how the head's diff is shown read, and only a stated partial is an exit.** `full` and `PARTIAL` are the reviewer's own statement, the `fleet-review` marker the fleet's review instructions ask for, and `UNKNOWN` is a statement this cannot believe, such as one reading more files than changed, or a body the reader failed on, the reason printed beside it. A count Copilot states in a top-level paragraph that opens on it, never a list item and never inside a counted finding section, is read too, and a partial wins over any other reading beside it. A head round stating nothing while an earlier round states partial reads as `PARTIAL`, so a pull request that ever had a partial round goes to the maintainer. Where nothing states coverage, a round covering the head whose own file table names exactly the changed files reads as `table`, and the newest round on any commit whose table does reads as `carried:table`. A table stands in only where no round states partial coverage and the review history is not cut by its window, since a table names the whole changed set on a partial round too. The changed-file list is paged to GitHub's own ceiling of 3,000 files, and a list not read whole, or read empty, is read again before a table is matched against nothing. A table row matches a changed path exactly, or by a `*` or `?` glob. Otherwise `coverage=none` prints with the reason no table stood in, `status` adds a note, and the exit stays `0`, since Merge Gate item 2 in `pr-review-conduct` reads this field rather than an exit code. A partial round is reported and handed over rather than retried into, since every partial on record stayed partial at the identical ratio across every later round. -**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section, read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. A tally holding a count the reader cannot believe reads `?`. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count or one it cannot believe. `FINDINGS WITH NO THREAD` names findings the round names, in its count or its findings list, that no open entry links to a thread on the pull request. None of these decides an exit code, and each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on. +**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section, read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. A tally holding a count the reader cannot believe reads `?`. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count. A count it cannot believe reads `?` too. `FINDINGS WITH NO THREAD` names findings the round names, in its count or its findings list, that no open entry links to a thread on the pull request. None of these decides an exit code, and each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on. `status` and `wait` exit `50` where the round covering the head opens on a verdict other than the clean one while it states no open finding, lists none, opened no thread, and collapsed nothing, and no thread is open. Its headline prints under `VERDICT WITH NO COUNTED FINDING`, since it is the one place that round names what it flags. The code repeats on that head after the answer, since nothing here reads one, and where a check on that head has not concluded, `wait` names a bounded `gh pr checks --watch` to watch it with. A clean verdict on the same terms prints its headline under `CLEAN VERDICT HEADLINE`, advisory and gating nothing. diff --git a/scripts/pr_review.py b/scripts/pr_review.py index f30c416d8..6566d614d 100755 --- a/scripts/pr_review.py +++ b/scripts/pr_review.py @@ -83,11 +83,12 @@ `previously_missed=`, and `cr_outside_diff=N (on_head=X earlier=Y)` count findings collapsed into review bodies over every round, split into the head's and earlier ones, each printed whole since no thread carries it, a trailing `+` marking a cut reviews - window. A tally holding a count the reader cannot believe reads `?`. `qodo_open=N` counts Qodo's findings comment entries with no Resolved or Dismissed badge, `unknown` + window. A tally holding a count the reader cannot believe reads `?`. `qodo_open=N` + counts Qodo's findings comment entries with no Resolved or Dismissed badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads that round opened, `?` where it - states no count or one it cannot believe, and `FINDINGS WITH NO THREAD` names findings the round names that no - thread on the pull request carries. Each of these is owed the triage a suppressed + states no count. A count it cannot believe reads `?` too. `FINDINGS WITH NO THREAD` + names findings the round names that no thread on the pull request carries. Each of these is owed the triage a suppressed finding gets, and none decides an exit code. reply Answer one thread selected by its text, and resolve it on request. Exists because the hand-run form keeps failing the same way: a node id typed into a diff --git a/scripts/pr_review_copilot.py b/scripts/pr_review_copilot.py index f6207c579..53164524d 100755 --- a/scripts/pr_review_copilot.py +++ b/scripts/pr_review_copilot.py @@ -106,8 +106,8 @@ class Reading(NamedTuple): """What one body says, in the fields the gate reads. `open` is the count of open findings the body states, None where it states none or one this - reader cannot believe. `unthreaded` - is how many findings it names that no thread on the pull request carries. `table` is the + reader cannot believe. `unthreaded` is how many findings it names that no thread on the pull + request carries. `table` is the paths the body's file table names, None where it carries no table. `unplaced` is each part the reader cannot place, with its text, the subset of `notes` that can hold a finding. """ @@ -398,8 +398,7 @@ def count_of(match: re.Match[str], name: str) -> int | None: claimed: list[tuple[int, int]] = [] opaque: list[tuple[int, int]] = [] counted: list[tuple[int, int]] = [] - open_count: int | None = None - unbelieved = False + opens: list[int | None] = [] entries = linked = 0 for node in found: end = node.end if node.end is not None else len(lines) @@ -434,10 +433,7 @@ def count_of(match: re.Match[str], name: str) -> int | None: ) sections.append(Section(kind, count, " ".join(plain(summary).split()), content)) if kind == "open": - if count is None: - unbelieved = True - else: - open_count = (open_count or 0) + count + opens.append(count) got, links = entries_in(tokens, node.body, end, found, vocab) entries += got linked += sum( @@ -506,10 +502,7 @@ def placed(n: int, t: Token) -> bool: ) ): if found_kind[0] == "open": - if (count := count_of(found_kind[1], name)) is None: - unbelieved = True - else: - open_count = (open_count or 0) + count + opens.append(count_of(found_kind[1], name)) elif matched(vocab["finding_lists"], name): listed += items_after(tokens, i + 3) elif ( @@ -557,8 +550,7 @@ def placed(n: int, t: Token) -> bool: if coverage == "none" or rank[state] > rank[coverage]: coverage, coverage_line = state, said - if unbelieved: - open_count = None + open_count = total(opens) if opens else None named = max(open_count or 0, listed) return Reading( coverage=coverage,