Repository navigation
Conversation
djw
force-pushed
the
claude/code-audit-roadmap-z146rn
branch
2 times, most recently
from
August 21, 2026 10:06
23bf13f to
7b086b9
Compare
The compare API returns at most 300 files for a comparison. The code read response.data.files with no check, so any change touching more than 300 files silently produced a short list and a green step. For a workflow that gates tests or a deploy on changed paths, that is a silently skipped check failing in the direction that looks like success. There is no way to ask for the rest. The endpoint's page/per_page parameters page the commits, not the files: per GitHub's API description the file list is only returned on the first page and is capped at 300 for the entire comparison. That is a property of the endpoint rather than of the client library, so no client upgrade lifts it. Since the list cannot be completed, reaching the cap now throws rather than returning a partial set. Throwing rather than calling setFailed matters here: setFailed only sets process.exitCode and does not halt, so the run would otherwise continue and publish outputs built from the short list. The existing catch turns the throw into a failed step. Also guards against a compare response with no files key, which previously would have been an unhandled TypeError reported as an opaque API error.
djw
force-pushed
the
claude/code-audit-roadmap-z146rn
branch
from
August 24, 2026 10:35
7b086b9 to
437a7c8
Compare
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.
Draft. One file,
+15 −1.The bug
The compare API returns at most 300 files for a comparison. The code read
response.data.fileswith no check:So any change touching more than 300 files silently produced a short list and a green step. No warning, no error. For a workflow that gates a test suite or a deploy on changed paths, that is a silently skipped check — and it fails in the direction that looks like success.
Easy to hit in practice: lockfile regeneration, a formatter run, a codegen refresh, or a large refactor all routinely clear 300 files.
Why this fails rather than paginating
There is nothing to paginate. The endpoint's
page/per_pageparameters page the commits, not the files — per GitHub's own API description, "the list of changed files is only shown on the first page of results, and it includes up to 300 changed files for the entire comparison."That is a property of the endpoint, not of the client library, so no client upgrade lifts this cap. Once the response comes back with 300 files there is no way to ask for the rest, so the only correct options are to report it or to silently return a partial list. This reports it.
The change
Two details worth noting:
throw, notsetFailed.setFailedonly setsprocess.exitCodeand logs — it does not halt. Using it here would let the run continue and publish outputs built from the short list, which defeats the point. The existingcatchturns the throw into a failed step, and the throw sits before all sevensetOutputcalls so nothing is published on this path.|| []guards a compare response with nofileskey, which previously would have been an unhandledTypeErrorsurfaced as an opaque API error.Verification
tsc,eslint,prettier --checkclean; existing test suite passes;dist/index.jsrebuilds byte-identical so the packaging guard stays honest. Confirmed in the built bundle that the guard (line 111) precedessetOutput(line 213), and that a thrown error surfaces through the existing catch as a failed step.Not verified against the live API — outbound calls to
api.github.comdon't complete from where this was built — so the 300 threshold comes from GitHub's published API description rather than an observed 301-file comparison.Deliberately not done
src/main.tscallsrun()at import so it isn't importable without either an entry-point guard or extracting a module. Not worth that for this. Happy to add either if you'd prefer coverage.pulls.listFilesdoes paginate and would return up to 3000 files, so a 400-file PR could be made to work correctly rather than fail. That's a larger change (new module, changed data source, and it surfaces the file-status issue below); this PR deliberately takes the small safe option instead. If these failures start firing in practice, that's the signal to revisit.Follow-ups
pulls.listFilespagination for the pull request path.setFaileddoesn't halt anywhere else either — the five other call sites inmain.tsall fall through, and a failed run can still publish outputs built from unassigned variables. Worth fixing on its own.core.debugcalls behindcore.isDebug()— currently ~90k lines / 3.3 MB of stdout per run with debug disabled, measured at 3,000 files × 10 patterns.statusswitch fails oncopied/changed/unchanged, which GitHub does return.