Skip to content

test(vitest): restore the fast source boundary - #6696

Merged
cv merged 4 commits into
mainfrom
codex/vitest-fast-source-boundary-main
Jul 12, 2026
Merged

cv merged 4 commits into
mainfrom
codex/vitest-fast-source-boundary-main

Conversation

@cv

@cv cv commented Jul 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Restores npm run test:fast as a clean source-backed lane that succeeds after dist/ is removed. Compiled CLI contracts now stay in package-contract, and the import guard follows transitive module edges so compiled artifacts cannot re-enter a fast project through a helper or alias.

Related Issue

Part of #6692. Follows #6693, which has merged.

Changes

  • Keep the live gateway-auth scenario's compiled launch and TLS dependencies at the live test entry while its reusable helper imports source.
  • Discover the command IDs and literal routing metadata needed by source tests without loading command modules; compiled consumers remain generated-manifest-only and fail closed when the manifest is absent. This source-only path is required because command-registry consumers initialize before command modules can be loaded safely, and src/lib/cli/oclif-metadata.test.ts protects that contract.
  • Move Oclif discovery and completion assertions that require built artifacts into test/package-contract/.
  • Traverse the exact fast-project roots through static imports, exports, dynamic imports, require, and createRequire; report deterministic shortest chains and reject aliases that resolve into root CLI build output while ignoring external package layouts.
  • Make the doctor flow fixture own its CLI-build prerequisite without depending on an existing dist/ tree.
  • Keep compiled Oclif inspection branches in a named package-contract helper and record the live gateway-auth scenario's existing fast parity owner.

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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: this enforces the existing contributor contract documented in CONTRIBUTING.md and AGENTS.md; the required documentation-writer review found no user-facing change.
  • 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: the live auth scenario still receives compiled launch/TLS functions only from its live entry, and compiled CLI metadata remains generated-manifest-only with a fail-closed regression test.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — npm run test:fast -- --reporter=dot (912 files, 9,759 passed, 1 skipped); npm run test:package -- --reporter=dot (19 files, 297 passed); boundary guard (34 passed); doctor flow (10 passed); mock-parity unit (6 passed); live-auth support (17 passed); import/project checks and CLI typecheck passed; the live auth test collected from rebuilt artifacts.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — the complete non-live project set passed in boundary-preserving lanes: test:fast, test:integration (488 files, 6,206 passed, 38 skipped), and test:package.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • 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)

Signed-off-by: Carlos Villela [email protected]

Summary by CodeRabbit

  • Improvements
    • Command routing and completion metadata can be discovered from source without executing command code, with a unified loader and safer handling when the generated manifest is missing.
    • Expanded import-boundary violation reporting with transitive reachability analysis and an optional violation chain.
  • Bug Fixes
    • Strengthened detection of disallowed module-loading forms and improved safeguards to avoid unintentionally loading compiled internals.
    • Updated sandbox doctor flow mocking to align with runtime path resolution.
  • Tests
    • Added/updated contract and e2e suites, including a gateway scenario using injected TLS/launch helpers, new compiled-completion metadata coverage, and a fail-closed manifest check.

@cv cv self-assigned this Jul 12, 2026
@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 755dd213-6541-4ad3-9720-7b9d8bb4a8cc

📥 Commits

Reviewing files that changed from the base of the PR and between d3f06bb and b20a01a.

📒 Files selected for processing (5)
  • src/lib/cli/oclif-metadata.test.ts
  • src/lib/cli/oclif-metadata.ts
  • test/package-contract/cli/oclif-metadata.test.ts
  • test/package-contract/cli/oclif-pattern-discovery-helpers.ts
  • test/package-contract/cli/oclif-pattern-discovery.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/lib/cli/oclif-metadata.test.ts
  • test/package-contract/cli/oclif-metadata.test.ts
  • test/package-contract/cli/oclif-pattern-discovery.test.ts
  • src/lib/cli/oclif-metadata.ts

📝 Walkthrough

Walkthrough

