LifeMate — Personal, Family & Learning Companion

fix/lifeguide-pages-qa-base-preflight
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 128 lines 14.1 KB
Rendered Raw
1 # LifeGuide — Supabase Free isolated QA bootstrap (proposed / not deployed)
2
3 Status: **QA project DB provisioned; app integration not deployed**
4 Prepared: 2026-10-15
5 Repository: `davoodmehraban89/LifeMate`
6 QA preparation branch: `infra/lifeguide-supabase-qa`
7 Baseline: `fix/study-duration-display` (LifeGuide 0.7.1, source CI `d0b3446d736b67fdb4e0218282ad15f0e74fdb55`)
8
9 ## CURRENT VERIFIED RESULT — 2026-10-15
10
11 **Gate 0 / Gate 1: DONE.** User selected shared organization **DM Studio**. Connected Supabase verifies org `unrlckipyubhegrpqgei` on Free; `get_cost(project)` returned **$0/month** and the connector completed cost confirmation. Provider created **LifeGuide-QA** (`iqkrwxeprxvdiubdfcrb`) in Frankfurt on PostgreSQL17.11; status `ACTIVE_HEALTHY`. Existing `Finora ERP – Production` remains `ACTIVE_HEALTHY` and was not modified.
12
13 **Private database probe: DONE.** One `lifeguide_qa.setup_probe` synthetic row created/read, `public` app tables 0, anon/authenticated grants false, RLS enabled+forced. Migration `20261014210221_lifeguide_qa_isolated_connectivity_baseline`, mirrored in source. INFO advisor `rls_enabled_no_policy` expected: no access is deliberately allowed to this probe.
14
15 **Edge runtime probe: DONE.** `lifeguide-qa-health` v1 deployed with `verify_jwt=true`; unauthenticated external GET **401**. Authenticated GET, real family account and permission checks, app API, Android/PWA, Iran no-VPN **NOT DONE**.
16
17 **Next milestone:** review managed Postgres roles against the 20 existing application migrations and decide how to host/adapt the Node/Express+native Argon2/JWT server. Do NOT run original db-role scripts unreviewed, do NOT enable client-direct access to old app tables or configure Flutter with the raw project URL. Only synthetic user data when implementing the small task/report flow.
18
19 **Authoritative receipt:** [2026-10-15 Supabase QA provisioning](../audits/2026-10-15-supabase-qa-provisioning.md).
20
21 The previous organization-creation instructions, pending statuses and first plan below are **historical**, superseded by the actual shared DM Studio choice and successful QA provisioning. They must not be re-executed.
22
23 ## Objective and non-negotiables
24
25 Proof of an **online synthetic-data-only** vertical slice for one child and two authorized parents: Android/API create task → PostgreSQL persistence → authorized parent reads from PWA → study duration appears → closed-and-reopened sessions preserve data. A green Web/APK build or accessible public health URL alone is **not** proof.
26
27 - A new Supabase **organization named LifeGuide**, explicitly chosen by the owner, is separate from existing `Finora` organization.
28 - A new project **LifeGuide-QA** must be created only if the Supabase cost confirmation says **$0** and the account has a free project slot. Supabase Free's project limit is **account-wide across organizations**; inactive/paused project eligibility is to be verified with Supabase, not assumed.
29 - Existing `Finora`, `EasyFactor`, Railway, Neon, domains, and LiveGuide `main` are **out of scope**. No changes to them.
30 - Only synthetic accounts/records. No personal, educational, child health, real identity, production export, live DNS, or payment card information.
31 - The existing application uses Node/Express + native Argon2 + PostgreSQL. **Supabase provides managed Postgres/Auth/Edge Functions, not a drop-in always-on Express host**; do not switch Flutter URLs to Supabase until an API adapter is verified.
32 - The prior hosting decision `docs/decisions/0009-provider-neutral-hosting.md` remains the production baseline. This investigation proposes only a **QA exception**; it does not approve any production migration.
33 - No `service_role`, `secret`, Postgres password, JWT secret, API master key or signing key in Flutter, PWA, a public GitHub branch, comments, screenshots or chat. Supabase publishable/anon keys alone are not authorization.
34
35 ## Updated owner direction — DM Studio shared organization, 2026-10-15
36
37 **This section supersedes the earlier requirement to create a second independent LifeGuide organization.** Owner confirmed the original Finora organization was renamed `LifeGuide`; the matching organization ID is expected and is not evidence of two organizations. Owner now authorizes renaming **only its display name** to the general-purpose **`DM Studio`**, with independent application projects (LifeGuide, Finora, EasyFactor, future projects). The connected Supabase tool **cannot rename an organization**, so this remains **PENDING** owner action in the dashboard.
38
39 After the owner renames it, verify its name and original ID via `list_organizations`/`get_organization`. Do not treat this display-name change as new organization creation, do not rename org slug or modify existing projects, do not restore/delete unrelated resources. Note the Free tier's **two active projects across owned organizations** limit remains.
40
41 The earlier Gate 0's independent-organization creation instructions and same-ID warning are now historical, not current action items. **Current Gate 0:** rename the existing organization's display name to DM Studio; verify the same ID. **Current Gate 1:** verify zero dollar recurring project cost, account-wide capacity and unrelated project state; ask for the required cost confirmation before creating `LifeGuide-QA`. All subsequent synthetic-data-only security/compatibility gates still apply.
42
43 ## Provider re-check — 2026-10-15 (BLOCKED: organization identity ambiguity)
44
45 Read-only Supabase checks completed:
46 - `list_organizations` returned exactly one visible organization named `LifeGuide` with ID `kpbskbvjspggwzmgqyze`; `get_organization` confirmed **Free**.
47 - `get_cost(type=project, organization_id=kpbskbvjspggwzmgqyze)` returned **amount: 0; recurrence: monthly**. This is not proof that a separate organization/free slot is available.
48 - **Critical identity mismatch:** `kpbskbvjspggwzmgqyze` is the *same* organization ID previously observed as `Finora` (before owner action). Name alone does not establish independence; it may be a rename or an integration visibility issue.
49 - Current `list_projects` returned an empty list. Direct reads of previously visible `Finora`/`EasyFactor` project IDs returned **permission denied**. The projects' deletion, transfer or state must **not** be inferred from this result.
50 - **STOP before `confirm_cost` / `create_project`**. Ask the owner to confirm that **both Finora and LifeGuide are simultaneously visible as separate organizations** in the Supabase dashboard; request new LifeGuide organization ID/slug (non-secret) if it differs. Recheck with the connected account before proceeding.
51 - No database/project creation, schema write, migration, public deployment, payment or access change performed.
52
53 ## Actual inventory at preparation time (not deployment)
54
55 - Supabase connector can list organizations/projects and create projects, but **cannot create organizations**.
56 - Existing organization `Finora` is on Supabase Free. Its projects `EasyFactor` (ACTIVE_HEALTHY) and `Finora` (INACTIVE) are unrelated. **Neither may be reused**.
57 - No independent `LifeGuide` organization or QA project has been created at the time of this document.
58 - The repo head is in stacked draft PRs #10 → #11 → #12 → #13. PR #13 includes 0.7.1 exact study-duration display. Do not modify their branches or merge them as part of this QA preflight.
59 - Prior CI `38223988983` passed Flutter/Backend/Security and built debug APK and web; **not** proof of internet deployment or physical Safari/Android behavior.
60 - Supabase Free can automatically pause a project after a period of insufficient activity, and has finite quota. There is no guaranteed perpetual availability or guaranteed Iran reachability.
61
62 ## Gate 0 — owner action: create independent organization (not automatable with connected Supabase tool)
63
64 1. In a private browser, sign into the existing account at https://supabase.com/dashboard.
65 2. Open the **organization switcher** and select **New organization** (UI wording may vary).
66 3. Name: **LifeGuide**. Choose **Free** (never Pro, trial with payment card, add-ons, paid compute, or paid branching).
67 4. Complete organization setup **without** adding a payment card. Do not create an application project yet.
68 5. Return only the organization name, preferably its organization ID/slug (this is not a secret). **Never send login codes, access tokens, passwords or billing details**.
69
70 Acceptance: `list_organizations` returns **LifeGuide** alongside **Finora** with a distinct ID. `get_organization` confirms Free plan.
71
72 ## Gate 1 — cost and capacity before project creation
73
74 - Call Supabase `get_cost({type:"project",organization_id:<LIFEGUIDE_ORG_ID>})`; disclose the returned price and recurrence verbatim. If nonzero, **STOP**.
75 - Check organization plan and the account-wide two-free-active-project limit. Existing inactive state is not enough alone to establish an empty slot.
76 - Ask owner to approve the **exact result of the $0 cost check** in the product's confirmation flow (`confirm_cost`), then create `LifeGuide-QA` in a region appropriate to the testing need and supported by the provider, preferably EU Central if available.
77 - No automatic premium upgrade, no subscription conversion, no card entry, no resource purchases. If creation is denied, stop and propose a safe alternative.
78
79 Acceptance: independent Supabase project ID and project status healthy, price explicitly $0, no unrelated projects changed.
80
81 ## Gate 2 — read-only compatibility audit before any migration
82
83 Record a scoped technical assessment, not an assumed 'lift and shift':
84
85 1. Enumerate the 0.7.1 Postgres migrations, `pgcrypto` and DB privilege requirements, `public` schema ownership, `SECURITY DEFINER`, policy assumptions, and special roles from `docs/operations/DATABASE_ROLES.md`.
86 2. Check supported Supabase PG version/extensions and database resource constraints. Existing provisioning scripts require role/ownership assumptions that may be **incompatible with managed Supabase**; **never run full Compose provisioning scripts against Supabase unchanged**.
87 3. Check the backend runtime: Express/Node, Argon2 native dependency, JWT/session revocation, consent and guardian permissions, report SQL, idempotent mutation receipts, offline sync. Supabase Edge Functions run in a different runtime; reusing Express and native Argon2 without proving compatibility is not accepted.
88 4. Compare two safe options: (A) Supabase managed Postgres behind an independently-hosted compatible API; (B) a new limited Supabase Edge Function adapter retaining authorization semantics. Neither option may expose unrestricted tables to the client.
89 5. Check PWA static hosting separately; Supabase database is **not** itself a replacement for a PWA site host. Existing `config.json` / `/api` same-origin convention must be adapted and tested rather than faked.
90
91 Deliverable: migration compatibility table and chosen **smallest reversible QA spike**. No user data migration.
92
93 ## Gate 3 — minimal synthetic vertical slice (after Gates 0–2)
94
95 - Fresh QA-only schema with migrations fully reviewed, reversible, and idempotent; synthetic UUID child/mother/father identities and an explicitly authorized family relationship.
96 - Enforce **server-side access** at every read and write. If Supabase Data API is used, enable RLS and write restrictive policies and negative-role tests first; never depend only on Flutter hiding UI.
97 - Use Edge Functions or a verified server-side adapter for account/session semantics as needed. **Do not introduce a second incompatible production identity system silently.**
98 - Task create/read/update/archive with stable mutation ID, version, owner ID, ACK/conflict and repeat-safe behavior; time intervals and accurate duration; authorized parent summary with freshness timestamp.
99 - Synthetic end-to-end checks: child writes task → SQL independent verification → authorized mother reads → authorized father reads → outsider 403/no data → duration 4 seconds displayed as 4 seconds → persisted on reopen → safe offline resend no duplicate.
100 - PWA served on HTTPS; browser reload and auth tested; mobile Safari/A2HS and actual Android install/upgrade require separate owner-device acceptance, not desktop inference.
101 - Test reachability from Iran **without VPN** before asserting real usability, and check legal/terms restrictions. Avoid claims of guaranteed availability.
102
103 ## Exit gates and safety
104
105 - Gate A: $0 organization/project verified in the Supabase account.
106 - Gate B: Isolated DB and permission test pass; no tables in another project touched.
107 - Gate C: API+Postgres persistence from a synthetic account passes create/reopen/edit/read/archive, including unauthorized denial.
108 - Gate D: PWA installed in actual iPhone Safari and Android installed on actual device, both using same QA API; unverified tests remain marked unverified.
109 - Gate E: Backups/export and recovery proof with **synthetic** data, plus a safe teardown plan for QA-only resources (no teardown without approval).
110 - Gate F: Release/migration approval is separate. Do not merge stacked production PRs, change existing DNS, change signing, import real children records, or activate public rollout based only on this PoC.
111
112 ## Execution ledger (current)
113
114 | Item | Verified outcome |
115 | --- | --- |
116 | DM Studio Free org `unrlckipyubhegrpqgei` | **PASS** |
117 | Exact project creation charge `$0/month`, user/provider confirmation | **PASS** |
118 | LifeGuide-QA `iqkrwxeprxvdiubdfcrb` in Frankfurt | **ACTIVE_HEALTHY** |
119 | Isolation from Finora ERP – Production | **NO WRITES** to existing project; existing status remains healthy |
120 | Supabase PostgreSQL17.11, `pgcrypto` present | **PASS** |
121 | Private `lifeguide_qa` migration, synthetic insert/read, anon/auth denied | **PASS** |
122 | Supabase JWT-gated Edge runtime `lifeguide-qa-health` | **ACTIVE**, unauthenticated GET **401** |
123 | Existing LifeGuide 20 application SQL migrations in Supabase | **NOT RUN**; compatibility gate |
124 | Real shared family API, RLS/guardian negative tests | **NOT RUN** |
125 | PWA/Android, Safari, Iran no VPN, backup restore | **UNVERIFIED** |
126 | Production DNS, real data, original projects, billing | **UNCHANGED** |
127
128 See [actual evidence](../audits/2026-10-15-supabase-qa-provisioning.md). No further owner action necessary for the completed provisioning step. Next code/data changes must retain distinct QA-only scope and pass compatibility/security checks.