@davoodmehraban89 / LifeMate / commits / d90d5e9
Fork 0

LifeMate — Personal, Family & Learning Companion

docs: add phase 5 implementation plan

davoodmehraban89 committed Oct 5, 2026 at 17:08 UTC d90d5e901cc69ab8c8a2aa3df2f4e2e39b582294
1 file changed +65
docs/superpowers/plans/2026-10-05-phase-5-hardening-release.md new
+65
@@ -0,0 +1,65 @@
1 +# Phase 5 Hardening & Release Implementation Plan
2 +
3 +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4 +
5 +**Goal:** Harden LifeMate operationally and make the existing Android/Web/PWA/API stack release-ready without performing a production release.
6 +
7 +**Architecture:** Preserve the current Flutter + Node/Express + PostgreSQL architecture. Add focused backend middleware, CI restore verification and operational documentation; keep production-sensitive AI/voice gates disabled.
8 +
9 +**Tech Stack:** Node 22, Express 5, PostgreSQL, Flutter, GitHub Actions, Railway staging.
10 +
11 +**Spec:** `docs/superpowers/specs/2026-10-05-phase-5-hardening-release-design.md`
12 +
13 +## Global Constraints
14 +- No production deploy/public release without explicit approval.
15 +- Never log secrets, auth headers, passwords, wellbeing notes or AI transcripts.
16 +- General rate limit default 120/min/IP; auth 10/10min/IP; AI 30/10min/identity-or-IP.
17 +- `/live` is process-only; `/ready` verifies database connectivity; `/health` remains compatible.
18 +- Existing Phase 1–4 behavior and tests must remain green.
19 +
20 +## Review Focus
21 +- Proxy/IP handling must not let a caller trivially bypass limits.
22 +- Rate limiting must not break test suites or CORS preflight.
23 +- Error logging must not serialize request bodies or credentials.
24 +- Readiness must return non-2xx when PostgreSQL is unavailable.
25 +- Backup/restore drill must prove data, not merely schema creation.
26 +
27 +---
28 +
29 +### Task 1: Backend hardening middleware
30 +**Files:** create `backend/src/operations.js`; create `backend/tests/operations.test.js`; modify `backend/src/server.js`; modify `backend/package.json`.
31 +**Produces:** request correlation, security headers, JSON telemetry, `/live`, `/ready`, and configurable rate limiting.
32 +- [ ] Add failing operations tests for headers/request ID/rate limits/readiness/log redaction.
33 +- [ ] Verify CI failure on tests before implementation.
34 +- [ ] Implement minimal operations middleware and wire it into server.
35 +- [ ] Run backend tests/check/audit to green.
36 +
37 +### Task 2: Backup/restore drill
38 +**Files:** create `backend/scripts/backup.sh`; create `backend/scripts/restore.sh`; create `backend/scripts/restore-smoke.sql`; modify `.github/workflows/ci.yml`.
39 +**Produces:** repeatable native PostgreSQL backup/restore commands and CI data round-trip gate.
40 +- [ ] Add CI restore-drill gate that fails until scripts exist.
41 +- [ ] Implement scripts and representative smoke data assertion.
42 +- [ ] Verify CI restore drill green.
43 +
44 +### Task 3: Release/incident operations documentation
45 +**Files:** create `docs/operations/DEPLOYMENT.md`, `ROLLBACK.md`, `BACKUP_RESTORE.md`, `INCIDENT_RESPONSE.md`, `PRODUCTION_CHECKLIST.md`; create `CHANGELOG.md`; modify `README.md` as needed.
46 +**Produces:** executable runbooks and release gates.
47 +- [ ] Add contract test asserting required runbooks and mandatory safety clauses.
48 +- [ ] Implement runbooks and changelog.
49 +- [ ] Verify contract test green.
50 +
51 +### Task 4: Cross-platform release regression gates
52 +**Files:** modify `.github/workflows/ci.yml`; add/modify Flutter tests only where needed.
53 +**Produces:** format/analyze/test + Web release + Android debug/release-safe build metadata + PWA manifest/accessibility smoke gates.
54 +- [ ] Add failing contract assertions for release metadata/PWA accessibility requirements.
55 +- [ ] Implement minimal manifest/index/release checks.
56 +- [ ] Verify Flutter/Web/Android CI green.
57 +
58 +### Task 5: Staging verification and project-state closeout
59 +**Files:** update `PROJECT_STATE.md`; update Phase 5 design/decision docs if rulings occur.
60 +**Produces:** verified staging evidence and accurate completion record.
61 +- [ ] Deploy only to staging using existing Railway services.
62 +- [ ] Verify migration/API `/live`, `/ready`, `/health` and logs.
63 +- [ ] Verify final branch CI completely green.
64 +- [ ] Record exact verification evidence in `PROJECT_STATE.md`.
65 +- [ ] Open PR for review; do not merge or deploy production without explicit approval.