The changes add transitive compiled-import boundary analysis, source-based Oclif metadata discovery, CLI contract coverage, controlled sandbox test loading, and dependency injection for the OpenShell gateway authentication E2E scenario.

Changes

Test boundary and CLI metadata changes

Layer / File(s) Summary
Transitive compiled-import analysis
scripts/checks/no-test-dist-imports.ts
Adds structured module-load detection, repository module resolution, shortest reachability chains, and combined direct/transitive violation reporting.
Boundary coverage and test isolation
test/test-boundary-guards.test.ts, src/lib/actions/...
Adds fixture-based coverage for import graphs and adjusts action tests to control compiled CLI path detection.
Source Oclif metadata discovery
src/lib/cli/oclif-metadata.ts
Discovers literal command metadata from source files and unifies source and generated-manifest loading.
Oclif metadata and command contract coverage
src/lib/cli/*test.ts, test/package-contract/cli/*
Tests source discovery, manifest failure behavior, completion metadata, command inheritance, help ownership, and public command documentation.
Injected E2E gateway dependencies
test/e2e/live/openshell-gateway-auth-source-contract.*, test/e2e/mock-parity.json
Passes gateway helpers into the scenario runner and records the corresponding mock-parity entry.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested labels: area: ci, refactor

Suggested reviewers: ericksoa

Sequence Diagram(s)

sequenceDiagram
  participant FastTests
  participant BoundaryAnalyzer
  participant ModuleResolver
  participant ReachableSource
  FastTests->>BoundaryAnalyzer: scan fast-project entry files
  BoundaryAnalyzer->>ModuleResolver: resolve recorded module references
  ModuleResolver->>ReachableSource: load reachable repository modules
  ReachableSource->>BoundaryAnalyzer: report compiled-load violations
  BoundaryAnalyzer->>FastTests: return shortest violation chains
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.22% 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 is concise and matches the main change: restoring the fast source-backed boundary for Vitest tests.
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.
✨ 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 codex/vitest-fast-source-boundary-main

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

@github-code-quality

github-code-quality Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/vitest-fast-so... branch remains at 79%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main b9b8d2a codex/vitest-fast-so... b20a01a +/-
src/lib/messagi...ate-resolver.ts 89% 78% -11%
src/lib/runner.ts 80% 74% -6%
src/lib/messagi...ate-resolver.ts 88% 82% -6%
src/lib/cli/oclif-metadata.ts 100% 95% -5%
src/lib/actions/completion.ts 99% 97% -2%
src/lib/adapter...tp/curl-args.ts 99% 98% -1%
src/lib/messagi.../persistence.ts 92% 91% -1%
src/lib/adapter...shell/client.ts 88% 90% +2%
src/lib/actions...int-emission.ts 90% 93% +3%
src/lib/actions...sandbox/exec.ts 82% 86% +4%

Updated July 12, 2026 00:57 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: openshell-gateway-auth-contract

Dispatch hint: openshell-gateway-auth-contract

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None.

Optional E2E

  • openshell-gateway-auth-contract (resource-heavy; up to 20 minutes): Run the directly modified live security-contract test to confirm its dependency injection still exercises compiled Docker-driver gateway launch and local-TLS behavior, including mTLS and sandbox-JWT isolation.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: openshell-gateway-auth-contract

@github-actions

github-actions Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: No advisor follow-up required beyond maintainer review.
Findings: 0 required · 0 warnings · 0 optional suggestions
Since last review: 1 prior item resolved · 0 still apply · 0 new items found

Workflow run details

This is an automated review. Required findings need action before merge. Warnings and optional suggestions do not require a response or follow-up. A human maintainer makes 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.

Actionable comments posted: 3

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

4-4: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Scope the filesystem mock to the CLI-build path.

mockReturnValueOnce(true) affects whichever existsSync call happens first. Another filesystem check can consume it, causing this harness to depend on internal check ordering or the real dist/ directory. Match dist/nemoclaw.js explicitly and delegate all other paths to the original function.

As per path instructions, tests should provide behavioral confidence rather than rely on broad mocks that bypass the behavior under test.

Also applies to: 184-185

🤖 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/doctor-flow.test.ts` at line 4, Update the filesystem
mock in the test setup around the imported fs module and its existsSync
configuration to return true only for the exact dist/nemoclaw.js path, while
delegating all other paths to the original existsSync implementation. Remove the
order-dependent mockReturnValueOnce behavior so unrelated filesystem checks and
the real dist directory do not affect the test.

Source: Path instructions

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

Inline comments:
In `@scripts/checks/no-test-dist-imports.ts`:
- Around line 57-60: Update isFastProjectTestPath to derive fast-project roots
and matching patterns from the canonical Vitest project configuration rather
than hardcoding src, nemoclaw/src, and test/e2e/support. Reuse the configuration
or generated project listing used by test:fast, while preserving the existing
.claude exclusion and test-file matching behavior.
- Around line 316-321: Update scan so embedded-template processing disables only
module-reference expansion, not module-load violation recording via
addModuleLoad. Preserve moduleLoadViolations for transitive checking when
recordModuleGraph is disabled, including violations found in imported helpers.
Add focused regression coverage for a fast test importing a helper with a
String.raw embedded dist require, along with the required false-positive case.

In `@test/package-contract/cli/oclif-pattern-discovery.test.ts`:
- Around line 82-87: Update the usage validation in the publicCommands contract
test to accept either a non-empty string or a non-empty array, while still
reporting missing usage for empty strings, empty arrays, and other invalid
values. Keep the existing summary and description checks unchanged.

---

Nitpick comments:
In `@src/lib/actions/sandbox/doctor-flow.test.ts`:
- Line 4: Update the filesystem mock in the test setup around the imported fs
module and its existsSync configuration to return true only for the exact
dist/nemoclaw.js path, while delegating all other paths to the original
existsSync implementation. Remove the order-dependent mockReturnValueOnce
behavior so unrelated filesystem checks and the real dist directory do not
affect the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d2e0d659-95e2-4517-9455-c0a15c3321ba

📥 Commits

Reviewing files that changed from the base of the PR and between 1cbcbd3 and a9f6876.

📒 Files selected for processing (12)
  • scripts/checks/no-test-dist-imports.ts
  • src/lib/actions/completion.test.ts
  • src/lib/actions/sandbox/doctor-flow.test.ts
  • src/lib/cli/oclif-command-metadata.test.ts
  • src/lib/cli/oclif-metadata.test.ts
  • src/lib/cli/oclif-metadata.ts
  • test/e2e/live/openshell-gateway-auth-source-contract-helpers.ts
  • test/e2e/live/openshell-gateway-auth-source-contract.test.ts
  • test/package-contract/cli/completion.test.ts
  • test/package-contract/cli/oclif-metadata.test.ts
  • test/package-contract/cli/oclif-pattern-discovery.test.ts
  • test/test-boundary-guards.test.ts
💤 Files with no reviewable changes (2)
  • src/lib/cli/oclif-command-metadata.test.ts
  • src/lib/actions/completion.test.ts

Comment on lines +57 to +60
export function isFastProjectTestPath(relativePath: string): boolean {
const normalized = relativePath.replaceAll("\\", "/");
if (normalized.startsWith("src/") && normalized.split("/").includes(".claude")) return false;
return /^(?:src|nemoclaw\/src|test\/e2e\/support)\/.+\.test\.ts$/.test(normalized);

@coderabbitai coderabbitai Bot Jul 12, 2026 •

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Derive fast-project roots from the canonical Vitest configuration.

The regex and three traversal roots independently duplicate the test:fast project inventory. A future Vitest-glob change can silently leave tests outside this guard, while the self-referential unit test still passes. Share the canonical project definitions or consume a generated project listing instead.

As per path instructions, derive inventories and limits from a canonical source where possible; duplicated lists can silently drift.

Also applies to: 865-871

🤖 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 `@scripts/checks/no-test-dist-imports.ts` around lines 57 - 60, Update
isFastProjectTestPath to derive fast-project roots and matching patterns from
the canonical Vitest project configuration rather than hardcoding src,
nemoclaw/src, and test/e2e/support. Reuse the configuration or generated project
listing used by test:fast, while preserving the existing .claude exclusion and
test-file matching behavior.

Source: Path instructions

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping canonical root derivation out of PR2 intentionally. Issue #6692 assigns canonical project-membership and zero-membership enforcement to PR9, while PR3 canonicalizes the plugin project configuration. PR2 protects the exact current fast-root set with contract coverage plus test:projects:check; executing Vitest configuration from this import checker would conflate those ordered stack entries.

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.

@cv, that sequencing makes sense — thanks for the context on the stack ordering. Deferring canonical root derivation to PR9 (per issue #6692) and plugin config canonicalization to PR3, while PR2 locks down the current fast-root set with contract coverage and test:projects:check, is a reasonable way to avoid conflating those concerns. Withdrawing this suggestion.

Comment thread scripts/checks/no-test-dist-imports.ts Resolved
@cv

cv commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

The d3f06bb follow-up also replaces the order-dependent one-shot existsSync mock with an exact CLI-build-path predicate that delegates every other filesystem query to the real implementation. The focused doctor flow passes 10/10, and the full import-boundary check remains green.

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

Actionable comments posted: 2

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

Inline comments:
In `@test/package-contract/cli/oclif-pattern-discovery-helpers.ts`:
- Around line 20-26: Update commandOwnsHelpFlag to inspect the effective static
flags value on commandClass, including inherited flags, instead of requiring
flags to be an own property. Continue checking whether the resolved flags object
defines its own help entry, while preserving the existing function-type guard.
- Around line 10-18: Update extendsNemoClawCommand to compare each prototype in
the inheritance chain by constructor identity against the actual shared
NemoClawCommand constructor, rather than matching current.name. Reuse the loaded
base constructor or inject it into the helper, while preserving the existing
false result for non-functions and unrelated classes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 805e3b80-602d-401a-9e01-e589d8757d9c

📥 Commits

Reviewing files that changed from the base of the PR and between a9f6876 and d3f06bb.

📒 Files selected for processing (6)
  • scripts/checks/no-test-dist-imports.ts
  • src/lib/actions/sandbox/doctor-flow.test.ts
  • test/e2e/mock-parity.json
  • test/package-contract/cli/oclif-pattern-discovery-helpers.ts
  • test/package-contract/cli/oclif-pattern-discovery.test.ts
  • test/test-boundary-guards.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/actions/sandbox/doctor-flow.test.ts
  • scripts/checks/no-test-dist-imports.ts

@cv

cv commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the incremental PR Review Advisor warning in b20a01a. Source metadata now recognizes only the established ${CLI_DISPLAY_NAME} summary template grammar in addition to JSON string literals, with regressions for interpolation in the middle and at the beginning. Focused CLI tests, CLI typecheck/import-boundary checks, and the full 300-test package-contract lane pass.

@cv
cv merged commit f92ff00 into main Jul 12, 2026
55 checks passed
@cv
cv deleted the codex/vitest-fast-source-boundary-main branch July 12, 2026 01:33
@cv cv mentioned this pull request Jul 12, 2026
9 of 21 tasks
cv added a commit that referenced this pull request Jul 12, 2026
## Summary

Add per-test ownership for temporary HOME/bin directories, loopback
servers, and child processes so cleanup is awaited even when setup or
assertions fail. Migrate the current high-use CLI helpers and high-risk
Hermes broker and Ollama proxy consumers, including cleanup of each
implicit CLI HOME. This is PR4 in the #6692 stack; PRs #6696 and #6697
are already merged.

## Related Issue

Related to #6692

## Changes

- Add `OwnedTestResources` and focused `test.extend` fixtures for LIFO
cleanup of temporary directories, HOME/bin environments, servers, and
child processes.
- Add a shared child-process owner that waits for `close`, attempts
graceful termination, escalates to `SIGKILL` when required, and confirms
piped stdio is closed. The owned-resource fixture and Ollama proxy
harness share this lifecycle because suite teardown did not consistently
cover setup failures or await process closure.
- Track server lifetime from ownership registration so fixture cleanup
waits for both fixture-initiated shutdown and shutdown already started
by code under test.
- Remove the unowned per-invocation CLI HOME by deleting it when
`runWithEnvInternal` completes, while preserving explicit caller-owned
HOME directories.
- Migrate the current repeated CLI HOME/bin setup helpers and the
high-risk logs, doctor, Hermes broker, and Ollama proxy process/server
consumers.
- Add focused regressions for idempotent cleanup, server shutdown
already in progress, graceful and forced child termination, proxy
readiness failure cleanup, and CLI HOME cleanup after success, failure,
and timeout.

## 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: This changes test-only
resource ownership and cleanup. The required documentation-writer review
confirmed there is no user-facing behavior, test command, lane, or
contributor contract to document.
- [ ] 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 the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification:
- `npx vitest run --project integration
test/owned-test-resources.test.ts test/cli/helpers.test.ts
test/cli/logs.test.ts test/cli/debug-command.test.ts
test/cli/doctor-gateway-token.test.ts test/cli/sandbox-mutations.test.ts
test/cli/snapshot-shields.test.ts
test/hermes-tool-gateway-broker.test.ts
test/ollama-auth-proxy-handler.test.ts` — 9 files, 71/71 tests passed on
the rebased branch.
- `NEMOCLAW_TEST_TIMEOUT=60000 npx vitest run --project integration
test/cli/helpers.test.ts` — 12/12 tests passed; the synchronous timeout
regression remained fixed at 2 seconds.
- `npx vitest run --project integration test/cli/logs.test.ts
--detectAsyncLeaks` — 10/10 tests passed with no async leaks.
- `npm run typecheck:cli`, Biome on all changed files, `npm run
source-shape:check`, `npm run test-size:check`, `npm run
test:projects:check`, `npm run test:imports:check`, and `npm run
test:titles:check` passed.
- [x] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: `npm test` passed on the
rebased branch (1,438 files and 16,457 tests passed; 3 files and 40
opt-in platform tests skipped).
- [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 <[email protected]>


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

* **Tests**
* Improved CLI test hermeticity by standardizing on
`owned-test-resources` with resource-scoped setup/teardown across logs,
doctor, debug, sandbox mutations, snapshot shields, and
sandbox/server-related suites.
* Expanded HOME-related coverage, verifying no implicit HOME is left
behind for successful, failed, and timed-out runs (while honoring
explicit HOME).
* Added dedicated child-process lifecycle ownership utilities and new
verification tests for graceful shutdown, SIGTERM→SIGKILL escalation,
and reliable stream closure/cleanup.
* Strengthened ollama auth proxy startup/cleanup tests, including
readiness timeout failures, listener removal, and retryable cleanup
behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
cv added a commit that referenced this pull request Jul 12, 2026
## Summary
Vitest project validation now compares every filesystem test candidate
with Vitest's complete eight-project roster, rejecting omissions,
overlaps, wrong routing, unexpected files, and unexpected project names.
The shared credential-free E2E workflow now applies Vitest's native
e2e/credential-free tag filter in addition to the existing safe matrix
scanner. The dashboard-port regression fixture also uses a coherent fake
OpenShell 0.0.72 component set and an OS-assigned gateway port so the
repo-wide gate stays hermetic.

This is the final entry in the ordered #6692 stack after #6693, #6696,
#6697, #6699, #6700, #6701, #6702, and #6705 landed.

## Related Issue
Closes #6692

## Changes
- Discover broad test/spec JavaScript and TypeScript candidates under
src, test, and nemoclaw/src, including nested dist, coverage, and .venv
paths that Vitest would see.
- Compare candidate routing with Vitest file listings and the complete
roster from list-tags JSON, including empty and opt-in projects.
- Produce sorted diagnostics for zero membership, overlap, wrong
project, unsupported candidates, unexpected listed files, and missing or
extra projects.
- Invoke Vitest portably through process.execPath and
node_modules/vitest/vitest.mjs.
- Require the exact native credential-free tag filter in the shared E2E
workflow contract while retaining the TypeScript scanner's path,
project, ID, and declaration checks.
- Keep the dashboard-port exhaustion regression independent of port
8080, developer OpenShell overrides, channel selection, and network
installation.

## 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: these are
contributor/test-harness safeguards; AGENTS.md now states the exhaustive
project-membership contract, the E2E README already documents the native
module tag, and the required documentation-writer review found no
user-facing change.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: independent review
covered the shared credential-free workflow and onboarding regression
fixture; it confirmed the filter preserves the existing scanner and the
fixture's child-only environment cannot reach a real OpenShell install.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration and every
commit appears as Verified in GitHub
- [x] Normal pre-commit, commit-msg, and pre-push hooks passed, or npm
run check:diff passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — 46 integration tests passed across the
boundary and dashboard-port files; 4 E2E-support workflow tests passed;
project membership is exact for 1,537 candidates across 8 projects; CLI
type-check, title style, Biome, and diff checks passed. The fixture also
passed with hostile inherited OpenShell paths and dev-channel selection.
- [x] Applicable broad gate passed — npm test passed 1,456 files /
16,515 tests before the final focused hardening; npm run check passed
the repo-wide structural, CLI coverage, and plugin coverage gates,
followed by focused reruns and normal hooks after the final
child-environment pin.
- [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 (doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <[email protected]>


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

- **Tests**
- Credential-free end-to-end test runs now execute only tests matching
the credential-free tag.
- Vitest project validation now checks for missing, overlapping,
unsupported, wrong, zero-membership, and unexpected test-to-project
assignments, plus roster mismatches.
- Expanded boundary tests cover test candidate discovery, expected
project mapping, Vitest invocation resolution, and listing/roster
parsing.
- Improved onboarding “dashboard port exhaustion” assertions for more
hermetic, reliable verification.
- **Documentation**
- Updated testing guidance to require Vitest project globs be disjoint
and exhaustive, enforced by the projects check.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Restores `npm run test:fast` as a clean source-backed lane that succeeds
after `dist/` is removed. Compiled CLI contracts now stay in
`package-contract`, and the import guard follows transitive module edges
so compiled artifacts cannot re-enter a fast project through a helper or
alias.

## Related Issue

Part of NVIDIA#6692. Follows NVIDIA#6693, which has merged.

## Changes

- Keep the live gateway-auth scenario's compiled launch and TLS
dependencies at the live test entry while its reusable helper imports
source.
- Discover the command IDs and literal routing metadata needed by source
tests without loading command modules; compiled consumers remain
generated-manifest-only and fail closed when the manifest is absent.
This source-only path is required because command-registry consumers
initialize before command modules can be loaded safely, and
`src/lib/cli/oclif-metadata.test.ts` protects that contract.
- Move Oclif discovery and completion assertions that require built
artifacts into `test/package-contract/`.
- Traverse the exact fast-project roots through static imports, exports,
dynamic imports, `require`, and `createRequire`; report deterministic
shortest chains and reject aliases that resolve into root CLI build
output while ignoring external package layouts.
- Make the doctor flow fixture own its CLI-build prerequisite without
depending on an existing `dist/` tree.
- Keep compiled Oclif inspection branches in a named package-contract
helper and record the live gateway-auth scenario's existing fast parity
owner.

## 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: this enforces the existing
contributor contract documented in `CONTRIBUTING.md` and `AGENTS.md`;
the required documentation-writer review found no user-facing change.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: the live auth scenario
still receives compiled launch/TLS functions only from its live entry,
and compiled CLI metadata remains generated-manifest-only with a
fail-closed regression test.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npm run test:fast -- --reporter=dot`
(912 files, 9,759 passed, 1 skipped); `npm run test:package --
--reporter=dot` (19 files, 297 passed); boundary guard (34 passed);
doctor flow (10 passed); mock-parity unit (6 passed); live-auth support
(17 passed); import/project checks and CLI typecheck passed; the live
auth test collected from rebuilt artifacts.
- [x] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — the complete non-live project set passed
in boundary-preserving lanes: `test:fast`, `test:integration` (488
files, 6,206 passed, 38 skipped), and `test:package`.
- [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 <[email protected]>


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

- **Improvements**
- Command routing and completion metadata can be discovered from source
without executing command code, with a unified loader and safer handling
when the generated manifest is missing.
- Expanded import-boundary violation reporting with transitive
reachability analysis and an optional violation chain.
- **Bug Fixes**
- Strengthened detection of disallowed module-loading forms and improved
safeguards to avoid unintentionally loading compiled internals.
- Updated sandbox doctor flow mocking to align with runtime path
resolution.
- **Tests**
- Added/updated contract and e2e suites, including a gateway scenario
using injected TLS/launch helpers, new compiled-completion metadata
coverage, and a fail-closed manifest check.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## Summary

Add per-test ownership for temporary HOME/bin directories, loopback
servers, and child processes so cleanup is awaited even when setup or
assertions fail. Migrate the current high-use CLI helpers and high-risk
Hermes broker and Ollama proxy consumers, including cleanup of each
implicit CLI HOME. This is PR4 in the NVIDIA#6692 stack; PRs NVIDIA#6696 and NVIDIA#6697
are already merged.

## Related Issue

Related to NVIDIA#6692

## Changes

- Add `OwnedTestResources` and focused `test.extend` fixtures for LIFO
cleanup of temporary directories, HOME/bin environments, servers, and
child processes.
- Add a shared child-process owner that waits for `close`, attempts
graceful termination, escalates to `SIGKILL` when required, and confirms
piped stdio is closed. The owned-resource fixture and Ollama proxy
harness share this lifecycle because suite teardown did not consistently
cover setup failures or await process closure.
- Track server lifetime from ownership registration so fixture cleanup
waits for both fixture-initiated shutdown and shutdown already started
by code under test.
- Remove the unowned per-invocation CLI HOME by deleting it when
`runWithEnvInternal` completes, while preserving explicit caller-owned
HOME directories.
- Migrate the current repeated CLI HOME/bin setup helpers and the
high-risk logs, doctor, Hermes broker, and Ollama proxy process/server
consumers.
- Add focused regressions for idempotent cleanup, server shutdown
already in progress, graceful and forced child termination, proxy
readiness failure cleanup, and CLI HOME cleanup after success, failure,
and timeout.

## 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: This changes test-only
resource ownership and cleanup. The required documentation-writer review
confirmed there is no user-facing behavior, test command, lane, or
contributor contract to document.
- [ ] 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 the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification:
- `npx vitest run --project integration
test/owned-test-resources.test.ts test/cli/helpers.test.ts
test/cli/logs.test.ts test/cli/debug-command.test.ts
test/cli/doctor-gateway-token.test.ts test/cli/sandbox-mutations.test.ts
test/cli/snapshot-shields.test.ts
test/hermes-tool-gateway-broker.test.ts
test/ollama-auth-proxy-handler.test.ts` — 9 files, 71/71 tests passed on
the rebased branch.
- `NEMOCLAW_TEST_TIMEOUT=60000 npx vitest run --project integration
test/cli/helpers.test.ts` — 12/12 tests passed; the synchronous timeout
regression remained fixed at 2 seconds.
- `npx vitest run --project integration test/cli/logs.test.ts
--detectAsyncLeaks` — 10/10 tests passed with no async leaks.
- `npm run typecheck:cli`, Biome on all changed files, `npm run
source-shape:check`, `npm run test-size:check`, `npm run
test:projects:check`, `npm run test:imports:check`, and `npm run
test:titles:check` passed.
- [x] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: `npm test` passed on the
rebased branch (1,438 files and 16,457 tests passed; 3 files and 40
opt-in platform tests skipped).
- [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 <[email protected]>


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

* **Tests**
* Improved CLI test hermeticity by standardizing on
`owned-test-resources` with resource-scoped setup/teardown across logs,
doctor, debug, sandbox mutations, snapshot shields, and
sandbox/server-related suites.
* Expanded HOME-related coverage, verifying no implicit HOME is left
behind for successful, failed, and timed-out runs (while honoring
explicit HOME).
* Added dedicated child-process lifecycle ownership utilities and new
verification tests for graceful shutdown, SIGTERM→SIGKILL escalation,
and reliable stream closure/cleanup.
* Strengthened ollama auth proxy startup/cleanup tests, including
readiness timeout failures, listener removal, and retryable cleanup
behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
…A#6707)

## Summary
Vitest project validation now compares every filesystem test candidate
with Vitest's complete eight-project roster, rejecting omissions,
overlaps, wrong routing, unexpected files, and unexpected project names.
The shared credential-free E2E workflow now applies Vitest's native
e2e/credential-free tag filter in addition to the existing safe matrix
scanner. The dashboard-port regression fixture also uses a coherent fake
OpenShell 0.0.72 component set and an OS-assigned gateway port so the
repo-wide gate stays hermetic.

This is the final entry in the ordered NVIDIA#6692 stack after NVIDIA#6693, NVIDIA#6696,
NVIDIA#6697, NVIDIA#6699, NVIDIA#6700, NVIDIA#6701, NVIDIA#6702, and NVIDIA#6705 landed.

## Related Issue
Closes NVIDIA#6692

## Changes
- Discover broad test/spec JavaScript and TypeScript candidates under
src, test, and nemoclaw/src, including nested dist, coverage, and .venv
paths that Vitest would see.
- Compare candidate routing with Vitest file listings and the complete
roster from list-tags JSON, including empty and opt-in projects.
- Produce sorted diagnostics for zero membership, overlap, wrong
project, unsupported candidates, unexpected listed files, and missing or
extra projects.
- Invoke Vitest portably through process.execPath and
node_modules/vitest/vitest.mjs.
- Require the exact native credential-free tag filter in the shared E2E
workflow contract while retaining the TypeScript scanner's path,
project, ID, and declaration checks.
- Keep the dashboard-port exhaustion regression independent of port
8080, developer OpenShell overrides, channel selection, and network
installation.

## 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:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: these are
contributor/test-harness safeguards; AGENTS.md now states the exhaustive
project-membership contract, the E2E README already documents the native
module tag, and the required documentation-writer review found no
user-facing change.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: independent review
covered the shared credential-free workflow and onboarding regression
fixture; it confirmed the filter preserves the existing scanner and the
fixture's child-only environment cannot reach a real OpenShell install.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration and every
commit appears as Verified in GitHub
- [x] Normal pre-commit, commit-msg, and pre-push hooks passed, or npm
run check:diff passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — 46 integration tests passed across the
boundary and dashboard-port files; 4 E2E-support workflow tests passed;
project membership is exact for 1,537 candidates across 8 projects; CLI
type-check, title style, Biome, and diff checks passed. The fixture also
passed with hostile inherited OpenShell paths and dev-channel selection.
- [x] Applicable broad gate passed — npm test passed 1,456 files /
16,515 tests before the final focused hardening; npm run check passed
the repo-wide structural, CLI coverage, and plugin coverage gates,
followed by focused reruns and normal hooks after the final
child-environment pin.
- [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 (doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <[email protected]>


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

- **Tests**
- Credential-free end-to-end test runs now execute only tests matching
the credential-free tag.
- Vitest project validation now checks for missing, overlapping,
unsupported, wrong, zero-membership, and unexpected test-to-project
assignments, plus roster mismatches.
- Expanded boundary tests cover test candidate discovery, expected
project mapping, Vitest invocation resolution, and listing/roster
parsing.
- Improved onboarding “dashboard port exhaustion” assertions for more
hermetic, reliable verification.
- **Documentation**
- Updated testing guidance to require Vitest project globs be disjoint
and exhaustive, enforced by the projects check.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
@wscurran wscurran added the area: ci CI workflows, checks, release automation, or GitHub Actions label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants