Skip to content

Print the Pin-Resolution Note on Every Run, Including the Empty One - #610

Merged
ptr727 merged 2 commits into
developfrom
fix/sha-pin-note-on-every-run
Aug 8, 2026
Merged

Print the Pin-Resolution Note on Every Run, Including the Empty One#610
ptr727 merged 2 commits into
developfrom
fix/sha-pin-note-on-every-run

Conversation

@ptr727

@ptr727 ptr727 commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Raised by Copilot on the promotion pull request #609, against code that promotion carries.

The defect

check_sha_pin's docstring states the reason the note exists:

The counts below print on every run so that narrowness is visible rather than inferred from a clean line.

The code guarded it on a non-zero counter, so it printed on every run except the one it was written for. A repository carrying no workflow file at all resolves nothing, every counter is zero, and the note vanished, leaving precisely the clean line the sentence says nobody should have to infer the check's narrowness from.

The comment inside the guard made the contradiction plain, reading "One fixed shape every run, so a zero in any position is as visible as a count" while sitting behind the condition that made it conditional.

Reproduced before the fix, against a directory with no workflows:

bad: []
NOTES: []

The fix

The note is unconditional. After it, the same call reports what it did rather than nothing:

resolved 0 pin(s) against GitHub. Read for shape only: 0 under another owner,
0 whose owner could not be compared because this checkout's origin is unreadable,
0 GitHub did not answer for.

The existing case, test_the_note_carries_every_count_including_the_zeroes, asserted the zeroes only where a count sat beside them, which is why the all-zero run went uncovered. A case now drives that run directly.

repo_gate.py on this repository is unchanged in substance and still reports 45 under another owner, which is the number that made the hub's own zero worth surfacing in the first place.

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 8, 2026 02:06

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.

Pull request overview

Makes check_sha_pin consistently emit its pin-resolution note even when all counters are zero, and adds a regression test that exercises the previously-uncovered all-zero run (e.g., a tree with no workflow files).

Changes:

  • Remove the conditional guard so the pin-resolution note is appended on every check_sha_pin invocation.
  • Add a unit test covering the “no workflows / all counters zero” case to prevent regressions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/repo_gate.py Always appends the pin-resolution note (including for all-zero runs).
scripts/test_repo_gate.py Adds a regression test asserting the note is present when every count is zero.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/repo_gate.py Outdated
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) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 8, 2026 02:09

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit fa1ebf1 into develop Aug 8, 2026
7 checks passed
@ptr727
ptr727 deleted the fix/sha-pin-note-on-every-run branch August 8, 2026 02:16
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