Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
177bb4a
test(vitest): add owned resource fixtures
cv Jul 12, 2026
d3ff019
test(vitest): preserve proxy startup failures
cv Jul 12, 2026
8725d80
test(vitest): keep cleanup branches out of test bodies
cv Jul 12, 2026
63ece97
test(vitest): isolate mock and environment state
cv Jul 12, 2026
752dee2
test(vitest): close failed readiness probes
cv Jul 12, 2026
ea3aede
test(vitest): improve failure and developer feedback
cv Jul 12, 2026
4b6f585
test(vitest): discard failed proxy owners
cv Jul 12, 2026
25b1a32
merge(vitest): sync owned-resource base
cv Jul 12, 2026
225256a
merge(vitest): sync isolation base
cv Jul 12, 2026
096dba6
test(vitest): keep command fixture branches out of tests
cv Jul 12, 2026
92439a7
test(vitest): split critical-path integration suites
cv Jul 12, 2026
2e0d037
test(vitest): resolve split review findings
cv Jul 12, 2026
f47dff2
test(vitest): refresh critical-path timing hints
cv Jul 12, 2026
a56f692
test(vitest): resolve remaining CodeQL findings
cv Jul 12, 2026
b72a07d
test(vitest): read guarded paths through descriptors
cv Jul 12, 2026
419639b
test(vitest): make debug specification grammatical
cv Jul 12, 2026
7e4a6dd
merge(vitest): sync grammatical debug specification
cv Jul 12, 2026
e56181f
merge(vitest): sync grammatical debug specification
cv Jul 12, 2026
3f29310
merge(vitest): sync grammatical debug specification
cv Jul 12, 2026
daeba61
merge(main): sync merged Vitest stack base
cv Jul 12, 2026
8b77fbc
merge(vitest): sync failure-feedback base
cv Jul 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Package-specific guides:
| Run all tests for broad changes | `npm test` |
| Render behavior-oriented test tree | `npm run test:spec` |
| Run fast source tests | `npm run test:fast` |
| Run tests affected by current changes | `npm run test:changed` |
| Watch focused source tests | `npm run test:watch` |
| Shuffle focused tests without coverage | `npm run test:shuffle` |
| Diagnose async leaks or shutdown hangs | `npm run test:diagnose:leaks` |
| Run integration tests | `npm run test:integration` |
| Run package contracts | `npm run test:package` |
| Run E2E support tests | `npx vitest run --project e2e-support` |
Expand Down Expand Up @@ -95,6 +99,8 @@ When writing tests:
- Import CLI source from ordinary tests. Put genuine compiled-artifact assertions under `test/package-contract/`.
- Keep project globs disjoint; `npm run test:projects:check` derives membership from Vitest and rejects overlap.
- Deterministic projects clear mock calls, restore `vi.spyOn`, and undo `vi.stubEnv` and `vi.stubGlobal` before each test. Create those spies and stubs in `beforeEach` or the test body unless a documented import-time stub must run before module evaluation. Restore direct environment or global mutations yourself, and reset mock implementations explicitly when needed. Live E2E and automatic `mockReset` are intentionally excluded.
- Use `npm run test:changed` or `npm run test:watch` for focused CLI, plugin, and E2E-support feedback. Add only concrete opaque-input mappings to `test/helpers/vitest-watch-triggers.ts` when the import graph cannot see a YAML, Python, shell, generated, or workflow dependency.
- Use `npm run test:shuffle -- --sequence.seed=<seed>` to replay a printed test-order seed. Use `npm run test:diagnose:leaks` for async-resource or shutdown-hang diagnostics; both commands keep coverage disabled, and leak diagnostics can accompany exit code 0 when assertions pass.
- Write behavior-oriented titles, put local issue references in a final `(#1234)` suffix, and use `npm run test:spec` for the hierarchical specification view.
- Mock external dependencies; don't call real NVIDIA APIs in unit tests
- E2E tests run on ephemeral Brev cloud instances
Expand Down
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ These are the primary npm scripts for day-to-day development:
| `npm test` | Build package artifacts and run every non-live Vitest project for broad changes |
| `npm run test:spec` | Run every non-live test with hierarchical behavior-oriented output |
| `npm run test:fast` | Clean `dist/` and run source CLI, plugin, and E2E-support tests |
| `npm run test:changed` | Run tests affected by staged, unstaged, or untracked changes in the CLI, plugin, and E2E-support projects |
| `npm run test:watch` | Watch the CLI, plugin, and E2E-support projects and rerun affected tests |
| `npm run test:shuffle` | Shuffle test order in the focused source projects without collecting coverage |
| `npm run test:diagnose:leaks` | Report async-resource leaks and diagnose a Vitest process that hangs during shutdown |
| `npm run test:integration` | Clean-build the CLI and run root integration and installer tests |
| `npm run test:package` | Clean-build CLI/plugin artifacts and run compiled-package contracts |
| `npm run test:live-e2e` | Opt into live E2E scenarios (mutates real external state) |
Expand All @@ -222,6 +226,33 @@ npx vitest run --project e2e-support
This project is fast and does not run live targets. Live E2E remains opt-in through
`npm run test:live-e2e` or the applicable GitHub Actions workflow.

