LifeMate — Personal, Family & Learning Companion
feat/standalone-weekly-planner
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
| 1 | // Explicitly synthetic fixture; not a registration/email-verification bypass. |
| 2 | // Never call this against a live database. Compose runbook uses local Docker. |
| 3 | import crypto from 'node:crypto'; |
| 4 | import argon2 from 'argon2'; |
| 5 | import pg from 'pg'; |
| 6 | if (process.env.ALLOW_SYNTHETIC_SEED !== 'yes') throw new Error('ALLOW_SYNTHETIC_SEED=yes is required'); |
| 7 | const password = process.env.SYNTHETIC_PASSWORD; |
| 8 | if (typeof password !== 'string' || password.length < 10) throw new Error('Provide a synthetic password of at least 10 characters'); |
| 9 | const pool = new pg.Pool(); |
| 10 | const client = await pool.connect(); |
| 11 | try { |
| 12 | await client.query('begin'); |
| 13 | const email = 'compose-smoke@lifeguide.test'; |
| 14 | const existing = await client.query('select id,identity_subject from app_user where email_normalized=$1 for update', [email]); |
| 15 | let id; |
| 16 | if (existing.rowCount) { |
| 17 | if (!existing.rows[0].identity_subject.startsWith('compose-synthetic:')) throw new Error('Refusing to replace an existing non-fixture account'); |
| 18 | id = existing.rows[0].id; |
| 19 | } else { |
| 20 | const user = await client.query('insert into app_user(identity_subject,email_normalized,email_verified_at) values($1,$2,now()) returning id', [`compose-synthetic:${crypto.randomUUID()}`, email]); |
| 21 | id = user.rows[0].id; |
| 22 | await client.query("insert into profile(user_id,display_name,theme_preference) values($1,'LifeGuide Synthetic Smoke','adult_blue')", [id]); |
| 23 | } |
| 24 | await client.query('insert into auth_credential(user_id,password_hash) values($1,$2) on conflict(user_id) do update set password_hash=excluded.password_hash', [id, await argon2.hash(password, { type: argon2.argon2id })]); |
| 25 | await client.query('commit'); |
| 26 | console.log('Synthetic local fixture ready: compose-smoke@lifeguide.test (password not logged)'); |
| 27 | } catch (error) { |
| 28 | await client.query('rollback'); |
| 29 | throw error; |
| 30 | } finally { |
| 31 | client.release(); |
| 32 | await pool.end(); |
| 33 | } |