Skip to content

refactor(e2e): centralize command environment profiles - #6363

Merged
cv merged 2 commits into
NVIDIA:mainfrom
jyaunches:refactor/e2e-env-profiles
Jul 7, 2026
Merged

refactor(e2e): centralize command environment profiles#6363
cv merged 2 commits into
NVIDIA:mainfrom
jyaunches:refactor/e2e-env-profiles

Conversation

@jyaunches

@jyaunches jyaunches commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Add immutable E2E command-environment profiles on top of the existing filtered availability boundary, and migrate the repeated test-HOME builders used by six live scenarios.

Related Issue

Closes #6356
Parent epic: #6346

Changes

  • Add filtered command, installed-CLI, test-HOME, and sandbox environment profiles.
  • Centralize noninteractive acceptance flags, default OpenShell gateway selection, and deduplicated .local/bin / .npm-global/bin PATH entries.
  • Preserve caller-override precedence and avoid process.env mutation.
  • Keep secret-bearing inference overlays as explicit caller data rather than embedding inference-mode semantics.
  • Migrate six exact/near-exact test-HOME environment builders.
  • Add support tests for filtering, precedence, sandbox identity, PATH composition, immutability, and secret overlays.

Verification

  • Signed/Verified commit; pre-commit, commit-msg, and pre-push hooks passed
  • npm run build:cli
  • npm run typecheck:cli
  • npm run lint
  • e2e-environment-profiles.test.ts (3 passed)
  • No user-facing docs required
  • No secrets or credentials committed

Signed-off-by: Julie Yaunches jyaunches@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added shared environment presets for CLI, home-directory, and sandboxed command runs.
    • Standardized test command environments so local CLI paths and required settings are applied consistently.
  • Bug Fixes

    • Improved end-to-end test reliability by removing duplicated environment setup across multiple scenarios.
  • Tests

    • Added coverage for environment profile behavior, including command setup, home-path handling, and sandbox-specific variables.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Introduces a new e2e fixture module centralizing environment-building logic (commandEnvironment, installedCommandEnvironment, testHomeEnvironment, sandboxCommandEnvironment), a corresponding test suite, and refactors six existing live e2e test files' testEnv helpers to delegate to the new testHomeEnvironment function instead of building environments inline.

Changes

Environment Profile Centralization

Layer / File(s) Summary
Environment profile fixture
test/e2e/fixtures/environment-profiles.ts
New module exporting commandEnvironment, installedCommandEnvironment, testHomeEnvironment, and sandboxCommandEnvironment, with internal withDefaults and withInstalledCliPath helpers for defaults, PATH augmentation, and sandbox/gateway variable composition.
Fixture test coverage
test/e2e/support/e2e-environment-profiles.test.ts
New test suite verifying filtering/precedence/non-mutation for commandEnvironment, HOME/PATH construction for testHomeEnvironment, and sandbox naming plus secret overlays for sandboxCommandEnvironment.
Live test migration
test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts, test/e2e/live/cloud-inference.test.ts, test/e2e/live/credential-migration.test.ts, test/e2e/live/credential-sanitization.test.ts, test/e2e/live/diagnostics.test.ts, test/e2e/live/openclaw-skill-cli.test.ts
Each file's local testEnv helper now imports and delegates to testHomeEnvironment(home, extra) instead of manually building environment via buildAvailabilityProbeEnv, explicit HOME/PATH handling, and hard-coded NEMOCLAW_*/OpenShell variables.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested labels: refactor

Suggested reviewers: ericksoa, prekshivyas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the refactor to centralize e2e command environment profiles.
Linked Issues check ✅ Passed The changes add reusable environment profiles, refactor repeated e2e builders, preserve precedence, and add support tests as requested.
Out of Scope Changes check ✅ Passed The diff stays within e2e environment composition and related tests, with no unrelated product changes visible.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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)
test/e2e/support/e2e-environment-profiles.test.ts (1)

44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Mixed use of path.sep/path.delimiter and POSIX literals.