### Focused Vitest Feedback

Use `npm run test:changed` for the staged, unstaged, and untracked changes in the current checkout,
or keep `npm run test:watch` running while editing. Both commands select only the source-backed
`cli`, `plugin`, and `e2e-support` projects. Watch mode also maps the repository's current opaque
YAML, Python, shell, generated, and workflow inputs to the concrete contract tests that read or
execute them outside Vitest's import graph. Add a narrow mapping in
`test/helpers/vitest-watch-triggers.ts` when a new opaque input needs the same treatment.

Use `npm run test:shuffle` to expose order dependencies in those focused projects. The command
shuffles tests within files and leaves coverage disabled. Vitest prints the chosen seed at the
start of the run. Replay that order by appending the printed value:

```bash
npm run test:shuffle -- --sequence.seed=6692
```

Use `npm run test:diagnose:leaks` when a test file leaves an async resource active or Vitest hangs
during shutdown. It enables Vitest's async-leak detector and hanging-process reporter while
keeping coverage disabled. This is a diagnostic command: inspect its leak output even when all
assertions pass, because reported async leaks do not independently change a successful test exit
code.

Vitest chooses the environment-appropriate reporter for ordinary local runs. In CI, console logs
from passing tests stay hidden while logs attached to failures are replayed; GitHub Actions still
receives test annotations.

### Test State Isolation

