Skip to content

fix(ci): use whitespace-insensitive PR size diff#1500

Merged
juliusmarminge merged 3 commits intopingdotgg:mainfrom
maria-rcks:fix/pr-size-whitespace-diff
Mar 28, 2026
Merged

fix(ci): use whitespace-insensitive PR size diff#1500
juliusmarminge merged 3 commits intopingdotgg:mainfrom
maria-rcks:fix/pr-size-whitespace-diff

Conversation

@maria-rcks
Copy link
Copy Markdown
Collaborator

@maria-rcks maria-rcks commented Mar 28, 2026

What Changed

Use a whitespace-insensitive diff for PR size labels.

Why

GitHub's raw diff counts can overcount whitespace-only changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Warning

this might be a hallucination from codex


Note

Medium Risk
Changes PR size labeling logic in CI to compute diff stats locally with git diff, which could shift size labels and depends on correct ref fetching in pull_request_target runs.

Overview
Updates the PR Size GitHub Action to compute effective changed lines using a local git diff --numstat that ignores whitespace and blank-line-only changes, instead of relying on the GitHub pulls.listFiles API.

The workflow now checks out and fetches base/head refs for the PR (avoiding the 3,000-file API truncation risk), excludes test files via git pathspec excludes, and logs a warning if the fetched head SHA differs from the PR’s reported head SHA.

Written by Cursor Bugbot for commit 0dbdc0e. This will update automatically on new commits. Configure here.

Note

Fix PR size labeling to use whitespace-insensitive git diff --numstat

  • Replaces the GitHub Pulls REST API file listing with local git diff --numstat --ignore-all-space --ignore-blank-lines to compute line change counts in pr-size.yml.
  • Adds a repo checkout step and fetches both the base SHA and PR head ref (refs/pull/<number>/head) so the diff runs locally.
  • Switches test file exclusion from regex matching to git pathspec :(glob,exclude) patterns passed directly to the diff command.
  • Removes the prior 3000-file truncation warning that came with the paginated API approach.
  • Behavioral Change: whitespace-only and blank-line changes no longer contribute to PR size counts.

Macroscope summarized 0dbdc0e.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 42d2f741-d412-40ae-92fc-3df6077f0488

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 28, 2026
"--numstat",
"--ignore-all-space",
"--ignore-blank-lines",
"--no-renames",
Copy link
Copy Markdown
Contributor

@nmggithub nmggithub Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break any PR's that explicitly rename a file. We'll get an overcalculated number of additions/deletions (counting each and every line of the renamed file). However, I believe Codex added this to make parsing the numstat easier. If desired, we can remove this flag and add additional parsing for renames. Or just leave this as is and keep rename calculations being off as an acceptable risk.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that certainly is one way to do it. Now we're not parsing the filename from numstat at all. I think that should be good, yeah.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Mar 28, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Mar 28, 2026
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yolo

@juliusmarminge juliusmarminge merged commit 5b1d5c1 into pingdotgg:main Mar 28, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants