GeezerVison is showing github.com — Stabilize Docker-backed Vitest scheduling · codeabovelab/codeboost@9a0a936
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/agent-isolation.yml +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | - 'runner/store.ts' | 18 | 18 | - 'git/history.ts' | 19 | 19 | - 'test/runner-workspace.test.ts' | | 20 | + - 'test/vitest-config.test.ts' | | 21 | + - 'vitest.config.ts' | 20 | 22 | - '.github/workflows/agent-isolation.yml' | 21 | 23 | pull_request: | 22 | 24 | paths: | | 34 | 36 | - 'runner/store.ts' | 35 | 37 | - 'git/history.ts' | 36 | 38 | - 'test/runner-workspace.test.ts' | | 39 | + - 'test/vitest-config.test.ts' | | 40 | + - 'vitest.config.ts' | 37 | 41 | - '.github/workflows/agent-isolation.yml' | 38 | 42 | permissions: | 39 | 43 | contents: read | | 50 | 54 | cache: npm | 51 | 55 | - run: npm ci --ignore-scripts | 52 | 56 | - run: npm run typecheck | 53 | | - # The Docker suites share one image tag and daemon, so run test files one at a time. | 54 | | - - run: npx vitest run --no-file-parallelism test/agent-contract.test.ts test/agent-clone.test.ts test/agent-container.test.ts test/agent-network.test.ts test/agent-policy.test.ts test/agent-proxy.test.ts test/agent-adapter.test.ts test/agent-supervisor.test.ts test/agent-output.test.ts test/agent-gate.test.ts test/agent-question.test.ts test/agent-planning.test.ts test/runner-workspace.test.ts | | 57 | + # The Vitest projects finish ordinary tests first, then run the Docker-backed files one at a time. | | 58 | + - run: npm test |
Collapse file Copy file name to clipboardExpand all lines: docs/implementation/agent-isolation.md +7-5Lines changed: 7 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,15 +6,17 @@ states what those lanes must do when they call the isolation boundary. | 6 | 6 |
| 7 | 7 | ## Run the gate | 8 | 8 |
| 9 | | -The gate needs a running Docker daemon. Run the suites one file at a time, because | 10 | | -they share one image tag and one daemon: | | 9 | +The complete gate needs a running Docker daemon: | 11 | 10 |
| 12 | 11 | ```bash | 13 | | -npx vitest run --no-file-parallelism test/agent-contract.test.ts test/agent-clone.test.ts test/agent-container.test.ts test/agent-network.test.ts test/agent-policy.test.ts test/agent-proxy.test.ts test/agent-adapter.test.ts test/agent-supervisor.test.ts test/agent-output.test.ts test/agent-gate.test.ts test/agent-question.test.ts | | 12 | +npm test | 14 | 13 | ``` | 15 | 14 |
| 16 | | -The `Agent isolation` workflow runs the same command. The main `CI` workflow skips | 17 | | -the Docker suites so that they never run in parallel. | | 15 | +`vitest.config.ts` finishes the ordinary test project first, then runs the Docker-backed | | 16 | +files one at a time because they share one image tag and daemon. Use | | 17 | +`npx vitest run --project docker` to rerun only that serial project. The `Agent isolation` | | 18 | +workflow runs the complete gate. The main `CI` workflow skips the Docker project so that | | 19 | +it can cover the ordinary project independently. | 18 | 20 |
| 19 | 21 | The live vendor probes need real credentials, so CI does not run them. To run them, | 20 | 22 | set `CODEBOOST_RUN_AUTH_PROBES=1` and `CLAUDE_CODE_OAUTH_TOKEN`. Codex has no live | |
Collapse file Copy file name to clipboardExpand all lines: test/runner-branch-push.test.ts +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync | 3 | 3 | import { execFileSync } from 'node:child_process'; | 4 | 4 | import { tmpdir } from 'node:os'; | 5 | 5 | import { join } from 'node:path'; | 6 | | -import { afterEach, describe, expect, it } from 'vitest'; | | 6 | +import { afterEach, describe, expect, it, vi } from 'vitest'; | 7 | 7 | import { fixtureGit as git } from './fixtures/git.ts'; | 8 | 8 | import type { PlanIdentity } from '../core/identity.ts'; | 9 | 9 | import { GH_ENV_ALLOWLIST } from '../github/gh-env.ts'; | @@ -14,6 +14,9 @@ const OWNER = '0123456789abcdef0123456789abcdef'; | 14 | 14 | const IDENTITY: PlanIdentity = { repositoryId: 'repo-1', taskId: 'task-1', planId: 'plan-1' }; | 15 | 15 | const BRANCH = 'codeboost/issue-7-task-1-0123456789abcdef', REF = `refs/heads/${BRANCH}`; | 16 | 16 | const roots: string[] = []; | | 17 | +// These are real multi-process Git integration tests. The crashed-push cases intentionally perform several clones, | | 18 | +// bundles, remote reads and leased pushes, so five seconds is below their normal loaded runtime on development hosts. | | 19 | +vi.setConfig({ testTimeout: 20_000 }); | 17 | 20 | afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); }); | 18 | 21 |
| 19 | 22 | async function setup() { | |
Collapse file Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { describe, expect, it } from 'vitest'; | | 2 | +import config from '../vitest.config.ts'; | | 3 | + | | 4 | +const DOCKER_TESTS = [ | | 5 | + 'test/agent-container.test.ts', | | 6 | + 'test/agent-gate.test.ts', | | 7 | + 'test/agent-network.test.ts', | | 8 | + 'test/agent-planning.test.ts', | | 9 | + 'test/agent-question.test.ts', | | 10 | + 'test/agent-supervisor.test.ts', | | 11 | + 'test/runner-workspace.test.ts', | | 12 | +]; | | 13 | + | | 14 | +describe('Vitest scheduling', () => { | | 15 | + it('finishes ordinary tests before running Docker-backed files one at a time', () => { | | 16 | + const projects = (config as { test?: { projects?: Array<{ test?: Record<string, unknown> }> } }).test?.projects; | | 17 | + expect(projects).toHaveLength(2); | | 18 | + expect(projects?.[0]?.test).toMatchObject({ | | 19 | + name: 'parallel', | | 20 | + include: ['test/*.test.ts'], | | 21 | + exclude: DOCKER_TESTS, | | 22 | + sequence: { groupOrder: 0 }, | | 23 | + }); | | 24 | + expect(projects?.[1]?.test).toMatchObject({ | | 25 | + name: 'docker', | | 26 | + include: DOCKER_TESTS, | | 27 | + fileParallelism: false, | | 28 | + sequence: { groupOrder: 1 }, | | 29 | + }); | | 30 | + }); | | 31 | +}); |
Collapse file Copy file name to clipboard +23-1Lines changed: 23 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { defineConfig } from 'vitest/config'; | 2 | | -export default defineConfig({ test: { include: ['test/*.test.ts'] } }); | | 2 | + | | 3 | +// These files share Docker's daemon and the fixed agent-image tag. Keep them out of the ordinary worker pool so an | | 4 | +// image build or container-heavy test cannot starve unrelated five-second tests, then run them one file at a time. | | 5 | +const dockerTests = [ | | 6 | + 'test/agent-container.test.ts', | | 7 | + 'test/agent-gate.test.ts', | | 8 | + 'test/agent-network.test.ts', | | 9 | + 'test/agent-planning.test.ts', | | 10 | + 'test/agent-question.test.ts', | | 11 | + 'test/agent-supervisor.test.ts', | | 12 | + 'test/runner-workspace.test.ts', | | 13 | +]; | | 14 | + | | 15 | +export default defineConfig({ | | 16 | + test: { | | 17 | + projects: [ | | 18 | + { test: { name: 'parallel', include: ['test/*.test.ts'], exclude: dockerTests, | | 19 | + sequence: { groupOrder: 0 } } }, | | 20 | + { test: { name: 'docker', include: dockerTests, fileParallelism: false, | | 21 | + sequence: { groupOrder: 1 } } }, | | 22 | + ], | | 23 | + }, | | 24 | +}); |
|