Skip to content

test(connect): cover probe-only outcomes#5485

Merged
cv merged 1 commit into
mainfrom
test/connect-probe-flow-coverage
Jun 16, 2026
Merged

test(connect): cover probe-only outcomes#5485
cv merged 1 commit into
mainfrom
test/connect-probe-flow-coverage

Conversation

@cv

@cv cv commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extends connect flow coverage to the --probe-only recovery path. The tests cover recovered gateway reporting and fail-fast process-inspection failures without opening an interactive shell.

Changes

  • Extended src/lib/actions/sandbox/connect-flow.test.ts with configurable process-check outcomes.
  • Covered probe-only successful recovery output and auto-pair approval behavior.
  • Covered probe-only failure when the sandbox process inspection cannot run.

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

  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
    • npx vitest run src/lib/actions/sandbox/connect-flow.test.ts --project cli
    • npm run typecheck:cli
  • Full npm test passes (broad runtime changes only)
  • Tests added or updated for new or changed behavior
  • 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 (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Note: commit and push hooks were skipped for this test-only branch because the broad local hook suite has unrelated pre-existing CLI failures in this checkout; targeted tests and CLI typecheck passed.


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

Summary by CodeRabbit

  • Tests
    • Enhanced the sandbox connection test harness to support configurable process inspection outcomes for improved test flexibility.
    • Added comprehensive test coverage for probe-only mode including scenarios for successful process recovery verification and handling process inspection failures.
    • Improved test robustness with better simulation of various process states.

@cv cv self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The connectSandbox test harness gains an optional processCheck field in ConnectHarnessOptions, wiring it into the checkAndRecoverSandboxProcesses mock. Two new Vitest cases exercise probeOnly: true behavior: one for a recovered gateway (expects quiet mode, no shell spawn, and a "Probe complete" log), and one for an unchecked state (expects process.exit(1) and no shell or auto-pair invocation).

Changes

connectSandbox probe-only test coverage

Layer / File(s) Summary
Harness extension and probe-only test cases
src/lib/actions/sandbox/connect-flow.test.ts
ConnectHarnessOptions gains an optional processCheck block; the checkAndRecoverSandboxProcesses mock uses it with a fallback default; two new cases assert probe-only success (quiet mode, no OpenShell, "Probe complete" log) and probe-only failure (checked: false, exit code 1, no shell or auto-pair).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5478: Modifies the same connect-flow.test.ts harness and connectSandbox mock infrastructure that this PR extends with the processCheck option and probe-only cases.
  • NVIDIA/NemoClaw#5182: Introduces the quiet parameterization and recovery diagnostics in process-recovery.ts/connect.ts that the new probe-only tests directly exercise via { quiet: true } assertions.

Suggested labels

v0.0.66

🐇 A probe slips in, quiet as a hare,
It checks the gateway — recovered! — with care.
No shell shall open, no loud fanfare ring,
Just "Probe complete" on the log's whispering.
And if unchecked? Exit one sets the snare! 🚪

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(connect): cover probe-only outcomes' accurately and specifically describes the main change—adding test coverage for probe-only recovery scenarios in the connect flow.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/connect-probe-flow-coverage

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

@github-actions

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No E2E is recommended because the only changed file is a unit/integration test file. The changes improve test coverage for sandbox connect probe-only behavior but cannot affect runtime user flows or security boundaries unless production code also changes.

Optional E2E

  • None.

New E2E recommendations

  • None.

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: None
Optional Vitest E2E scenarios: None

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • None. Only a non-scenario unit test outside test/e2e-scenario/ and the Vitest scenario workflow changed; this cannot affect Vitest E2E scenario behavior.

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • None.

@github-code-quality

github-code-quality Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the branch is 96%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 8d40b28 +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the branch is 46%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 8d40b28 +/-
src/lib/state/o...oard-session.ts 90%
src/lib/inference/local.ts 76%
src/lib/sandbox/config.ts 72%
src/lib/onboard/preflight.ts 64%
src/lib/actions...dbox/rebuild.ts 62%
src/lib/state/sandbox.ts 55%
src/lib/actions...licy-channel.ts 52%
src/lib/onboard...er-gpu-patch.ts 50%
src/lib/policy/index.ts 49%
src/lib/onboard.ts 17%

Updated June 16, 2026 00:35 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 0 worth checking, 0 nice ideas

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

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

🧹 Nitpick comments (1)
src/lib/actions/sandbox/connect-flow.test.ts (1)

208-223: ⚡ Quick win

Assert the process-check call in the probe-only failure test.

This test verifies the failure outcome, but not that it failed via the intended inspection branch. Add an assertion for the quiet process-check call to tighten the contract.

Suggested test hardening
   await expect(harness.connectSandbox("alpha", { probeOnly: true })).rejects.toThrow(
     "process.exit(1)",
   );

+  expect(harness.checkAndRecoverSpy).toHaveBeenCalledWith("alpha", { quiet: true });
   expect(harness.runAutoPairSpy).not.toHaveBeenCalled();
   expect(harness.spawnSyncSpy).not.toHaveBeenCalledWith(
     "openshell",
     ["sandbox", "connect", "alpha"],
     expect.any(Object),
   );
   expect(exitSpy).toHaveBeenCalledWith(1);
🤖 Prompt for 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.

In `@src/lib/actions/sandbox/connect-flow.test.ts` around lines 208 - 223, The
test for "probe-only mode exits when process inspection cannot run" verifies the
failure outcome but does not assert that the process inspection was actually
attempted. Add an assertion to verify that the process-check method or spy on
the harness object was called during the test execution, placing this assertion
after the other expectations to confirm the failure path went through the
intended inspection branch rather than taking an alternative failure path.
🤖 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.

Nitpick comments:
In `@src/lib/actions/sandbox/connect-flow.test.ts`:
- Around line 208-223: The test for "probe-only mode exits when process
inspection cannot run" verifies the failure outcome but does not assert that the
process inspection was actually attempted. Add an assertion to verify that the
process-check method or spy on the harness object was called during the test
execution, placing this assertion after the other expectations to confirm the
failure path went through the intended inspection branch rather than taking an
alternative failure path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 88fb0520-c1af-49b9-962d-ef24e5bda9d6

📥 Commits

Reviewing files that changed from the base of the PR and between 2e8e519 and 8d40b28.

📒 Files selected for processing (1)
  • src/lib/actions/sandbox/connect-flow.test.ts

@cv cv merged commit b942dc4 into main Jun 16, 2026
46 checks passed
@cv cv deleted the test/connect-probe-flow-coverage branch June 16, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant