Skip to content

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
mainfrom
fix/4114-pr-status-complete-files
Draft

schlessera wants to merge 1 commit into
mainfrom
fix/4114-pr-status-complete-files

Conversation

@schlessera

@schlessera schlessera commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

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 with gh pr view --json files, which returns the first 100, so on a larger pull request an overlap past those was missed and baseGained.overlapsThisPr came back empty. The list now comes from the paginated pulls/<n>/files endpoint, and only when the base moved; the ordinary status read asks for changedFiles (a count) where it asked for files.

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, baseGained gains overlapIncomplete, an array naming which list it was. overlapsThisPr is 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.md says 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.

  • The limits were read from the source, then observed. List pull requests files: "Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default", per_page at 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 files returned 100, gh api --paginate repos/<repo>/pulls/3979/files?per_page=100 returned 487, and a comparison across 2454 commits returned 300 files where git diff --name-only lists 6904.
  • The truncation is detected by count, not by a constant. The pull request's list is incomplete when it is shorter than 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.
  • The comparison's limit is handled here although the issue names only the pull request's list. It feeds the same overlapsThisPr, and the acceptance criterion is that an empty overlap is never read as "no overlap" on a truncated list. baseGained.files itself is unchanged.
  • Not taken: keeping gh pr view --json files and 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 e3162f9952ea12279c45b5a52135ae0a9935543a on base origin/main at 564a1d57f547e64f8c7f4de0ca57d362fdfc8ac3.

bun run check:pr --base origin/main   # exit 0
bun run test:skills                   # 269 pass, 0 fail

Failing first. The three new cases in scripts/skill-tests/pr-status.test.ts, run against scripts/pr-status.ts as it is on main (19 pass, 3 fail). The test's gh double caps both lists where GitHub does, so the old code received what real gh gives it:

(fail) a moved base's overlap is named when it lies past the first hundred files the pull request changes
    "files": 2,
-   "overlapsThisPr": [
-     "packages/pylos/src/sands.ts",
-   ],
+   "overlapsThisPr": [],
(fail) an overlap list read from fewer files than the pull request changes says that it is incomplete
-   "overlapIncomplete": [
-     "read 3000 of the 3001 files this pull request changes",
-   ],
(fail) an overlap list read from a comparison at GitHub's 300-file limit says that it is incomplete
-   "overlapIncomplete": [
-     "the base gained 300 files or more, and GitHub's comparison lists only the first 300",
-   ],

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:

Mutation Named case Verdict
drop --paginate from the file-list call overlap past the first hundred files killed
if (mine.length < pr.changedFiles) → if (false) fewer files than the pull request changes killed
gained.length >= COMPARE_FILE_LIMIT → > comparison at the 300-file limit killed
drop ?per_page=100 overlap past the first hundred files survived, as it should: with --paginate the page size changes the number of requests, not the list

The 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 baseGained object with toEqual for a two-file pull request: no new key.

Live, read-only. bun scripts/pr-status.ts 3979 --expect-base <its recorded base>: the script on main reported 100 overlapping files and nothing else; this head reports 109 and overlapIncomplete: ["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

  • Focused local preflight/behavioral receipts and complete selected hosted proof passed; actual head/base/job checkout evidence is in Proof. (Local receipts are above; hosted proof is requested at ready confirmation, which the orchestrator runs.)
  • Acceptance criteria from the issue are all met, or the gap is named below.
  • A PR touching packages/ui-react/, packages/ui-kit/, packages/ui-server/ or packages/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.)
  • The PR and completed/advanced issues have verified release milestones under docs/process/github.md.
  • A changeset is included, or this changes nothing a consumer can see. (Repository tooling only.)
  • No personal data anywhere in the diff — the leakage gate covers the whole tree.
  • The integration contract index or relevant component is updated in this same commit, or nothing in the machine surface moved. (Nothing moved.)
  • Docs under docs/ reflect the change, or nothing documented moved. (The one description of baseGained, in the work-issue skill's CI reference, is updated.)
  • A fail-closed guard added or changed answers the proportionate-containment checklist in this body, or no guard changed. (No guard changed: pr-status only reads and reports.)
  • Provider history stays append-only (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.files still counts at most 300 when the comparison is cut short. The issue puts every other field out of scope; overlapIncomplete says when that count is a floor.
  • A file the pull request renames is listed under its new path only, as it was before this change, so a base that changed the old path is not named as an overlap. That is a separate behaviour change for small pull requests too: ci: pr-status misses a moved base's change to a file the pull request renames #4152.

🤖 Generated with Claude Code

…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>
@schlessera schlessera added this to the 0.45.0 milestone Nov 17, 2026
@schlessera schlessera added type: fix Something is broken and must behave the way it is documented. area: ci CI workflows, the gates they run, release scripts, packaging. labels Nov 17, 2026
This was referenced Nov 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, the gates they run, release scripts, packaging. type: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: pr-status reads at most 100 changed files, so a moved base's overlap with a large PR can be missed

1 participant