ci: guard oversized test files#4905
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR introduces an end-to-end test file size budget enforcement system. It includes a TypeScript CLI script that scans, counts lines in test files, and validates them against a JSON budget with default and per-file legacy limits. The system integrates into pre-commit hooks, npm scripts, and GitHub Actions workflows with comprehensive validation of budget monotonicity. ChangesTest File Size Budget System
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-pr-4905.docs.buildwithfern.com/nemoclaw |
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
E2E Scenario Advisor RecommendationRequired scenario E2E: None Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
PR Review AdvisorFindings: 0 needs attention, 2 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
This is an automated advisory review. A human maintainer must make the final merge decision. |
Summary
Adds a test-file size budget so new or touched test files cannot keep growing into oversized catch-all suites. This is a trimmed replacement for #4899 with a clean branch from current
main, reducing the review diff from ~1k lines to about 520 added lines.Related Issue
Related to #4892. Replaces #4899.
Changes
scripts/check-test-file-size-budget.tsandci/test-file-size-budget.jsonto enforce a 1,500-line default budget with legacy ratchets for existing oversized tests.npm run test-size:checkinto pre-commit and PR static checks.pull_request_targetguard for changed test files and budget-policy tampering without using PR-controlled code orraw_urltoken fetches.Type of Change
Verification
Focused local checks passed:
npx prek run --files ... --skip test-cli --skip test-plugin,npx vitest run --project cli test/pr-workflow-contract.test.ts test/test-file-size-budget.test.ts,npm run test-size:check,npm run build:cli,npm run typecheck:cli,npm run source-shape:check, andgit diff --check. Full local commit hooks were attempted in the temporary clean worktree but the CLI coverage hook hit/stuck on local coverage-process instability, so the full matrix is left to CI.npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit