@davoodmehraban89 / LifeMate / commits / 4cc6eac
Fork 0

LifeMate — Personal, Family & Learning Companion

docs: prepare isolated no-cost Supabase QA bootstrap gates

davoodmehraban89 committed Oct 15, 2026 at 00:03 UTC 4cc6eac183fdcf61ec80d4b092f620e04388ae6d
1 file changed +92
docs/operations/SUPABASE_QA_BOOTSTRAP.md new
+92
@@ -0,0 +1,92 @@
1 +# LifeGuide — Supabase Free isolated QA bootstrap (proposed / not deployed)
2 +
3 +Status: **PREPARATION ONLY — blocked on independent organization creation and cost check**
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 +## Objective and non-negotiables
10 +
11 +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.
12 +
13 +- A new Supabase **organization named LifeGuide**, explicitly chosen by the owner, is separate from existing `Finora` organization.
14 +- 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.
15 +- Existing `Finora`, `EasyFactor`, Railway, Neon, domains, and LiveGuide `main` are **out of scope**. No changes to them.
16 +- Only synthetic accounts/records. No personal, educational, child health, real identity, production export, live DNS, or payment card information.
17 +- 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.
18 +- 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.
19 +- 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.
20 +
21 +## Actual inventory at preparation time (not deployment)
22 +
23 +- Supabase connector can list organizations/projects and create projects, but **cannot create organizations**.
24 +- Existing organization `Finora` is on Supabase Free. Its projects `EasyFactor` (ACTIVE_HEALTHY) and `Finora` (INACTIVE) are unrelated. **Neither may be reused**.
25 +- No independent `LifeGuide` organization or QA project has been created at the time of this document.
26 +- 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.
27 +- Prior CI `38223988983` passed Flutter/Backend/Security and built debug APK and web; **not** proof of internet deployment or physical Safari/Android behavior.
28 +- 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.
29 +
30 +## Gate 0 — owner action: create independent organization (not automatable with connected Supabase tool)
31 +
32 +1. In a private browser, sign into the existing account at https://supabase.com/dashboard.
33 +2. Open the **organization switcher** and select **New organization** (UI wording may vary).
34 +3. Name: **LifeGuide**. Choose **Free** (never Pro, trial with payment card, add-ons, paid compute, or paid branching).
35 +4. Complete organization setup **without** adding a payment card. Do not create an application project yet.
36 +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**.
37 +
38 +Acceptance: `list_organizations` returns **LifeGuide** alongside **Finora** with a distinct ID. `get_organization` confirms Free plan.
39 +
40 +## Gate 1 — cost and capacity before project creation
41 +
42 +- Call Supabase `get_cost({type:"project",organization_id:<LIFEGUIDE_ORG_ID>})`; disclose the returned price and recurrence verbatim. If nonzero, **STOP**.
43 +- Check organization plan and the account-wide two-free-active-project limit. Existing inactive state is not enough alone to establish an empty slot.
44 +- 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.
45 +- No automatic premium upgrade, no subscription conversion, no card entry, no resource purchases. If creation is denied, stop and propose a safe alternative.
46 +
47 +Acceptance: independent Supabase project ID and project status healthy, price explicitly $0, no unrelated projects changed.
48 +
49 +## Gate 2 — read-only compatibility audit before any migration
50 +
51 +Record a scoped technical assessment, not an assumed 'lift and shift':
52 +
53 +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`.
54 +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**.
55 +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.
56 +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.
57 +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.
58 +
59 +Deliverable: migration compatibility table and chosen **smallest reversible QA spike**. No user data migration.
60 +
61 +## Gate 3 — minimal synthetic vertical slice (after Gates 0–2)
62 +
63 +- Fresh QA-only schema with migrations fully reviewed, reversible, and idempotent; synthetic UUID child/mother/father identities and an explicitly authorized family relationship.
64 +- 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.
65 +- 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.**
66 +- 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.
67 +- 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.
68 +- 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.
69 +- Test reachability from Iran **without VPN** before asserting real usability, and check legal/terms restrictions. Avoid claims of guaranteed availability.
70 +
71 +## Exit gates and safety
72 +
73 +- Gate A: $0 organization/project verified in the Supabase account.
74 +- Gate B: Isolated DB and permission test pass; no tables in another project touched.
75 +- Gate C: API+Postgres persistence from a synthetic account passes create/reopen/edit/read/archive, including unauthorized denial.
76 +- Gate D: PWA installed in actual iPhone Safari and Android installed on actual device, both using same QA API; unverified tests remain marked unverified.
77 +- Gate E: Backups/export and recovery proof with **synthetic** data, plus a safe teardown plan for QA-only resources (no teardown without approval).
78 +- 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.
79 +
80 +## Execution ledger
81 +
82 +| Item | State | Evidence |
83 +| --- | --- | --- |
84 +| Current Supabase organization/project inventory | **DONE — read-only** | Existing Finora organization and EasyFactor/Finora projects inspected via connected Supabase tool |
85 +| Isolated QA branch prepared | **DONE** | `infra/lifeguide-supabase-qa` forked from `fix/study-duration-display` |
86 +| Independent LifeGuide Supabase organization | **BLOCKED — owner dashboard action** | No create-organization action is exposed by connected Supabase tool |
87 +| Exact $0 price / active-project capacity | **NOT RUN — requires new org ID** | Call `get_cost` against LifeGuide after Gate 0 |
88 +| Supabase LifeGuide-QA project | **NOT CREATED** | Must pass cost/capacity approval |
89 +| API migration / SQL applied / Edge Functions / PWA deployed | **NOT RUN** | Must pass all gates |
90 +| Real Android, iOS Safari, Iran no-VPN | **UNVERIFIED** | Requires real-device/network testing |
91 +
92 +Next step: Owner creates **Free LifeGuide organization only**, sends its non-secret ID. Continue cost check and isolated project provisioning without touching Finora/EasyFactor.