Skip to content

fix(ci): exclude test files from PR size classification - #2387

Merged
serrrfirat merged 2 commits into
stagingfrom
fix/pr-size-exclude-tests
Apr 14, 2026
Merged

serrrfirat merged 2 commits into
stagingfrom
fix/pr-size-exclude-tests

Conversation

@serrrfirat

Copy link
Copy Markdown
Collaborator

Summary

  • PR size labels now only count production code changes, excluding test files
  • Previously a 1-line production fix with 500 lines of tests would be classified as XL
  • Excluded patterns: tests/, *_test.rs, *_tests.rs, *.test.{js,ts,jsx,tsx}, *.spec.{js,ts,jsx,tsx}

Test plan

  • Open a PR with mostly test changes and verify the size label reflects only non-test lines

🤖 Generated with Claude Code

Test code shouldn't inflate PR size labels — a 1-line fix with 500
lines of tests was getting classified as XL instead of XS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added scope: ci CI/CD workflows size: XS < 10 changed lines (excluding docs) risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels Apr 13, 2026
@serrrfirat serrrfirat added the skip-regression-check Bypass regression test CI gate (tests exist but not in tests/ dir) label Apr 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates the .github/scripts/pr-labeler.sh script to exclude test files from the pull request size classification logic. A review comment suggests a more robust regex for identifying test files to ensure that directories like __tests__ and standalone test files are correctly captured and excluded.

[.[] | select(.filename | test("\\.(md|txt|rst|adoc)$") | not) | .changes]
[.[]
| select(.filename | test("\\.(md|txt|rst|adoc)$") | not)
| select(.filename | test("^tests/|_test\\.rs$|_tests\\.rs$|/tests/|\\.test\\.[jt]sx?$|\\.spec\\.[jt]sx?$") | not)

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.

medium

The regex for identifying test files can be simplified and made more robust. The current implementation misses __tests__ directories and standalone test.rs or tests.rs files. Please ensure this updated pattern is applied consistently across all scripts and CI configurations that identify test files to prevent logic divergence, as per the repository's consistency guidelines.

Suggested change
| select(.filename | test("^tests/|_test\\.rs$|_tests\\.rs$|/tests/|\\.test\\.[jt]sx?$|\\.spec\\.[jt]sx?$") | not)
| select(.filename | test("(^|/)(__)?tests?(__)?/|(^|[/_])tests?\\.rs$|\\.(test|spec)\\.[jt]sx?$") | not)
References
  1. When applying a best practice or logic change in shell scripts, it should be applied consistently across the codebase to avoid partial fixes and maintain synchronization between different scripts or CI/CD pipelines.

@henrypark133 henrypark133 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review: Exclude test files from PR size classification (Risk: Low)

Clean fix. Adds a jq filter to exclude test files from the PR size calculation:

  • ^tests/ directory
  • _test.rs / _tests.rs suffixes
  • /tests/ subdirectories
  • .test.[jt]sx? / .spec.[jt]sx? patterns

Test-heavy PRs will now be classified by their production code size. Sensible change.

LGTM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@serrrfirat
serrrfirat merged commit 28c6a15 into staging Apr 14, 2026
15 checks passed
@serrrfirat
serrrfirat deleted the fix/pr-size-exclude-tests branch April 14, 2026 20:15
This was referenced Apr 14, 2026
This was referenced Apr 17, 2026
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
* fix(ci): exclude test files from PR size classification

Test code shouldn't inflate PR size labels — a 1-line fix with 500
lines of tests was getting classified as XL instead of XS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: retrigger with skip-regression-check label

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Zaki <zaki@iqlusion.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules scope: ci CI/CD workflows size: XS < 10 changed lines (excluding docs) skip-regression-check Bypass regression test CI gate (tests exist but not in tests/ dir)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants