Repository navigation
Conversation
An analyze of a large GitHub repository can hit the rate limit (#618). Count every request and write a --debug report. internal/httpcount counts each request per host and per rate-limit quota. `analyze --debug[=file]` (env PLUMBER_ANALYZE_DEBUG) writes a markdown report of every request and of the rate limit before and after the run. Query strings outside the GitHub API are redacted, so a signed job-log URL never reaches the report. Answer repeated GETs from memory (httpcount.MemoTransport). Only 2xx and 404 answers are kept, keyed on the URL and every header. Identical concurrent requests are sent once. Bodies are capped at 1 MB each and 32 MB in total. Only the GitHub API and raw-content clients use it. The OIDC token, --score-push, the update check, the job logs and the GraphQL client stay on the counting-only DefaultTransport, so a minted token, a signed URL or a GraphQL existence answer is never replayed. Trust a raw 404 only when it was sent with a token, at a commit SHA, in a repository where the contents API already accepted that token. SAML SSO or an IP allow list can refuse a valid token for one organization: the raw host answers 404, the API 403, and the read stays could-not-verify. On a branch or a tag, the raw CDN keeps a 404 for about a minute, so those reads always ask the API. Ask GitHub once which entrypoint guesses exist. One GraphQL query per 25 actions checks action.js, index.js, dist/index.js and src/index.js, and a null answer is read as missing without a request. With no token, or offline, no query is sent. Drop a branch that GitHub redirects to another name before reading its protection, which could only 404. Against v0.7.23 with GH_TOKEN exported, on 11 public repositories pinned to a tag, the JSON reports, exit codes and scores are identical. Refs #618 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uests' into feature/637-github-graphql-analyze
Action enrichment used to send several REST requests per action reference: repository info, releases, tag and branch lookups, commit checks, the immutable release flag, advisories and the tag listing. On github.com these reads now go out as aliased GraphQL queries, ten repositories per query, and fill the caches that Resolve already reads, so findings and degraded messages stay the same. A null or failed alias means the repository is missing or unreadable, as a 404 did before. A query that fails as a whole marks every repository in it as could-not-verify. A 5xx or a timeout splits the chunk in half and retries, down to one repository. The tag listing is loaded only for repositories with a SHA pin and known advisories. GHES keeps advisories and the immutable flag on REST. The anonymous fallback for tag listings is gone. The --debug report gains a GraphQL section with the cost of each query. Refs #637 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
perf
What this PR does / why we need it:
Step 1 of #637. Action enrichment sent several REST requests per action reference, so the cost of an analyze grew with every
uses:line. On github.com these reads (repository info, releases and the immutable flag, tag and branch lookups, commit checks, advisories, tag listings) now go through aliased GraphQL queries, ten repositories per query. The results fill the cachesResolvealready reads, so findings and degraded messages don't change.Measured on the 11 repositories of the #619 corpus, against a build of #619:
Findings, score and exit code are the same on all 11. The JSON reports match apart from one warning on vercel/next.js, where the cause text for
vercel/gh-sts-actionis worded differently.Which issue(s) this PR is related to:
Refs #637 (steps 2 and 3 follow in their own PRs)
This branch builds on #619 and contains a local merge of it. It stays a draft until #619 is merged, then gets rebased on main.
Special notes for your reviewer:
action.yml) still go to raw.githubusercontent.com first. The contents-API fallback isn't batched: it sent 6 requests across the whole corpus.github/metadata_graphql.go(queries) andgithub/metadata_facts.go(prefetch and the cached facts the checks read).Does this PR introduce a user-facing change?
How was this tested?
github/metadata_graphql_test.goandgithub/metadata_facts_test.go(query shape, values sent as variables, decoding, missing and failed aliases, chunk splitting, release paging, GHES path, tag paging, cost recording, prefetch grouping), the REST-based tests ported ingithub/, and the new GraphQL section ininternal/httpcount.make build,make test, andgolangci-linton./github/...and./internal/httpcount/...pass. The fullmake lintreports 7 govet findings inconfiguration/schema.goandcontrol/catalog.goand a deadcode finding (ConfigSchemas) that are already on main.plumber analyze --debugon the 11 corpus repositories with this branch and with feat(github): send fewer GitHub requests per analyze #619, comparing the JSON reports, exit codes and request reports (table above).AI usage disclosure:
YES. Claude Code wrote the code and tests under my direction, ran the corpus comparison and drafted this description. I reviewed the changes.
🤖 Generated with Claude Code