Skip to content

ci: generalize code growth guardrails#4318

Merged
cv merged 4 commits into
NVIDIA:mainfrom
jyaunches:ci/code-growth-budget-rules
May 27, 2026
Merged

ci: generalize code growth guardrails#4318
cv merged 4 commits into
NVIDIA:mainfrom
jyaunches:ci/code-growth-budget-rules

Conversation

@jyaunches

@jyaunches jyaunches commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Rename the onboard entrypoint budget workflow to a generic codebase growth guardrails workflow
  • Rename the job to match the broader scope
  • Add a guardrail that blocks added lines under the legacy test/e2e/ suite and points new E2E coverage to tests/e2e-scenario/

Validation

  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/codebase-growth-guardrails.yaml"); puts "yaml ok"'
  • git diff --check

Summary by CodeRabbit

  • Chores
    • CI workflow added a job that enforces size constraints on a specific onboarding source file (must be net‑neutral or smaller).
    • CI now enforces net‑neutral or smaller changes for Python files.
    • CI blocks added lines within the legacy end-to-end test suite, guiding new scenarios to the updated e2e scenario tests.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0edb63a8-65b3-43d9-b59e-63b1b4b8bba1

📥 Commits

Reviewing files that changed from the base of the PR and between 7f92a9f and d72154f.

📒 Files selected for processing (1)
  • .github/workflows/codebase-growth-guardrails.yaml

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow job that queries PR file diffs and enforces three guard rules: net-neutral changes for src/lib/onboard.ts, net-neutral changes for any *.py files, and a hard block on added lines under legacy test/e2e/.

Changes

Codebase Growth Guardrails

Layer / File(s) Summary
Workflow metadata and job
.github/workflows/codebase-growth-guardrails.yaml
Configures pull_request_target trigger, read-only PR permissions, job id codebase-growth-guardrails, and timeout/display name for the guardrails workflow.
Onboard file growth guard
.github/workflows/codebase-growth-guardrails.yaml
Adds a step that filters PR files for src/lib/onboard.ts (including previous_filename), sums additions vs deletions, and fails when net growth is positive.
Python files net-neutral guard
.github/workflows/codebase-growth-guardrails.yaml
Adds a step that filters changed files for *.py (including previous_filename), sums additions vs deletions across Python files, and fails if additions exceed deletions.
Legacy E2E additions block
.github/workflows/codebase-growth-guardrails.yaml
Adds a step that inspects test/e2e/ diffs, allows deletions/moves, and fails the PR if any added lines appear under that legacy directory; failure message directs new tests to tests/e2e-scenario/.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

v0.0.50

Poem

🐰 I hopped through CI to keep changes slight,
Guarding onboard, Python, and old e2e plight.
If lines grow where they shouldn't be,
The workflow will halt — then fix, hop, and flee!
🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: generalize code growth guardrails' directly reflects the main objective of the pull request, which is to rename and broaden the workflow from a specific onboard entrypoint budget check to a generic codebase growth guardrails system with multiple guardrails.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

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

@jyaunches

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/codebase-growth-guardrails.yaml:
- Around line 85-87: The current gh api jq filter that builds rows uses
select(.filename | startswith("test/e2e/")) and thus blocks all changes under
test/e2e/; update that filter (and the related guard logic handling rows later
around the block at lines 106-119) to only select the E2E coverage paths you
intend to guard (for example paths under test/e2e/.../coverage or a specific
coverage directory pattern) rather than every file under test/e2e/, and ensure
the later checks that reject PR additions apply to those narrowed coverage paths
only (leave runtime/metadata paths like test/e2e/runtime/* excluded).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ecb27f17-0dae-4634-8d4d-dfa87536f8a0

📥 Commits

Reviewing files that changed from the base of the PR and between d312144 and 7f92a9f.

📒 Files selected for processing (1)
  • .github/workflows/codebase-growth-guardrails.yaml

Comment thread .github/workflows/codebase-growth-guardrails.yaml
@cv cv marked this pull request as draft May 27, 2026 17:15
@copy-pr-bot

copy-pr-bot Bot commented May 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cv cv marked this pull request as ready for review May 27, 2026 17:41
@cv cv added v0.0.55 v0.0.54 Release target and removed v0.0.55 labels May 27, 2026
@cv cv merged commit c4e3f0d into NVIDIA:main May 27, 2026
27 checks passed
nvshaxie added a commit that referenced this pull request May 28, 2026
…dget

Compact the discord plugins.entries enablement added in this PR into a
single inline statement so net Python additions are ≤0 under the
generalized code growth guardrails (#4318). Behavior is unchanged; the
existing test/generate-openclaw-config.test.ts coverage still asserts
the discord plugin entry is registered when channels.discord is set.

Signed-off-by: Shawn Xie <shaxie@nvidia.com>
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions bug-fix PR fixes a bug or regression chore Build, CI, dependency, or tooling maintenance and removed CI/CD bug-fix PR fixes a bug or regression labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance v0.0.54 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants