docs: ADR-011 Postgres-only server state — drop Redis, M2 Postgres-hardening slice (dev plan v1.8) #121

Merged
amiryahaya merged 1 commit from docs/adr-011-postgres-state into main 2026-11-08 13:47:21 +01:00
Owner

Adopts the Postgres-only decision into the spec package (discussion 2026-11-08, umbrella tracker #120):

  • ADR-011 (02-architecture.md): every piece of transient server state — sessions, OTP codes/attempts, cross-process locks, failure budgets — lives in PostgreSQL; Redis is dropped. Atomicity is native (the #89 race exists because IDistributedCache cannot check-and-consume atomically; Postgres does it in one UPDATE…RETURNING), cross-process locks are pg_advisory_xact_lock, one stateful store shrinks the ZK audit surface, and pre-launch scale doesn't justify a second store. Revisit triggers recorded in the ADR (multi-instance under load / measured session-lookup pressure / SSE fanout beyond LISTEN-NOTIFY).
  • New §17: state-by-state Postgres shapes (OTP, sessions, invite locks, TOTP guard, M2M budget), why this beats hardening Redis, migration order (4 slices).
  • Dev plan → v1.8.0-draft: Phase 2 gains task 2.9 (Postgres-hardening slice); M2 milestone row updated; changelog notes the re-scope.
  • SRS: IDA-01 session-store clause updated (session store per ADR-011: PostgreSQL).
  • Infra diagram: Redis node removed.
  • Tracker: #89 re-scoped (fix shape = atomic UPDATE…RETURNING; the non-atomic production path ceases to exist rather than being patched); umbrella #120 (milestone M2) tracks the 4-slice delivery.

Docs-only change — api-ci's paths filter does not include docs/, so no CI runs trigger on this PR (verified empty run list before merge).

Adopts the Postgres-only decision into the spec package (discussion 2026-11-08, umbrella tracker #120): - **ADR-011** (02-architecture.md): every piece of transient server state — sessions, OTP codes/attempts, cross-process locks, failure budgets — lives in PostgreSQL; Redis is dropped. Atomicity is native (the #89 race exists because IDistributedCache cannot check-and-consume atomically; Postgres does it in one UPDATE…RETURNING), cross-process locks are pg_advisory_xact_lock, one stateful store shrinks the ZK audit surface, and pre-launch scale doesn't justify a second store. Revisit triggers recorded in the ADR (multi-instance under load / measured session-lookup pressure / SSE fanout beyond LISTEN-NOTIFY). - New **§17**: state-by-state Postgres shapes (OTP, sessions, invite locks, TOTP guard, M2M budget), why this beats hardening Redis, migration order (4 slices). - **Dev plan → v1.8.0-draft**: Phase 2 gains **task 2.9** (Postgres-hardening slice); M2 milestone row updated; changelog notes the re-scope. - **SRS**: IDA-01 session-store clause updated (session store per ADR-011: PostgreSQL). - **Infra diagram**: Redis node removed. - Tracker: **#89 re-scoped** (fix shape = atomic UPDATE…RETURNING; the non-atomic production path ceases to exist rather than being patched); umbrella **#120** (milestone M2) tracks the 4-slice delivery. Docs-only change — api-ci's paths filter does not include docs/, so no CI runs trigger on this PR (verified empty run list before merge).
docs: ADR-011 — Postgres-only server state, drop Redis; dev plan v1.8 task 2.9
All checks were successful
Security CI / security-scan (pull_request) Successful in 3m42s
86f8f3ae2d
Adopted into M2 scope per discussion 2026-11-08:
- 02-architecture.md: ADR-011 entry + new §17 (state-by-state Postgres
  shapes, why it beats hardening Redis, revisit triggers, migration
  order); infra diagram loses the Redis node; §4.3 session model now
  Postgres-backed per ADR-011
- 04-development-plan.md: v1.8.0-draft — Phase 2 gains task 2.9
  (Postgres-hardening slice: PostgresOtpStore atomic consume closing #89
  by deletion, PostgresSessionStore, advisory locks + guard/budget rows,
  compose/health cleanup); M2 milestone row updated
- 01-srs.md: IDA-01 session-store clause points at ADR-011

Tracker: #89 re-scoped (fix = atomic UPDATE…RETURNING, not INCR/Lua);
umbrella issue #120 (milestone M2) tracks the 4-slice delivery.
Sign in to join this conversation.
No description provided.