LifeMate — Personal, Family & Learning Companion

feat/private-planner-series-api
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 3.28 KB

LifeGuide — family lifecycle

Local synthetic implementation only; no live privilege changes or migration. Family administration remains a current server-side membership capability. A profile category/theme is never a grant of family authority.

Administrators list raw-pending invitations with a masked recipient hint and current expiry status, then revoke with an explicit UUID/version mutation. No token, digest or full contact is returned by the list/revoke API. Existing one-time creation/link delivery is retained. Acceptance and lifecycle writes share the family row lock, and expiry/session are checked after waiting.

Role changes and atomic admin transfer require active accounts/membership and current admin authority. Version triggers cover legacy role/admin/end/rejoin and invitation updates. Every mutation uses an actor-scoped hash receipt; retries return current state rather than repeating changes. After transfer, an active former administrator can acknowledge only the exact previously accepted mutation; that does not allow a new privileged operation.

Transfer promotes the chosen active adult member and demotes the caller in one transaction, preserving an active administrator. Teen-role targets and people with a known under-18 birth date cannot become admins. Teen-to-adult role upgrades require a known adult birth date. Existing adult-role members with no birth date can receive explicit administrator transfer. Self-reported birth dates are not legal age verification; consent/age assurance remains a separate gate.

Incompatible guardian links are deactivated. A role change removes affected selected-member plan grants, which must be explicitly chosen again; restoring a role never restores those links or grants. Transfer revokes the old administrator's pending invitations so transferring back cannot revive old tokens. Archive, membership removal and existing last-administrator protection remain in place.

Acceptance uses the actual entrypoint and independent PostgreSQL checks for unauthorized/cross-family access, bounded projection/paging, CAS/retry/restart, minor/disabled/ended-member rejection, one surviving admin under races, guardian and selected-grant invalidation, and invite expiry/revocation while lock-blocked. Physical-device and live-server acceptance remain UNVERIFIED.

The lock order is family row, all participating accounts in UUID order, their editable profile rows in UUID order, then their memberships in UUID order. This also serializes reciprocal writes across different families without actor-first account deadlocks. The current age context is locked separately because profile editing does not acquire the account lock. At commit, the session row is held with FOR SHARE, then a separate statement checks current session and JWT expiry using fresh database time after any lock wait; a failed check rolls back writes, audit and mutation receipt together. No fixed sleep substitutes for a lock in the race tests; they observe the real wait graph through pg_blocking_pids.

Known under-18 birth dates also prevent obtaining administration through new family creation. Legacy family writes and invitation acceptance retain their existing APIs and receive the same final current-session gate in the root-owned server integration. Self-reported age remains an unverified legal/consent gate.