Repository navigation
fix(ci): read a pull request's complete file list for a moved base's overlap (#4114) - #4151
Draft
schlessera wants to merge 1 commit into
Draft
schlessera wants to merge 1 commit into
schlessera wants to merge 1 commit into
Conversation
…overlap (#4114) pr-status read the changed files with gh pr view --json files, which returns the first 100. On a larger pull request a moved base's overlap past them was missed, and an empty overlapsThisPr read as no overlap. Read the list from the paginated pulls/<n>/files endpoint instead. GitHub ends that list at 3000 files and a comparison of two commits at 300, so when either list is cut short baseGained.overlapIncomplete now says which. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 17, 2026
This was referenced Nov 18, 2026
Merged
Merged
Merged
This branch has not been deployed
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.
Closes #4114
What changed
bun scripts/pr-status.ts <pr> --expect-base <sha>now reads every file the pull request changes before it reports which of them a moved base also touched. It read them withgh pr view --json files, which returns the first 100, so on a larger pull request an overlap past those was missed andbaseGained.overlapsThisPrcame back empty. The list now comes from the paginatedpulls/<n>/filesendpoint, and only when the base moved; the ordinary status read asks forchangedFiles(a count) where it asked forfiles.GitHub still ends two lists: a pull request's file list at 3000 files, and a comparison of two commits at 300 files. When either was cut short,
baseGainedgainsoverlapIncomplete, an array naming which list it was.overlapsThisPris then a lower bound. The key is absent whenever both lists are complete, so a pull request of 100 files or fewer prints what it printed before.ci-and-merge.mdsays what to do when the key is present.Why this shape
The issue offered two outcomes: read the complete list, or say that it is incomplete. This does the first up to GitHub's own limit and the second beyond it.
per_pageat most 100. Compare two commits: the changed files are on the first page only, "up to 300 changed files for the entire comparison". With gh 2.103.3 on merged PR test: land the test-health push (#3855): 35 batches across the whole suite #3979 (487 files):gh pr view --json filesreturned 100,gh api --paginate repos/<repo>/pulls/3979/files?per_page=100returned 487, and a comparison across 2454 commits returned 300 files wheregit diff --name-onlylists 6904.changedFiles, whatever the limit is. The comparison carries no total, so reaching 300 files is reported as incomplete. A base that gained exactly 300 files is therefore reported as possibly incomplete; that errs towards a second look.overlapsThisPr, and the acceptance criterion is that an empty overlap is never read as "no overlap" on a truncated list.baseGained.filesitself is unchanged.gh pr view --json filesand adding only a warning. The complete list costs one paginated call on a path that already exits 1, and removes the 100-file case entirely.Proof
Head
e3162f9952ea12279c45b5a52135ae0a9935543aon baseorigin/mainat564a1d57f547e64f8c7f4de0ca57d362fdfc8ac3.Failing first. The three new cases in
scripts/skill-tests/pr-status.test.ts, run againstscripts/pr-status.tsas it is onmain(19 pass, 3 fail). The test'sghdouble caps both lists where GitHub does, so the old code received what realghgives it:Mutations, each through
bun scripts/test-health.ts mutate --test scripts/skill-tests/pr-status.test.ts --name <case> --expect <text> --from-worktree scripts/pr-status.ts, which runs baseline, mutated and restored:--paginatefrom the file-list callif (mine.length < pr.changedFiles)→if (false)gained.length >= COMPARE_FILE_LIMIT→>?per_page=100--paginatethe page size changes the number of requests, not the listThe unchanged case. "a moved base fails the recheck and names what it gained and what overlaps this pull request" is untouched and still asserts the whole
baseGainedobject withtoEqualfor a two-file pull request: no new key.Live, read-only.
bun scripts/pr-status.ts 3979 --expect-base <its recorded base>: the script onmainreported 100 overlapping files and nothing else; this head reports 109 andoverlapIncomplete: ["the base gained 300 files or more, and GitHub's comparison lists only the first 300"].{"version":1,"kind":"brain-check-pr-receipt","head":"e3162f9952ea12279c45b5a52135ae0a9935543a","base":"origin/main","mode":"focused","startedAt":"2026-11-17T07:54:07.866Z","finishedAt":"2026-11-17T07:55:37.382Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13035.834538},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":124.08569800000078},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":98.77012199999808},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.168259000001854},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":76220.99233499999}]}Checklist
packages/ui-react/,packages/ui-kit/,packages/ui-server/orpackages/core/carries a recorded independent review of its head (bun scripts/review-receipt.ts check <pr>), or it touches none of them. (It touches none of them.)docs/reflect the change, or nothing documented moved. (The one description ofbaseGained, in the work-issue skill's CI reference, is updated.)pr-statusonly reads and reports.)docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed. (Nothing on a turn's path changed.)Anything left open
baseGained.filesstill counts at most 300 when the comparison is cut short. The issue puts every other field out of scope;overlapIncompletesays when that count is a floor.🤖 Generated with Claude Code