fix(brev): reject invalid sandbox names before deploy - #2948
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 (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughA new centralized name-validation module ( ChangesCentralized Name Validation Guidance
Sequence DiagramsequenceDiagram
actor User
participant Onboard as onboard()
participant Deploy as deploy.ts
participant Validate as validateName()
participant Guidance as getNameValidationGuidance()
User->>Onboard: Enter sandbox name
Onboard->>Validate: validateName(input, "sandbox name")
alt Invalid Name
Validate-->>Onboard: Throw ValidationError
Onboard->>Guidance: getNameValidationGuidance("sandbox name", input, includeAllowedFormat: false)
Guidance-->>Onboard: Return guidance lines
Onboard-->>User: Show guidance & retry or abort
else Valid Name
Validate-->>Onboard: ✓
Onboard->>User: Proceed
end
User->>Deploy: Run deploy with NEMOCLAW_SANDBOX_NAME
Deploy->>Validate: validateDeploySandboxName(envValue)
alt Invalid Name
Validate-->>Deploy: Throw ValidationError
Deploy->>Guidance: getNameValidationGuidance("sandbox name", envValue, includeAllowedFormat: false)
Guidance-->>Deploy: Return guidance lines
Deploy-->>User: Print error & exit(1)
else Valid Name
Validate-->>Deploy: ✓
Deploy->>User: Proceed with provisioning
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 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)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/deploy.test.ts (1)
240-248: ⚡ Quick winAssert the env-var remediation hint explicitly.
This test validates format guidance well, but it does not lock the promised “set a valid
NEMOCLAW_SANDBOX_NAME” remediation text. Adding one assertion will catch regressions in the user-facing guidance path.Proposed assertion addition
expect(errorText).toContain( "Brev deploy is non-interactive and cannot prompt for a corrected sandbox name.", ); + expect(errorText).toMatch(/set\s+.*NEMOCLAW_SANDBOX_NAME/i); expect(fixture.calls).toEqual([]); expect(fixture.interactive).toEqual([]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/deploy.test.ts` around lines 240 - 248, Add an assertion to the test that verifies the remediation hint about setting the NEMOCLAW_SANDBOX_NAME env var is present in the aggregated error text: locate the test that builds errorText from fixture.errors (variable errorText) in deploy.test.ts and add an expect(errorText).toContain(...) checking for the exact remediation message that tells users to set a valid NEMOCLAW_SANDBOX_NAME.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/lib/deploy.test.ts`:
- Around line 240-248: Add an assertion to the test that verifies the
remediation hint about setting the NEMOCLAW_SANDBOX_NAME env var is present in
the aggregated error text: locate the test that builds errorText from
fixture.errors (variable errorText) in deploy.test.ts and add an
expect(errorText).toContain(...) checking for the exact remediation message that
tells users to set a valid NEMOCLAW_SANDBOX_NAME.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: fb092237-52a4-425d-8e02-99f18ef0bd82
📒 Files selected for processing (7)
src/lib/deploy.test.tssrc/lib/deploy.tssrc/lib/name-validation.tssrc/lib/onboard.tssrc/lib/runner.tstest/e2e/brev-e2e.test.tstest/onboard.test.ts
|
❌ Brev E2E (full): FAILED on branch |
## Summary Catch up the docs for user-facing changes that landed over the weekend and today, so the published guidance matches current installer, onboarding, status, logs, local inference, rebuild backup behavior, the next docs version selector, and refreshed generated user skills. ## Related Issue None. ## Changes - Document WSL Windows-host Ollama onboarding actions, including use, start, restart, install, and `host.docker.internal` model pulls from #2800; clarify that onboard owns Ollama install and model pulls from #2952. - Document installer fail-fast behavior for non-TTY third-party software acceptance from #2706. - Update sandbox-name guidance and Brev deploy validation behavior from #2948. - Add `nemoclaw <name> logs --tail/--since` coverage from #2825. - Add global `nemoclaw status --json` coverage from #2822. - Document verified-gateway status behavior and non-zero degraded exits from #2884. - Clarify that rebuild stops before deleting the original sandbox when backup fails, including unreadable or root-owned state paths. - Bump docs switcher metadata from 0.0.33 to 0.0.34 without changing package versions or creating release tags. - Regenerate `.agents/skills/nemoclaw-user-*` from docs, including the new `nemoclaw-user-manage-sandboxes` generated skill and removal of the stale `nemoclaw-user-workspace` output. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [x] 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 - [x] No secrets, API keys, or credentials committed - [x] Docs updated for user-facing behavior changes - [x] `make docs` builds without warnings (doc changes only) - [x] 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: Miyoung Choi <miyoungc@nvidia.com> Made with [Cursor](https://cursor.com) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Expanded Ollama/local inference guidance with detailed WSL and Windows-host workflows, proxy/token behavior, and onboarding options * Standardized sandbox name validation and updated troubleshooting, CLI, and deploy docs to surface the rules and validation timing * Added/rewrote Manage Sandboxes, policy management, backup/restore, messaging channels, workspace persistence, and CLI selection guides * Refreshed quickstart/Hermes guidance, skill mappings, and bumped docs version to 0.0.34 <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
fixes #2869
Summary
NEMOCLAW_SANDBOX_NAMEfails before Brev provisioning, SSH, or installer handoff.What was late/missing before
Brev deploy did call
validateName, but invalid env input surfaced as a raw validation failure without Brev-specific guidance or an explicit non-interactive correction path. The onboard prompt also used shorter wording that did not state the complete rule before entry.Where Brev now validates early
src/lib/deploy.tsvalidatesNEMOCLAW_SANDBOX_NAMEimmediately after resolving deploy flags and before credentials,brev, SSH, rsync, or installer work. Invalid names with spaces now print that spaces are not allowed and tell the user to set a validNEMOCLAW_SANDBOX_NAME.Tests run
npm run build:clinpx vitest run src/lib/deploy.test.tsnpx vitest run test/e2e/brev-e2e.test.tsnpx vitest run test/onboard.test.ts -t "sandbox name|invalid sandbox|re-prompts"npx vitest run test/smoke-macos-install.test.ts -t "invalid sandbox"git diff --checkSummary by CodeRabbit
New Features
Bug Fixes
Tests