test(policy): move confirmation coverage to action tests#4920
Conversation
|
Warning Review limit reached
More reviews will be available in 48 minutes and 5 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review AdvisorFindings: 0 needs attention, 1 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
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
|
## Summary This PR adds focused public CLI smokes for the sandbox-first built-in policy mutation routes after #4920 moved most confirmation coverage into same-process action tests. The tests keep coverage for dispatching `policy-add` / `policy-remove` through the user-facing route without restoring the old subprocess-heavy matrix. ## Related Issue Part of #4892 ## Changes - Add a hermetic fake OpenShell policy helper for `test/cli/sandbox-mutations.test.ts`. - Verify `nemoclaw <sandbox> policy-add github --yes` and `nemoclaw <sandbox> policy-remove github -y` mutate the temp registry through the public sandbox-first route. - Verify `NEMOCLAW_NON_INTERACTIVE=1 nemoclaw <sandbox> policy-add` fails before selecting or applying a preset. ## 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 - [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 - [ ] `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> Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
This PR targets the next slow policy runtime bucket identified after #4919 by moving built-in
policy-add/policy-removeconfirmation coverage out of subprocess-heavy CLI harnesses and into same-process action tests. Custom preset--from-file/--from-dirsubprocess coverage stays intest/policies.test.tsfor a smaller, mechanical first step.Related Issue
Part of #4892
Changes
src/lib/actions/sandbox/policy-channel-policy.test.tswith mocked same-process coverage foraddSandboxPolicyandremoveSandboxPolicyprompts, declined confirmation, dry-run, non-interactive mode, agent-specific preset filtering, and messaging validation guidance.test/policies.test.ts, reducing the policy suite from 166 tests in the test(cli): trim logs subprocess coverage #4919 artifact to 144 tests in this full local run.test/policies.test.tsinci/test-file-size-budget.jsonfrom 3143 lines to 2763 lines so it cannot silently grow back.--from-file/--from-dirsubprocess coverage intact for a follow-up target.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com