diff --git a/docs/scratchpads/fix-turbo-env-passthrough.md b/docs/scratchpads/fix-turbo-env-passthrough.md new file mode 100644 index 0000000..b2b27af --- /dev/null +++ b/docs/scratchpads/fix-turbo-env-passthrough.md @@ -0,0 +1,41 @@ +# Task Scratchpad — Turbo DATABASE_URL passthrough + +## Objective + +- Fix CI test execution under Turborepo by passing DB-related environment variables through the `test` task. +- Preserve the repo's documented local Postgres fallback on host port `5433`. + +## Scope + +- Edit `turbo.json` +- Run baseline checks requested by the user and repo rules where feasible +- Publish branch and open PR if checks are acceptable + +## Assumptions + +- ASSUMPTION: No PRD update is required because this is a narrow CI/config bug fix that does not change product requirements. +- ASSUMPTION: `docs/TASKS.md` remains untouched because project guidance marks it orchestrator-only. +- ASSUMPTION: Local Postgres-backed tests are not runnable in this worktree, so baseline verification will rely on static gates unless the environment already provides DB access. + +## Plan + +- Record current repo state and avoid touching `.mosaic/orchestrator/session.lock` +- Add Turbo DB env declarations for test execution and cache invalidation +- Run `pnpm format:check`, `pnpm typecheck`, and `pnpm lint` +- Review the diff, then commit/push/PR via provider-appropriate flow + +## Verification Log + +- `pnpm install` completed in this worktree so repo tooling is available +- `pnpm format:check` initially failed on `turbo.json`; fixed by formatting the file +- `pnpm format:check` passed after formatting +- `pnpm typecheck` passed +- `pnpm lint` passed +- Independent review flagged two important adjustments: + - keep `DEFAULT_DATABASE_URL` on `5433` because local Docker Compose maps host `5433 -> container 5432` + - prefer Turbo `env` over `passThroughEnv` so DB config changes also affect the test cache key + +## Risks + +- Existing mission/orchestrator files are dirty in the worktree and must be excluded from the scoped change. +- Local tests were not run because no Postgres service is available in this worktree; CI remains the primary situational validation for the test-task behavior. diff --git a/turbo.json b/turbo.json index 3d95141..cf8ef99 100644 --- a/turbo.json +++ b/turbo.json @@ -16,7 +16,8 @@ "test": { "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$"], - "outputs": ["coverage/**"] + "outputs": ["coverage/**"], + "env": ["DATABASE_URL", "DB_POOL_MAX", "DB_IDLE_TIMEOUT", "DB_CONNECT_TIMEOUT"] }, "dev": { "cache": false,