Skip to content

Add PR Size Checker That Warns on Large Diffs and Fails on Very Large Diffs #282

Description

@vjuliaife

Description:
Large pull requests are harder to review thoroughly and more likely to introduce undetected bugs, yet TariffShield has no guardrail to discourage oversized changes. A PR size checker that warns when a diff exceeds 400 lines and fails CI when it exceeds 1000 lines nudges contributors to split work into reviewable chunks, improving review quality and reducing merge risk.

Acceptance Criteria:

  • Create .github/workflows/pr-size.yml that triggers on pull_request (types: opened, synchronize, reopened) and counts the total lines added plus removed using git diff --stat against the PR base SHA
  • If the diff is between 400 and 999 lines, post a PR comment via actions/github-script warning "This PR is large (N lines). Consider splitting it into smaller PRs for easier review." and set the step outcome to neutral (do not fail)
  • If the diff is 1000 lines or more, post a PR comment explaining the hard limit and fail the workflow step so the size check becomes a blocking status check
  • Exclude auto-generated files from the line count: package-lock.json, Cargo.lock, *.snap test snapshots, and any file under dist/ or target/ are excluded via a .prsize-ignore file at the repo root using the same glob format as .gitignore
  • The size thresholds (400 warn, 1000 fail) are configurable via workflow env variables PR_SIZE_WARN and PR_SIZE_FAIL so they can be adjusted without editing workflow logic
  • If an oversized PR has a large-pr-approved label applied by a maintainer, the size check is bypassed — allowing emergency large changes with explicit sign-off
  • Document the PR size policy in CONTRIBUTING.md under "Pull Request Guidelines" with guidance on how to split a large feature into smaller PRs

Relevant Files:

  • .github/workflows/pr-size.yml — new PR size check workflow
  • .prsize-ignore — glob patterns for files excluded from line count
  • CONTRIBUTING.md — contributor guide (add PR size policy section)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programciAuto-created by repotool publish-folderdxDeveloper experience / docs / naming

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions