Summary
Local LoopWorks development assumes postgres://loopworks:loopworks@127.0.0.1:5432/loopworks, but the repo does not provide a first-class native Postgres bootstrap or diagnostic path. This repeatedly causes seed/browser-validation work to fall back to fixtures or fail with low-level connection errors.
RCA from issue #37 validation
.env.local does not set DATABASE_URL, so the app and seed script use the repo default from src/db/client.ts / scripts/seed-demo-data.ts.
- Native Postgres is installed through Postgres.app and was listening on
127.0.0.1:5432.
- Unsandboxed readiness check:
pg_isready -h 127.0.0.1 -p 5432 returned accepting connections.
- Default LoopWorks connection failed:
FATAL: role "loopworks" does not exist.
- Local catalog check showed
role_loopworks=false and db_loopworks=false.
- In sandboxed runs the same problem can appear as
ECONNREFUSED or Operation not permitted, which makes the root cause less obvious.
Impact
bun run db:seed:reset cannot seed a native local Postgres unless the developer manually creates the expected role/database.
bun run dev:fixture and bun run build log DB read failures and use fixture/unavailable fallbacks, which blocks seeded-DB browser evidence.
- The README says seed after database bootstrap, but there is no native macOS/Postgres.app bootstrap or doctor command in the repo.
Proposed scope
Add a local DB bootstrap/doctor path rather than expanding issue #37.
Acceptance criteria
- Document native macOS/Postgres.app setup for the default LoopWorks URL, including exact commands to create the
loopworks role/database and run migrations/seeding.
- Add a non-destructive
db:doctor or equivalent that checks server reachability, configured host, expected role, expected database, and migration readiness without printing secrets.
- Add an explicit local bootstrap command or documented manual commands for creating the default local role/database.
- Improve
bun run db:seed / bun run db:seed:reset failures so missing role, missing database, and server-unreachable cases print actionable next steps.
- Preserve ADR 0007 safety: no production writes, no non-loopback bootstrap/seed writes, and no secret leakage in logs.
- Add focused script tests for URL parsing, diagnostics, and failure-message behavior.
Notes
This is distinct from #70, which owns Neon/Vercel production and preview database wiring. This issue is for local native Postgres developer setup.
Summary
Local LoopWorks development assumes
postgres://loopworks:loopworks@127.0.0.1:5432/loopworks, but the repo does not provide a first-class native Postgres bootstrap or diagnostic path. This repeatedly causes seed/browser-validation work to fall back to fixtures or fail with low-level connection errors.RCA from issue #37 validation
.env.localdoes not setDATABASE_URL, so the app and seed script use the repo default fromsrc/db/client.ts/scripts/seed-demo-data.ts.127.0.0.1:5432.pg_isready -h 127.0.0.1 -p 5432returned accepting connections.FATAL: role "loopworks" does not exist.role_loopworks=falseanddb_loopworks=false.ECONNREFUSEDorOperation not permitted, which makes the root cause less obvious.Impact
bun run db:seed:resetcannot seed a native local Postgres unless the developer manually creates the expected role/database.bun run dev:fixtureandbun run buildlog DB read failures and use fixture/unavailable fallbacks, which blocks seeded-DB browser evidence.Proposed scope
Add a local DB bootstrap/doctor path rather than expanding issue #37.
Acceptance criteria
loopworksrole/database and run migrations/seeding.db:doctoror equivalent that checks server reachability, configured host, expected role, expected database, and migration readiness without printing secrets.bun run db:seed/bun run db:seed:resetfailures so missing role, missing database, and server-unreachable cases print actionable next steps.Notes
This is distinct from #70, which owns Neon/Vercel production and preview database wiring. This issue is for local native Postgres developer setup.