Implementation
Parent
Sub-issue of the testing strategy epic.
Goal
Test the critical seams: persistence, server runtime (Workers), and CLI handler logic.
Scope
Database strategy (implement here)
CLI / @cyrus/database — in-memory Turso
Server / apps/server — Docker Postgres (not Neon HTTP)
Nightly (optional, can defer to Phase 5)
@cyrus/server — Vitest + @cloudflare/vitest-pool-workers
@cyrus/cli — Bun test
@cyrus/connections — Bun test
CI
Runner
- Bun test: database, cli, connections
- Vitest + Workers pool: server
Auth approach (failproof)
- Integration tests use real better-auth against test Postgres
- Seed a test user + programmatic session; do not use bare bearer token mocks at handler boundaries
Acceptance criteria
- Repository integration tests pass with isolated Turso per test
- Server integration tests pass against Docker Postgres with migrated schema
- Signaling handler + Hub DO covered in Workers pool
runTurn testable without spawning ACP subprocess
Depends on
Phase 1 (turbo tasks + tooling)
Implementation
Parent
Sub-issue of the testing strategy epic.
Goal
Test the critical seams: persistence, server runtime (Workers), and CLI handler logic.
Scope
Database strategy (implement here)
CLI /
@cyrus/database— in-memory Tursoshared/database/__tests__/integration/connection.open()+pushSchemathreads,conversations,projectsServer /
apps/server— Docker Postgres (not Neon HTTP)apps/server/src/db/index.ts→createDb()factory with env-based driver:drizzle-orm/neon-http(unchanged)drizzle-orm/postgres-jsagainst Docker Postgresdocker-compose.test.yml(or CI service) for Postgres 16neon-httpdoes not speak to local Postgres — test driver must differNightly (optional, can defer to Phase 5)
@cyrus/server— Vitest +@cloudflare/vitest-pool-workersvitest.config.ts+ Workers poolHubDurable Object (cloudflare/partyserver.ts)@cyrus/cli— Bun testrunTurnfromhandlers/controller/chat.ts→ testable moduleutils/streams.ts)core/acp/events.ts) with fixture payloadsControllerDeps(DB + mock runtime)@cyrus/connections— Bun testpeer.ts: ICE buffer,createSignalingEventsfan-outsession.tsnormalizeHostCI
test-integrationjob toci.ymlRunner
Auth approach (failproof)
Acceptance criteria
runTurntestable without spawning ACP subprocessDepends on
Phase 1 (turbo tasks + tooling)