test: fake colab CLI + PTY harness + opt-in live smoke #5

Open
opened 2026-11-11 20:18:46 +00:00 by dsh · 1 comment
Owner

Unit tests without a VM + one cheap live smoke test.

Unit (no network/GPU)

  • put a fake colab executable on PATH (shell or node script) with canned outputs for: new/status/stop/usage/log/drivemount/ls/upload/download
  • golden fixtures for success, session_not_found, rate limit, auth pending, wedged kernel
  • PTY harness for drive-auth (scripted prompt: print URL, wait for Enter)

Integration (opt-in, ~1 CU)

  • create T4 → exec print torch version → stop; assert cleanup even on failure
  • drive-auth smoke against the real account (operator present), skipped by default via env var

Acceptance

  • npm test (or equivalent) green offline;
  • live smoke documented in README as make smoke / env-gated;
  • no test leaves a running session (global cleanup hook).
Unit tests without a VM + one cheap live smoke test. ## Unit (no network/GPU) - put a fake `colab` executable on PATH (shell or node script) with canned outputs for: new/status/stop/usage/log/drivemount/ls/upload/download - golden fixtures for success, `session_not_found`, rate limit, auth pending, wedged kernel - PTY harness for drive-auth (scripted prompt: print URL, wait for Enter) ## Integration (opt-in, ~1 CU) - create T4 → `exec` print torch version → stop; assert cleanup even on failure - drive-auth smoke against the real account (operator present), skipped by default via env var ## Acceptance - `npm test` (or equivalent) green offline; - live smoke documented in README as `make smoke` / env-gated; - no test leaves a running session (global cleanup hook).
dsh added this to the v0 - CLI wrapper milestone 2026-11-11 20:18:46 +00:00
Author
Owner

Mostly done in f414adc; keeping open until the live smoke runs.

  • test/fake-colab.mjs reproduces the 0.8.0 text formats and a small remote filesystem (sessions, usage, log JSONL, ls, upload/download, exec with ticks/appends/writes/timeout/exit, Drive auth with consent-file control, upload 500s, hanging commands)
  • test/helpers/harness.mjs gives each test an isolated fake CLI + fake Cordis context and validates every tool result against its output schema
  • 86 tests in npm test, including a full colab_run recipe with artifact verification, stop-on-every-path, redaction, and MCP adapter tests with a fake MCP client
  • scripts/smoke-live.mjs shipped, guarded by DSH_COLAB_LIVE_SMOKE=1 + --confirm-live; it creates only its own smoke-<hex> session, optionally tests Drive, and always stops it

Not run: the live smoke. This host has no colab binary on purpose and the operator may have sessions running; the first real run should be a deliberate, operator-present action.

Mostly done in `f414adc`; keeping open until the live smoke runs. - `test/fake-colab.mjs` reproduces the 0.8.0 text formats and a small remote filesystem (sessions, usage, log JSONL, ls, upload/download, exec with ticks/appends/writes/timeout/exit, Drive auth with consent-file control, upload 500s, hanging commands) - `test/helpers/harness.mjs` gives each test an isolated fake CLI + fake Cordis context and validates every tool result against its output schema - 86 tests in `npm test`, including a full `colab_run` recipe with artifact verification, stop-on-every-path, redaction, and MCP adapter tests with a fake MCP client - `scripts/smoke-live.mjs` shipped, guarded by `DSH_COLAB_LIVE_SMOKE=1` + `--confirm-live`; it creates only its own `smoke-<hex>` session, optionally tests Drive, and always stops it Not run: the live smoke. This host has no `colab` binary on purpose and the operator may have sessions running; the first real run should be a deliberate, operator-present action.
Sign in to join this conversation.
No description provided.