Skip to content

feat(test-infra): cloud QA automatically runs the local-only companion (green means green) - #848

Merged
danshapiro merged 1 commit into
mainfrom
feat/cloud-local-companion
Oct 14, 2026
Merged

danshapiro merged 1 commit into
mainfrom
feat/cloud-local-companion

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

What

A green cloud QA run previously did NOT mean "all tests passed": the Cloud Run vitest image deliberately excludes tests that need a locally built server and a Docker daemon (today: test/integration/server/ — the managed-provider parity suites, excluded via .dockerignore), so those files were simply absent from the shards. The 10-day-hidden Claude settings-digest drift (fixed in #846) was masked exactly this way — every "green" cloud run in that window silently skipped the only tests that could catch it.

Broad runs (pnpm run test / check / verify) with FRESHELL_VITEST_BACKEND=cloud now run a client-local-only companion phase locally, in parallel with the cloud shards, scoped to exactly the .dockerignore test exclusions that exist on disk, and fold its exit code into the run verdict — green means green again.

  • parseLocalOnlyTestDirs / resolveCloudCompanionScope / buildCloudCompanionRun — exported pure helpers, unit-tested. The companion parses the live .dockerignore, so future test-directory exclusions are tracked automatically (no hardcoded list to drift).
  • Focused selector runs skip the companion when nothing intersects the excluded set (logged). FRESHELL_VITEST_LOCAL_COMPANION=off disables it with a loud warning that green then does NOT cover the excluded tests. Direct pnpm run test:cloud invocations are unchanged (documented in AGENTS.md).
  • Cloud dispatch converted execFileSync → concurrent execFile so the companion fills the otherwise-idle cloud wait; the artifact-owning local phases (source-runtime / rust / electron) remain strictly sequential — the companion finishes before they start.
  • FRESHELL_VITEST_COMPANION_SCRIPT test seam mirrors FRESHELL_VITEST_CLOUD_SCRIPT for the process-level integration test.

Validation

  • TDD: 12 new unit tests (test/unit/tooling/run-standard-tests.test.ts, 30 total in file) + 10 new process-level checks (scripts/test/cloud-vitest-integration.test.sh — broad/focused/off-switch/local dispatch matrix, all green).
  • pnpm run typecheck green.
  • Live end-to-end validation: a real broad cloud QA (FRESHELL_VITEST_BACKEND=cloud GCLOUD_ROBOT_REQUIRE=1 pnpm run test) from this worktree ran the full stack — cloud shards + companion (3 files / 19 tests passed, 1 env-conditional skip) + source-runtime (10) + full workspace cargo + electron (42 files / 395 tests) — exit 0. The log shows the companion starting in parallel with the cloud dispatch (Starting local companion for cloud-excluded tests … scope: ["test/integration/server"]) and its exit folding into the verdict before the local phases begin.

The cloud vitest image deliberately excludes tests that need a locally
built server and a Docker daemon (today: test/integration/server/ —
see .dockerignore), so a green cloud run never covered them: the files
were simply absent from the shards (the 10-day-hidden digest drift was
masked exactly this way).

Broad runs (test/check/verify) with FRESHELL_VITEST_BACKEND=cloud now
run a 'client-local-only' companion phase locally, in parallel with the
cloud shards, scoped to exactly the .dockerignore test exclusions that
exist on disk, and fold its exit into the run verdict — green means
green again. Focused runs skip the companion when nothing intersects
the excluded set (logged); FRESHELL_VITEST_LOCAL_COMPANION=off disables
it with a loud warning. Direct test:cloud invocations are unchanged.

- parseLocalOnlyTestDirs/resolveCloudCompanionScope/buildCloudCompanionRun
  exported pure helpers (unit-tested); companion parses the live
  .dockerignore so new exclusions are tracked automatically.
- FRESHELL_VITEST_COMPANION_SCRIPT test seam mirrors
  FRESHELL_VITEST_CLOUD_SCRIPT for the process-level integration test.
- Cloud dispatch converted execFileSync -> concurrent execFile so the
  companion fills the otherwise-idle cloud wait; local artifact-owning
  phases remain strictly sequential (companion finishes before they
  start). Docs updated (AGENTS.md, .dockerignore).
@danshapiro
danshapiro merged commit 283e4c4 into main Oct 14, 2026
3 checks passed
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