The `cli`, `integration`, `installer-integration`, `package-contract`, `plugin`, and `e2e-support`
Expand Down
182 changes: 96 additions & 86 deletions ci/cli-test-timing-hints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,93 +2,103 @@
"schemaVersion": 1,
"defaultDurationMs": 5000,
"source": {
"runId": 29135065089,
"headSha": "7bd6f6685758fa72f84896c3b8aa183f6ed3145a",
"recordedAt": "2026-07-11T01:48:06Z"
"runId": 29180354863,
"headSha": "92439a702f1a8c7cca8609f1259304115a10931d",
"recordedAt": "2026-07-12T05:00:19Z"
},
"files": {
"src/lib/actions/sandbox/doctor-flow.test.ts": 7188,
"src/lib/actions/sandbox/mcp-bridge-status-resolution.test.ts": 13111,
"src/lib/actions/sandbox/mcp-bridge-status-state.test.ts": 6323,
"src/lib/shields/flow.test.ts": 7842,
"src/lib/shields/index.test.ts": 5773,
"src/lib/tunnel/services.test.ts": 5469,
"test/channels-remove-full-teardown.test.ts": 7869,
"test/cli/connect-recovery.test.ts": 5286,
"test/cli/debug-command.test.ts": 15439,
"test/cli/destroy-gateway-cleanup.test.ts": 11834,
"test/cli/dispatch-basics.test.ts": 6048,
"test/cli/docker-outage.test.ts": 7963,
"test/cli/doctor-gateway-token.test.ts": 12666,
"test/cli/list-inference.test.ts": 13506,
"test/cli/list-share-live-inference.test.ts": 13787,
"test/cli/logs.test.ts": 9628,
"test/cli/onboard-compatibility.test.ts": 7785,
"test/cli/sandbox-mutations.test.ts": 13836,
"test/cli/sandbox-status-json.test.ts": 14811,
"test/cli/sandbox-status-text.test.ts": 9317,
"test/cli/snapshot-shields.test.ts": 8393,
"test/cli/tunnel-command.test.ts": 8792,
"test/dcode-wrapper-identity.test.ts": 9787,
"test/exit-code-user-error-surfaces.test.ts": 11372,
"test/gateway-state-reconcile-2276.test.ts": 7723,
"test/hermes-restart-config-seal.test.ts": 50253,
"test/hermes-runtime-api-key.test.ts": 9123,
"test/install-onboard-yes.test.ts": 5576,
"test/install-openshell-upgrade-prompt.test.ts": 17762,
"test/installer-hash-check.test.ts": 10012,
"test/internal-cli.test.ts": 7876,
"test/langchain-deepagents-code-direct-module-patch.test.ts": 19322,
"test/langchain-deepagents-code-image-credentials.test.ts": 25411,
"test/langchain-deepagents-code-nemotron-profile-plugin.test.ts": 6709,
"test/list-command-helper-uses.test.ts": 7200,
"test/local-credential-helper.test.ts": 51442,
"test/mcp-add-crash-consistency.test.ts": 14629,
"test/mcp-bridge-destroy-marker-recovery.test.ts": 7342,
"test/mcp-bridge-servers.test.ts": 13169,
"test/mcp-policy-key-ownership.test.ts": 7067,
"test/nemo-deepagents-alias.test.ts": 11070,
"test/nemoclaw-start-gateway-health.test.ts": 5551,
"test/nemoclaw-start.test.ts": 26821,
"test/nemohermes-alias.test.ts": 9181,
"test/onboard-custom-dockerfile.test.ts": 9202,
"test/onboard-fsm-live-slices.test.ts": 7716,
"test/onboard-messaging.test.ts": 22893,
"test/onboard-ollama-autostart.test.ts": 9245,
"test/onboard-prompt-default-case.test.ts": 8464,
"test/onboard-reservation-recreate.test.ts": 5160,
"test/onboard-selection-vllm.test.ts": 6921,
"test/onboard-selection.test.ts": 19596,
"test/onboard.test.ts": 35406,
"test/openclaw-chat-send-patch.test.ts": 7337,
"test/openclaw-config-guard.test.ts": 16719,
"test/openclaw-device-self-approval-patch.test.ts": 15212,
"test/openclaw-device-stored-auth-patch.test.ts": 6607,
"test/openclaw-integrity-pin.test.ts": 33852,
"test/policy-add-remove-session-sync.test.ts": 6114,
"test/policy-channel-agent-resolution.test.ts": 5834,
"test/policy-tiers-onboard.test.ts": 5200,
"test/pr-workflow-contract.test.ts": 14722,
"test/reboot-identity-drift.test.ts": 10041,
"test/rebuild-credential-preflight.test.ts": 17713,
"test/rebuild-shields-auto-unlock.test.ts": 8723,
"test/recover-port-forward.test.ts": 8091,
"test/release-latest-tag.test.ts": 27029,
"test/repro-2201.test.ts": 16819,
"test/repro-2666-silent-list-status.test.ts": 5854,
"test/sandbox-connect-inference/auto-pair-approval.test.ts": 12342,
"test/sandbox-connect-inference/route-swap-repair.test.ts": 13530,
"test/sandbox-sessions-export-cli.test.ts": 12313,
"test/sandbox-stuck-recovery.test.ts": 6539,
"test/skills/check-gates-compliance.test.ts": 10699,
"test/skills/triage-runtime.test.ts": 9690,
"test/snapshot-gateway-guard.test.ts": 5501,
"test/snapshot-openclaw-managed-extensions.test.ts": 16367,
"test/snapshot-restore-existing-dest.test.ts": 10738,
"test/snapshot.test.ts": 21849,
"test/state-dir-guard.test.ts": 7440,
"test/uninstall-prompt-pty.test.ts": 9308,
"test/uninstall.test.ts": 7691,
"test/update.test.ts": 5843
"src/lib/actions/sandbox/doctor-flow.test.ts": 6480,
"src/lib/actions/sandbox/mcp-bridge-status-resolution.test.ts": 13403,
"src/lib/actions/sandbox/mcp-bridge-status-state.test.ts": 6644,
"src/lib/shields/flow.test.ts": 9944,
"src/lib/shields/index.test.ts": 6267,
"src/lib/shields/legacy-hermes-compat.test.ts": 5463,
"src/lib/tunnel/services.test.ts": 7253,
"test/channels-remove-full-teardown.test.ts": 6619,
"test/cli/connect-recovery.test.ts": 6351,
"test/cli/debug-command.test.ts": 16626,
"test/cli/destroy-gateway-cleanup.test.ts": 12114,
"test/cli/dispatch-basics.test.ts": 6350,
"test/cli/docker-outage.test.ts": 8031,
"test/cli/doctor-gateway-token.test.ts": 12778,
"test/cli/helpers.test.ts": 5627,
"test/cli/list-inference.test.ts": 14574,
"test/cli/list-share-live-inference.test.ts": 14263,
"test/cli/logs.test.ts": 12412,
"test/cli/maintenance-command.test.ts": 6187,
"test/cli/onboard-compatibility.test.ts": 8156,
"test/cli/sandbox-mutations.test.ts": 14331,
"test/cli/sandbox-status-json.test.ts": 18108,
"test/cli/sandbox-status-text.test.ts": 9679,
"test/cli/snapshot-shields.test.ts": 8835,
"test/cli/tunnel-command.test.ts": 9000,
"test/dcode-session-supervisor.test.ts": 7628,
"test/dcode-wrapper-identity.test.ts": 10212,
"test/exit-code-user-error-surfaces.test.ts": 14609,
"test/fetch-guard-patch-regression.test.ts": 5118,
"test/gateway-state-reconcile-2276.test.ts": 7485,
"test/hermes-restart-config-seal-write-lock.test.ts": 43338,
"test/hermes-runtime-api-key.test.ts": 9275,
"test/install-onboard-yes.test.ts": 5722,
"test/install-openshell-upgrade-prompt.test.ts": 22675,
"test/installer-hash-check.test.ts": 10253,
"test/internal-cli.test.ts": 8071,
"test/langchain-deepagents-code-config.test.ts": 5745,
"test/langchain-deepagents-code-direct-module-patch.test.ts": 18520,
"test/langchain-deepagents-code-image-credentials.test.ts": 26951,
"test/langchain-deepagents-code-nemotron-profile-plugin.test.ts": 5557,
"test/list-command-helper-uses.test.ts": 7276,
"test/local-credential-helper-fields.test.ts": 46777,
"test/local-credential-helper-session.test.ts": 5318,
"test/mcp-add-crash-consistency.test.ts": 18749,
"test/mcp-bridge-destroy-marker-recovery.test.ts": 8167,
"test/mcp-bridge-servers.test.ts": 13182,
"test/mcp-policy-key-ownership.test.ts": 7439,
"test/nemo-deepagents-alias.test.ts": 11841,
"test/nemoclaw-start-gateway-health.test.ts": 5508,
"test/nemoclaw-start.test.ts": 26549,
"test/nemohermes-alias.test.ts": 9507,
"test/ollama-proxy-recovery.test.ts": 5672,
"test/onboard-custom-dockerfile.test.ts": 8270,
"test/onboard-fsm-live-slices.test.ts": 7774,
"test/onboard-messaging.test.ts": 24788,
"test/onboard-ollama-autostart.test.ts": 6497,
"test/onboard-prompt-default-case.test.ts": 9107,
"test/onboard-sandbox-build.test.ts": 6376,
"test/onboard-sandbox-recreation.test.ts": 16082,
"test/onboard-selection-vllm.test.ts": 5151,
"test/onboard-selection.test.ts": 26005,
"test/openclaw-chat-send-patch.test.ts": 7689,
"test/openclaw-config-guard.test.ts": 16891,
"test/openclaw-device-self-approval-patch.test.ts": 15630,
"test/openclaw-device-stored-auth-patch.test.ts": 6887,
"test/openclaw-integrity-pin-base.test.ts": 23614,
"test/openclaw-integrity-pin-plugin-install.test.ts": 7841,
"test/plugin-vitest-project.test.ts": 7140,
"test/policy-add-remove-session-sync.test.ts": 6369,
"test/policy-channel-agent-resolution.test.ts": 5978,
"test/pr-workflow-contract.test.ts": 14986,
"test/reboot-identity-drift.test.ts": 10091,
"test/rebuild-credential-hydration.test.ts": 5580,
"test/rebuild-credential-preflight.test.ts": 18993,
"test/rebuild-shields-auto-unlock.test.ts": 9424,
"test/recover-port-forward.test.ts": 9918,
"test/release-latest-tag.test.ts": 27167,
"test/repro-2201.test.ts": 17598,
"test/repro-2666-silent-list-status.test.ts": 8676,
"test/sandbox-connect-inference/auto-pair-approval.test.ts": 12530,
"test/sandbox-connect-inference/route-swap-repair.test.ts": 19653,
"test/sandbox-sessions-export-cli.test.ts": 12907,
"test/sandbox-stuck-recovery.test.ts": 6643,
"test/skills/check-gates-compliance.test.ts": 10363,
"test/skills/triage-runtime.test.ts": 9918,
"test/snapshot-gateway-guard.test.ts": 7138,
"test/snapshot-openclaw-managed-extensions.test.ts": 16951,
"test/snapshot-restore-existing-dest.test.ts": 11219,
"test/snapshot.test.ts": 22248,
"test/state-dir-guard.test.ts": 7375,
"test/uninstall-prompt-pty.test.ts": 9494,
"test/uninstall.test.ts": 7873,
"test/update.test.ts": 6145
}
}
1 change: 0 additions & 1 deletion ci/test-file-size-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"test/nemoclaw-start.test.ts": 4826,
"test/onboard-messaging.test.ts": 2049,
"test/onboard-selection.test.ts": 4769,
"test/onboard.test.ts": 4039,
"test/policies.test.ts": 2242
}
}
Loading
Loading