Summary
Add Vitest test infrastructure to Convoy and establish baseline test coverage for core stage execution and state management.
Why
- Convoy is a deployment agent that writes files, creates PRs, and deploys to Fly.io — operations that are risky to test manually
- The project has zero automated tests and zero open issues, which means quality gaps are undetected
- The deterministic core (scanner, picker, author, orchestrator, state store, medic) is well-isolated and highly testable with mocked adapters
- Tests would prevent regressions in the SQLite state machine, plan execution pipeline, and adapter interfaces
- The project already has a clean TypeScript setup — adding Vitest requires minimal boilerplate
What to Do
-
Install Vitest: Add vitest as a dev dependency. Add a test script to package.json.
-
Create test config: A vitest.config.ts that excludes web/ and demo-app/ from the test scope.
-
Prioritize core modules for initial coverage:
src/core/state.ts — SQLite state store operations (create plan, transition stages, query history). Test schema migration and CRUD operations.
src/core/stages/ — Each stage (scan, plan, author, rehearse, canary, promote, observe, medic) should have a test verifying its interface contract and state transitions.
src/planner/scanner.ts — File tree scanning logic. Test with fixture directories.
src/planner/author.ts — Template-based file authorship. Test that templates produce valid output.
src/adapters/fly/runner.ts — Test with mocked flyctl responses. Verify error handling and rollback logic.
-
CI integration: Update .github/workflows/ci.yml to run npm test on every push and pull request.
Acceptance Criteria
Summary
Add Vitest test infrastructure to Convoy and establish baseline test coverage for core stage execution and state management.
Why
What to Do
Install Vitest: Add
vitestas a dev dependency. Add atestscript topackage.json.Create test config: A
vitest.config.tsthat excludesweb/anddemo-app/from the test scope.Prioritize core modules for initial coverage:
src/core/state.ts— SQLite state store operations (create plan, transition stages, query history). Test schema migration and CRUD operations.src/core/stages/— Each stage (scan, plan, author, rehearse, canary, promote, observe, medic) should have a test verifying its interface contract and state transitions.src/planner/scanner.ts— File tree scanning logic. Test with fixture directories.src/planner/author.ts— Template-based file authorship. Test that templates produce valid output.src/adapters/fly/runner.ts— Test with mockedflyctlresponses. Verify error handling and rollback logic.CI integration: Update
.github/workflows/ci.ymlto runnpm teston every push and pull request.Acceptance Criteria
vitestin devDependenciesvitest.config.tsexists at repo rootnpm testruns Vitest with at least 3 passing tests