- newTestApp now sets cfg.Runtime.Env='test', which allows memory mode
- Ready endpoint test now goes through the full router (not direct handler)
- All integration health tests pass; full suite 23/23 PASS
- Doc updates: P0 execution board (evidence + TL-P0-1/TL-P0-2 status), QA gate (TL-P0-1/TL-P0-2 completed), production checklist (Gate B requirements)
1. config.go: AI_CS_ENV runtime mode with production restriction
- New RuntimeConfig.Env field (AI_CS_ENV / AI_CS_RUNTIME_ENV)
- production + Postgres.Enabled=false → Load() returns error
- production + empty webhook secret → Load() returns error
- normalizeRuntimeEnv: dev/dev/ → development, prod/production → production, test → test
2. app.go: probe.SetReady only when store is confirmed ready
- Postgres.Enabled: probe.SetReady(true) after DB+migration OK
- Memory mode: probe.SetReady(false) — not production-ready
3. health_handler_test.go: add probe live+ready state transition tests
4. config_test.go: add TestLoad_RejectsProdWhenPostgresDisabled,
TestLoad_RejectsProdWhenWebhookSecretMissing
5. app_test.go: add TestNew_RejectsMemoryModeWithoutExplicitNonProdEnv,
TestNew_AllowsMemoryModeInTestEnv, TestNew_WithPostgresEnabled_*
for invalid DSN and migration-failure paths
Phase 1 (code gate) objectives met:
✅ prod cannot fall back to memory store
✅ readiness reflects actual store readiness
✅ both changes have test coverage