From 5ac9c8863a565dde65757ba4d2daa686bb4e31a0 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Fri, 7 Aug 2026 19:05:49 -0700 Subject: [PATCH 1/2] Print the Pin-Resolution Note on Every Run, Including the Empty One Raised on the promotion pull request. The docstring says the counts print on every run "so that narrowness is visible rather than inferred from a clean line", and the code guarded the note on a non-zero counter, so it went silent on exactly the run it exists for: one that resolved nothing, which is what a repository carrying no workflow at all produces. The comment inside the guard said "one fixed shape every run" while sitting behind a condition that made it conditional. The note is unconditional now, and a case covers the all-zero run rather than only the zeroes beside a count. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/repo_gate.py | 14 ++++++++------ scripts/test_repo_gate.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/repo_gate.py b/scripts/repo_gate.py index 7c403bd5..0ae7f3c2 100644 --- a/scripts/repo_gate.py +++ b/scripts/repo_gate.py @@ -168,12 +168,14 @@ 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 a zero in any position is as visible as a count. + # Guarded on a non-zero counter it went silent on the one reading it exists to surface. + # A run that resolved nothing is what a repository carrying no workflow at all produces. + # That is the clean line the note was added to stop anyone inferring narrowness from. + 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}) From 89494cb4d18e7943b2e498989f071d08ac017c42 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Fri, 7 Aug 2026 19:09:03 -0700 Subject: [PATCH 2/2] Tighten the Note's Rationale to Two Present-Tense Lines Copilot asked for a shorter, present-tense rationale. The clarity half is taken: "the one reading it exists to surface" was an unclear phrase and the historical framing added nothing a reader needs. The two lines stay rather than becoming one. CODESTYLE.md licenses a multi-line inline comment for coupling a future edit could easily break, and re-adding the guard as an obvious optimization is exactly that edit, so the line saying what the guard would hide is the one worth keeping. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/repo_gate.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/repo_gate.py b/scripts/repo_gate.py index 0ae7f3c2..1a1fbead 100644 --- a/scripts/repo_gate.py +++ b/scripts/repo_gate.py @@ -168,10 +168,8 @@ def check_sha_pin(root: Path, files: list[str]) -> list[str]: unread += 1 else: resolved += 1 - # Unconditional, so a zero in any position is as visible as a count. - # Guarded on a non-zero counter it went silent on the one reading it exists to surface. - # A run that resolved nothing is what a repository carrying no workflow at all produces. - # That is the clean line the note was added to stop anyone inferring narrowness from. + # 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, "