Skip to content

Count only added lines toward the PR size budget in AGENTS.md - #2616

Merged
cjluo-nv merged 2 commits into
mainfrom
chenjiel/pr-size-added-lines
Oct 1, 2026
Merged

cjluo-nv merged 2 commits into
mainfrom
chenjiel/pr-size-added-lines

Conversation

@cjluo-nv

@cjluo-nv cjluo-nv commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: documentation

Changes the PR sizing rule in AGENTS.md to count only added source lines toward the ~500-line budget, instead of total changed lines. Deletions are cheap to review, so a PR that mostly removes code shouldn't be pushed into a split. Tests and docs are excluded too, since every sub-PR has to carry its own tests. The check uses the insertions count from git diff --shortstat with a pathspec that excludes tests/ and docs/.

Usage

git diff --shortstat origin/main...HEAD -- . ':!tests' ':!docs'
# N files changed, X insertions(+), Y deletions(-)  -> compare X against ~500

Testing

Before your PR is "Ready for review"

  • Is this change backward compatible?: N/A
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: N/A
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: N/A

Additional Information

Follow-up to #2494, which introduced the sizing guidance.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated review guidance to measure pull request size by added source lines, excluding deletions, tests, and documentation. The guidance retains the recommendation to check the size before opening a review.

Deletions are cheap to review, so a PR that removes a lot of code
should not be pushed into a split. Measure the ~500-line budget by
insertions from `git diff --shortstat` instead of total changed lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
@cjluo-nv
cjluo-nv requested a review from a team as a code owner October 1, 2026 06:43
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a2f3b055-ac1a-4703-a0ff-50ba3f49a038

📥 Commits

Reviewing files that changed from the base of the PR and between aa89722 and 8b65cf2.

📒 Files selected for processing (1)
  • AGENTS.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The PR updates the documented sizing guidance to count about 500 added source lines. It excludes deletions, tests, and documentation from the budget, and changes the measurement command to git diff --shortstat.

Changes

PR size guidance

Layer / File(s) Summary
Update the PR size limit
AGENTS.md
The guidance limits each review PR to about 500 added source lines, excludes deletions, tests, and documentation, and specifies git diff --shortstat with tests and docs excluded.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: kevalmorabia97

Merge Risk: ⚪ Minimal · up to 8b65c

This update narrows the size count by excluding tests and docs and introduces no material merge risk.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed PASS. The authoritative PR diff changes only AGENTS.md (3 insertions, 2 deletions). It adds no modelopt or examples Python code, security-sensitive calls, # nosec comments, or dependency decla…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: counting only added lines toward the PR size budget in AGENTS.md.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@meenchen meenchen 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.

Bot review (claude-opus-5-5) — DM the bot to share feedback.

Nudge: counting only added lines is the right rule, but git diff --shortstat counts every added line, including tests, config and docs. The budget is meant to cover source only, so the command overcounts.

Needs action:

  • Scope the size check in AGENTS.md (L55–56) to source files. Either add pathspec exclusions, e.g. git diff --shortstat <base>...HEAD -- . ':!tests' ':!docs' ':!*.md' ':!*.rst' ':!*.yaml' ':!*.yml' ':!*.json' ':!*.toml', or add one sentence saying tests, config and docs don't count. Otherwise agents will propose splits for PRs that are mostly tests.

No action needed:

  • The doc change is limited to the sizing bullet. The exceptions list and split guidance are unchanged. It has no licensing impact and needs no tests.

Comment thread AGENTS.md Outdated
intermediate state. Check the size with `git diff --stat <base>...HEAD`
before opening.
intermediate state. Deletions don't count; check the insertions from
`git diff --shortstat <base>...HEAD` before opening.

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.

Bot comment.

--shortstat insertions cover every file, including tests/, YAML/JSON config and .md/.rst docs. The rule above says "lines of source", so this check counts against the budget the test code that every sub-PR is required to carry. Consider either git diff --shortstat <base>...HEAD -- . ':!tests' ':!docs' ':!*.md' ':!*.rst' ':!*.yaml' ':!*.yml' ':!*.json' ':!*.toml' or adding "tests, config, and docs don't count either" to the sentence.

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.

Fixed in 8b65cf2: AGENTS.md:55-57 now says deletions, tests, and docs don't count, and the check is git diff --shortstat <base>...HEAD -- . ':!tests' ':!docs'. I left out the *.md/*.yaml/*.json/*.toml exclusions: skill changes are mostly .md, so they'd always count as zero, and YAML recipes and launcher configs are reviewed like source.

The budget covers source lines, but `git diff --shortstat` also counted
the tests every sub-PR must carry. Exclude tests/ and docs/ via pathspec.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>

@meenchen meenchen 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.

Bot review (claude-opus-5-5) — DM the bot to share feedback.

Approve: the overcounting concern is fixed. The size check now leaves out deletions, tests/ and docs/, and the author gave sound reasons for keeping the other file types in the count.

No action needed.

  • ✔️ Resolved since the last review: in commit 8b65cf2, the --shortstat check in AGENTS.md excludes tests/ and docs/, and the text now says deletions, tests and docs don't count.
  • Leaving *.md, *.yaml, *.json and *.toml out of the exclusions is a reasonable choice. Skill edits are mostly .md, and YAML recipes and launcher configs are reviewed like source code. One side effect: README.md files outside docs/ (for example under examples/) still count toward the budget. That's a small mismatch with "docs don't count", but not worth blocking on.
  • This is a doc-only change with no licensing impact, and it doesn't need tests.

@cjluo-nv
cjluo-nv enabled auto-merge (squash) October 1, 2026 06:52
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.45%. Comparing base (aa89722) to head (8b65cf2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2616   +/-   ##
=======================================
  Coverage   69.45%   69.45%           
=======================================
  Files         611      611           
  Lines       68219    68219           
=======================================
  Hits        47383    47383           
  Misses      20836    20836           
Flag Coverage Δ
unit 59.15% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cjluo-nv
cjluo-nv merged commit 7d9e07d into main Oct 1, 2026
35 checks passed
@cjluo-nv
cjluo-nv deleted the chenjiel/pr-size-added-lines branch October 1, 2026 07:03
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-01 07:04 UTC

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants