Skip to content

test(cli): restore source-shape guard#3636

Merged
cjagwani merged 3 commits into
refactor/delete-unused-codefrom
test/source-shape-real-detector
May 16, 2026
Merged

test(cli): restore source-shape guard#3636
cjagwani merged 3 commits into
refactor/delete-unused-codefrom
test/source-shape-real-detector

Conversation

@cv

@cv cv commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reintroduces the source-shape guard as a stacked follow-up to #3632, but fixes the detector so it catches Node assert.* source-text assertions instead of reporting a false zero. It then completes the source-shape purge by removing the detected source-text assertions from test/onboard.test.ts and ratcheting the budget back to zero.

Related Issue

Stacked on #3632.

Changes

  • Restored scripts/find-source-shape-tests.ts, source-shape:* npm scripts, and the prek source-shape budget hook.
  • Added detection for assert.match, assert.doesNotMatch, assert.ok, and related Node assert-style source-text assertions.
  • Avoided counting temp Dockerfile fixture behavior tests as source-shape offenders.
  • Removed all detected source-shape tests from test/onboard.test.ts where behavior is covered by existing helper/integration tests.
  • Ratcheted the source-shape budget back to zero.

Type of Change

  • 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)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Tests

    • Enhanced test validation infrastructure to track and enforce limits on source-shape test cases across the codebase.
    • Updated test coverage with new behavioral assertions and removed outdated static-source regression checks.
  • Chores

    • Added development tools and CI configuration to support automated source-shape test monitoring and budgeting.

Review Change Stack

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this May 16, 2026
@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3e88b741-8c06-4e6f-b77c-94498eb31bfa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/source-shape-real-detector

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

@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/refactor/delete-unused-code
Head: HEAD
Confidence: high

Required E2E

  • None. No E2E is recommended. The PR is limited to CI/test-quality tooling, package.json development scripts, a CI budget file, and unit-test maintenance. It does not change runtime/user-flow code for installer/onboarding, sandbox lifecycle, credentials, security boundaries, network policy, inference routing, deployment, or real assistant behavior.

Optional E2E

  • None.

New E2E recommendations

  • None.

cv added 2 commits May 15, 2026 17:32
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv requested a review from cjagwani May 16, 2026 01:41

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

approved

@cjagwani cjagwani merged commit ba50754 into refactor/delete-unused-code May 16, 2026
28 of 29 checks passed
@cv cv mentioned this pull request May 16, 2026
15 tasks
cv added a commit that referenced this pull request May 16, 2026
## Summary
Splits helper-oriented coverage out of the oversized
`test/onboard.test.ts` file into focused unit test files. The PR keeps
source-shape coverage at zero, preserves equivalent behavior coverage,
and makes the remaining onboard orchestration tests easier to navigate.

## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
Stacked on #3632 / #3636.

## Changes
<!-- Bullet list of key changes. -->
- Moved GPU helper coverage into focused module tests:
  - `src/lib/onboard/gateway-gpu-passthrough.test.ts`
  - `src/lib/onboard/sandbox-gpu-create.test.ts`
  - `src/lib/onboard/sandbox-gpu-mode.test.ts`
  - `src/lib/onboard/initial-policy.test.ts`
- Moved policy suggestion helper coverage into
`test/onboard-policy-suggestions.test.ts`.
- Moved dashboard helper coverage into `test/onboard-dashboard.test.ts`
and dashboard port helper coverage into
`src/lib/onboard/dashboard-port.test.ts`.
- Moved sandbox naming helper coverage into
`test/onboard-sandbox-name.test.ts`.
- Moved OpenShell version/pinning helper coverage into
`test/onboard-openshell-version.test.ts`.
- Moved Dockerfile patch helper coverage into
`src/lib/onboard/dockerfile-patch.test.ts`.
- Moved gateway runtime / Docker-driver / CDI helper coverage into
`test/onboard-gateway-runtime.test.ts`.
- Moved Model Router orchestration coverage into
`test/onboard-model-router.test.ts`.
- Moved messaging setup/provider coverage into
`test/onboard-messaging.test.ts`.
- Moved custom Dockerfile orchestration coverage into
`test/onboard-custom-dockerfile.test.ts`.
- Moved provider routing/probe/provider-CRUD helper coverage into owning
module tests:
  - `src/lib/inference/config.test.ts`
  - `src/lib/inference/onboard-probes.test.ts`
  - `src/lib/onboard/providers.test.ts`
  - `src/lib/validation.test.ts`
  - `src/lib/core/url-utils.test.ts`
  - `src/lib/adapters/http/probe.test.ts`
- Moved web-search support coverage into
`src/lib/onboard/web-search-support.test.ts` /
`test/onboard-brave-validation.test.ts`.
- Moved build-context and sandbox-create recovery hint coverage into
`src/lib/build-context.test.ts`.
- Extracted focused production helpers with direct module coverage:
  - `src/lib/onboard/credential-env.ts`
  - `src/lib/onboard/summary.ts`
- additional exports in `src/lib/onboard/sandbox-gpu-mode.ts` and
`src/lib/onboard/dashboard-port.ts`
- Removed the corresponding helper-only cases from
`test/onboard.test.ts`; it is now much smaller while keeping the
remaining orchestration/integration-style coverage.

## 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)

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] `npm run source-shape:check` passes
- [x] `npm run build:cli` passes
- [x] `npx tsc -p tsconfig.cli.json --noUnusedLocals
--noUnusedParameters --pretty false` passes
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make 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)

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Tests**
* Added comprehensive test coverage for GPU configuration, sandbox
naming, credential management, dashboard port handling, custom
Dockerfile support, messaging channels, Model Router setup, and
OpenShell version management.
* Added tests for probe error handling, policy validation, and sandbox
state detection.

* **Refactor**
* Reorganized onboarding helpers into dedicated modules for improved
maintainability.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3640?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv deleted the test/source-shape-real-detector branch May 27, 2026 21:19
@wscurran wscurran added the chore Build, CI, dependency, or tooling maintenance label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI, dependency, or tooling maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants