You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(guardrails): consolidate growth checks in Vitest (NVIDIA#9354)
<!-- markdownlint-disable MD041 -->
## Summary
Run the codebase growth policies as ordinary Vitest tests instead of
separate scanners, evaluators, wrappers, and npm targets. The same tests
now serve local changes and the trusted pull request workflow, reducing
the implementation by 2,532 lines while preserving the five existing
policies.
## Changes
- Add one Vitest suite for new JavaScript files, `src/lib/onboard.ts`
growth, test size budgets, test conditionals, and test loops.
- Use one shared diff reader for local Git changes and pull request
blobs.
- Replace the seven-step growth workflow and the standalone pre-commit
entry point with the same focused Vitest command.
- Delete the superseded scanners, evaluators, wrapper tests, and two
obsolete npm targets. Keep one bridge target for the base-trusted static
action that executes against this PR, while the updated action uses the
consolidated hook directly after merge.
- Make the TypeScript requirement for new test files explicit in the
contributor guide.
## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Quality Gates
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:
## Verification
- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run --project integration
test/growth-guardrails.test.ts
test/growth-guardrails-workflow-boundary.test.ts
test/growth-guardrails-pr-blob-client.test.ts` (33 passed)
- [ ] Applicable broad gate passed — `npm run check` completed with
29,085 passing tests and 40 unrelated host-sensitive failures caused by
a foreign user systemd service, local platform facts, and a
group-writable parent directory; the codebase growth hook and plugin
coverage passed
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Consolidated code-growth checks into a unified validation suite.
* Simplified validation for changed files and pull requests.
* Updated pre-commit and changed-test workflows to use unified checks.
* Removed redundant standalone scans and budget checks.
* **Documentation**
* Updated contribution guidance to require TypeScript for new test
files.
* **Tests**
* Added coverage for growth limits, syntax patterns, renamed files, and
pull-request changes.
* Added direct validation of workflow configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -490,7 +490,7 @@ The repository is organized as follows.
490
490
491
491
All new source files must be TypeScript. Do not add new `.js` files to the project. When modifying an existing JavaScript file, prefer migrating it to TypeScript in the same PR.
492
492
493
-
Only a small CommonJS launcher/compatibility layer remains in `bin/`, while the main CLI implementation now lives in `src/lib/` and compiles to `dist/`. Tests in `test/` may remain ESM JavaScript for now but new test files should use TypeScript where practical.
493
+
Only a small CommonJS launcher/compatibility layer remains in `bin/`, while the main CLI implementation now lives in `src/lib/` and compiles to `dist/`. Existing tests in `test/` may remain ESM JavaScript, but new test files must use TypeScript.
494
494
495
495
Shell scripts (`scripts/*.sh`) must pass ShellCheck and use `shfmt` formatting.
0 commit comments