diff --git a/.planning/phases/07-deploy-v1/07-VALIDATION.md b/.planning/phases/07-deploy-v1/07-VALIDATION.md new file mode 100644 index 0000000..3e6544f --- /dev/null +++ b/.planning/phases/07-deploy-v1/07-VALIDATION.md @@ -0,0 +1,84 @@ +--- +phase: 7 +slug: deploy-v1 +status: draft +nyquist_compliant: false +wave_0_complete: false +created: 2026-05-15 +--- + +# Phase 7 — Validation Strategy + +> Per-phase validation contract for feedback sampling during execution. + +--- + +## Test Infrastructure + +| Property | Value | +|----------|-------| +| **Framework** | go test | +| **Config file** | none — existing infrastructure | +| **Quick run command** | `cd backend && go test ./...` | +| **Full suite command** | `cd backend && go test ./... && docker build -f backend/Dockerfile -t xtablo:test . && docker inspect xtablo:test` | +| **Estimated runtime** | ~30 seconds (tests); ~3 minutes (full with Docker build) | + +--- + +## Sampling Rate + +- **After every task commit:** Run `cd backend && go test ./...` +- **After every plan wave:** Run full suite including docker build validation +- **Before `/gsd-verify-work`:** Full suite must be green +- **Max feedback latency:** 30 seconds + +--- + +## Per-Task Verification Map + +| Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status | +|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------| +| 7-01-01 | 01 | 0 | DEPLOY-04 | — | /healthz returns 200 with no DB; /readyz returns 503 when DB down | unit | `cd backend && go test ./internal/handlers/ -run TestHealthz` | ✅ | ⬜ pending | +| 7-01-02 | 01 | 0 | DEPLOY-01 | — | go:embed FS serves static assets correctly | unit | `cd backend && go test ./internal/static/` | ❌ W0 | ⬜ pending | +| 7-02-01 | 02 | 1 | DEPLOY-03 | — | goose.Up() runs migrations at startup without error | unit | `cd backend && go test ./cmd/web/ -run TestMigrations` | ❌ W0 | ⬜ pending | +| 7-03-01 | 03 | 2 | DEPLOY-01 | — | Docker image builds successfully with both binaries | manual | `docker build -f backend/Dockerfile -t xtablo:test . && docker run --rm xtablo:test /app/web --version` | ❌ W0 | ⬜ pending | +| 7-04-01 | 04 | 3 | DEPLOY-02 | — | docker-compose.prod.yaml starts all services without errors | manual | `docker compose -f backend/docker-compose.prod.yaml config` | ❌ W0 | ⬜ pending | +| 7-05-01 | 05 | 4 | DEPLOY-05 | — | README.md contains deploy, rollback, and incident sections | manual | `grep -c "## Deploy\|## Rollback\|## Incident" backend/README.md` | ✅ | ⬜ pending | + +*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky* + +--- + +## Wave 0 Requirements + +- [ ] Split `/healthz` into liveness-only (no DB ping) and create `/readyz` with DB ping — update `TestHealthz_OK` and `TestHealthz_Down` +- [ ] Create `backend/internal/assets/` package with `//go:embed` for static files +- [ ] Update `go.sum` with any new test dependencies + +*Existing go test infrastructure covers all phase requirements.* + +--- + +## Manual-Only Verifications + +| Behavior | Requirement | Why Manual | Test Instructions | +|----------|-------------|------------|-------------------| +| Docker image builds with templ generate | DEPLOY-01 | Requires Docker daemon; templ binary download in builder stage | `docker build -f backend/Dockerfile -t xtablo:test . --no-cache` — must complete without error | +| docker-compose.prod.yaml starts all services | DEPLOY-02 | Requires running Docker and Hetzner-like env setup | `docker compose -f backend/docker-compose.prod.yaml config` validates syntax; full start requires prod env vars | +| Caddy issues TLS cert and proxies to web | DEPLOY-02 | Requires real domain pointing to host; Let's Encrypt challenge | Manual: deploy to Hetzner VM, verify HTTPS works | +| goose.Up() runs migrations on prod startup | DEPLOY-03 | Requires live Postgres connection | Manual: check logs for "goose: migrating db" on first container start | +| /healthz returns 200 without DB | DEPLOY-04 | Unit test covers logic; integration requires deployed container | Manual: `curl https://your-domain.com/healthz` returns 200 | +| /readyz returns 503 when DB is down | DEPLOY-04 | Unit test covers logic; integration requires deployed container | Manual: stop postgres container, verify /readyz returns 503 | + +--- + +## Validation Sign-Off + +- [ ] All tasks have `` verify or Wave 0 dependencies +- [ ] Sampling continuity: no 3 consecutive tasks without automated verify +- [ ] Wave 0 covers all MISSING references +- [ ] No watch-mode flags +- [ ] Feedback latency < 30s +- [ ] `nyquist_compliant: true` set in frontmatter + +**Approval:** pending