diff --git a/scripts/repo_gate.py b/scripts/repo_gate.py index 7c403bd5..1a1fbead 100644 --- a/scripts/repo_gate.py +++ b/scripts/repo_gate.py @@ -168,12 +168,12 @@ def check_sha_pin(root: Path, files: list[str]) -> list[str]: unread += 1 else: resolved += 1 - if resolved or foreign or unowned or unread: - # One fixed shape every run, so a zero in any position is as visible as a count. - NOTES.append(f'resolved {resolved} pin(s) against GitHub. Read for shape only: ' - f'{foreign} under another owner, {unowned} whose owner could not be ' - f"compared because this checkout's origin is unreadable, " - f'{unread} GitHub did not answer for.') + # Unconditional, so an all-zero run is as visible as a count rather than a clean line. + # A guard on a non-zero counter hides the run that resolved nothing, which is this one. + NOTES.append(f'resolved {resolved} pin(s) against GitHub. Read for shape only: ' + f'{foreign} under another owner, {unowned} whose owner could not be ' + f"compared because this checkout's origin is unreadable, " + f'{unread} GitHub did not answer for.') return bad diff --git a/scripts/test_repo_gate.py b/scripts/test_repo_gate.py index 63d4b89d..b31e9c91 100644 --- a/scripts/test_repo_gate.py +++ b/scripts/test_repo_gate.py @@ -174,6 +174,20 @@ def test_the_note_carries_every_count_including_the_zeroes(self) -> None: with self.subTest(fragment=fragment): self.assertIn(fragment, repo_gate.NOTES[0]) + def test_the_note_prints_where_every_count_is_zero(self) -> None: + """The all-zero run is the one the note exists for, and it was the one it skipped. + + Guarded on a non-zero counter, the note went silent on a repository carrying no workflow + at all, which is exactly the clean line the docstring says nobody should have to infer + the check's narrowness from. + """ + repo_gate.check_sha_pin(self.tmp, []) + self.assertEqual(1, len(repo_gate.NOTES)) + for fragment in ('resolved 0 pin(s)', '0 under another owner', + '0 whose owner could not be compared', '0 GitHub did not answer for'): + with self.subTest(fragment=fragment): + self.assertIn(fragment, repo_gate.NOTES[0]) + def test_a_pin_github_did_not_answer_for_is_skipped_rather_than_failed(self) -> None: """Offline, unauthenticated and rate-limited all read as nothing learned, not as absent.""" self.answers({f'repos/{self.OWNER}/Fleet/commits/{PINNED}': None})