Line 44 builds home with path.join(path.sep, ...) and line 48 splits on path.delimiter, both platform-aware, which is reasonable for a cross-platform fixture. However per a prior repo learning, e2e/unit tests here run only on Linux (Windows is WSL-only and already POSIX-compliant), so the established convention in this test suite is to use literal :// rather than path.delimiter/path.sep. Consider aligning with that convention for consistency with other test files, or confirm this new test file intentionally departs from it because the fixture itself is designed to be portable.

Based on learnings, "prefer the established POSIX PATH separator :... Do not replace it with path.delimiter in these unit/integration tests, because they only run on Linux runners in CI here".

Also applies to: 48-48

🤖 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 `@test/e2e/support/e2e-environment-profiles.test.ts` at line 44, The test
fixture is using platform-aware path APIs where this suite’s convention is to
use POSIX literals. In the e2e environment profile test, update the `home`
construction in the test setup and the PATH splitting logic to use literal `/`
and `:` consistently instead of `path.sep`/`path.delimiter`, matching the rest
of the Linux-only test suite and keeping the fixture aligned with existing
expectations.

Source: Learnings

🤖 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 `@test/e2e/support/e2e-environment-profiles.test.ts`:
- Line 44: The test fixture is using platform-aware path APIs where this suite’s
convention is to use POSIX literals. In the e2e environment profile test, update
the `home` construction in the test setup and the PATH splitting logic to use
literal `/` and `:` consistently instead of `path.sep`/`path.delimiter`,
matching the rest of the Linux-only test suite and keeping the fixture aligned
with existing expectations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e992e95c-e451-4b2a-8ab3-da99928c8371

📥 Commits

Reviewing files that changed from the base of the PR and between b435598 and 4dfbb4b.

📒 Files selected for processing (8)
  • test/e2e/fixtures/environment-profiles.ts
  • test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts
  • test/e2e/live/cloud-inference.test.ts
  • test/e2e/live/credential-migration.test.ts
  • test/e2e/live/credential-sanitization.test.ts
  • test/e2e/live/diagnostics.test.ts
  • test/e2e/live/openclaw-skill-cli.test.ts
  • test/e2e/support/e2e-environment-profiles.test.ts

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maintainer review: the command environment profiles centralize existing E2E setup without changing precedence or credential boundaries, and the focused migrations are covered by the refreshed suite. Current-main synchronization cleared the stale growth failure; all exact-head checks, DCO, signatures, and review threads are clean.

@cv
cv merged commit 85e97d1 into NVIDIA:main Jul 7, 2026
37 checks passed
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery refactor PR restructures code without intended behavior change labels Jul 7, 2026
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## Summary

Add immutable E2E command-environment profiles on top of the existing
filtered availability boundary, and migrate the repeated test-HOME
builders used by six live scenarios.

## Related Issue

Closes NVIDIA#6356
Parent epic: NVIDIA#6346

## Changes

- Add filtered command, installed-CLI, test-HOME, and sandbox
environment profiles.
- Centralize noninteractive acceptance flags, default OpenShell gateway
selection, and deduplicated `.local/bin` / `.npm-global/bin` PATH
entries.
- Preserve caller-override precedence and avoid `process.env` mutation.
- Keep secret-bearing inference overlays as explicit caller data rather
than embedding inference-mode semantics.
- Migrate six exact/near-exact test-HOME environment builders.
- Add support tests for filtering, precedence, sandbox identity, PATH
composition, immutability, and secret overlays.

## Verification

- [x] Signed/Verified commit; pre-commit, commit-msg, and pre-push hooks
passed
- [x] `npm run build:cli`
- [x] `npm run typecheck:cli`
- [x] `npm run lint`
- [x] `e2e-environment-profiles.test.ts` (3 passed)
- [x] No user-facing docs required
- [x] No secrets or credentials committed

---
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>


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

## Summary by CodeRabbit

* **New Features**
* Added shared environment presets for CLI, home-directory, and
sandboxed command runs.
* Standardized test command environments so local CLI paths and required
settings are applied consistently.

* **Bug Fixes**
* Improved end-to-end test reliability by removing duplicated
environment setup across multiple scenarios.

* **Tests**
* Added coverage for environment profile behavior, including command
setup, home-path handling, and sandbox-specific variables.

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

Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(e2e): centralize command environment profiles

3 participants