LifeMate — Personal, Family & Learning Companion

fix/lifeguide-qa-pages-env-deployment
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
md 65 lines 4 KB
Rendered Raw
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.