Skip to content

ask whether patch-it is readable with the workflow token - #110

Merged
brandonphelps1212 merged 1 commit into
mainfrom
contract-check-probe
Nov 19, 2026
Merged

brandonphelps1212 merged 1 commit into
mainfrom
contract-check-probe

Conversation

@brandonphelps1212

Copy link
Copy Markdown
Contributor

What this changes

A fix to CI_contract only; no plugin changes.

The problem. The contract check first asks the GitHub API whether patch-it-dev/patch-it is readable, and skips with a notice on 404 (patch-it is private). It asked anonymously, and anonymous API requests are limited to 60 an hour per IP, shared by everyone's jobs on a runner. On #109 the probe got something other than 404. It was most likely a 403 from that limit, but the code wasn't logged. The workflow read that as "readable", tried to clone the private repo, and failed:

fatal: could not read Username for 'https://github.com': terminal prompts disabled

Nothing in #109 touched contract/. The same check had skipped on every earlier PR.

The fix.

  • The probe sends the workflow's own github.token. That token can't read patch-it either (a private repo still answers 404), but it isn't subject to the anonymous limit. The clone itself stays anonymous, as before.
  • It logs the code. It skips only on 404, clones on 200, and fails with the code on anything else. A check that didn't run should never show green.

Checklist

  • docs/plugins.md: not applicable, no plugin changed.
  • Every commit is signed off (git commit -s, DCO)
  • Golden test, drop test, provider page: not applicable, no plugin changed.
  • The workflow YAML parses; this PR's own CI_contract run exercises the new probe (expect the 404 notice).
  • scripts/leak_guard.py --all passes.
  • Nothing private: no credentials, internal hosts, private links, customer names

Notes for the reviewer

  • The check still can't do its job while patch-it is private. It skips. To actually compare the fixtures, it needs a token with read access to patch-it-dev/patch-it, such as an org secret. That's a separate decision.
  • Per AGENTS.md, I didn't re-run add the supabase plugin #109's failed check. Once this merges, add the supabase plugin #109 gets the fix by updating from main.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: brandonphelps1212 <bphelps1212@gmail.com>
@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Claude finished @brandonphelps1212's task in 1m 13s —— View job


✅ Ready to merge: a small, well-reasoned CI-only fix. The probe no longer hits the anonymous rate limit, and an unexpected answer now fails the check, with the code in the log, instead of passing.

Rules

Rule Status Evidence
Plugin list (docs/plugins.md) n/a Only .github/workflows/CI_contract.yml changed; no plugin was added, removed or changed
Provider page n/a No provider changed
Golden test + dated quote n/a No plugin code or testdata/ changed
Drop test n/a No plugin changed
Fetch only via env / kit n/a No Go code changed
contract/fixtures/ untouched ✅ Only the workflow changed, not the fixtures
Nothing private ✅ No secrets: github.token is passed as a header, and Actions masks it in logs. The only link is to a public repo. The commit, PR body and comments have no internal names. leak_guard.py --all passes
DCO sign-off ✅ The one commit has Signed-off-by: and keeps its co-author trailer

Bugs

None found. I traced each path the probe can take:

  • 404 (patch-it private): the step logs a notice and sets present=false, so compare is skipped. This is the same as before. GITHUB_TOKEN is scoped to this repo, so it gets 404 for a private sibling repo, as the comment says.
  • 200 (patch-it public): the anonymous clone succeeds. The token can't read any private repo the anonymous clone couldn't, so a 200 that leads to a failed clone isn't possible.
  • 403 / 429 / 5xx: the step fails with the code in the log. --retry 2 covers short-lived 429/5xx answers but not 403, which is the right behaviour here.
  • Network failure (000): the step fails with the code, because curl -s still prints 000 and 000 isn't 200. That's correct.
  • PRs from forks: the run is pull_request, not pull_request_target, and has contents: read, so the token's privileges don't grow. Fork runs still get a read-only token, which is enough for the probe.

Verified

  • go build ./...: OK
  • go vet ./...: OK, no output
  • gofmt -l .: printed nothing
  • go test -race ./...: all 19 packages ok
  • python3 scripts/leak_guard.py --all: "no banned terms (8 hashed terms checked)"
  • git log -1: the commit is signed off
  • I didn't parse the YAML myself: the sandbox blocked my python3 -c check. I read the file instead and found nothing wrong. This PR's own CI_contract run is the real test. Expect the 404 notice there.

Non-blocking

  • The step is still named clone patch-it's fixtures (anonymous) (line 42), and the header says "cloned anonymously, with no token" (lines 6–7). Both are still true of the clone. Now that the probe sends a token, you could rename the step to something like probe and clone patch-it's fixtures (clone is anonymous) so nobody reading the log thinks no token is used anywhere.
  • One trade-off to know about: pull_request, merge_group and the weekly schedule run all now fail on any code other than 200 or 404, where before they went ahead and tried the clone. That's the stated intent, and I agree with it. It does mean a GitHub API outage will turn this check red until the API recovers.

@brandonphelps1212
brandonphelps1212 merged commit c44d4b5 into main Nov 19, 2026
5 checks passed
@brandonphelps1212
brandonphelps1212 deleted the contract-check-probe branch November 19, 2026 17:28
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.

1 participant