mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 01:01:09 +02:00
Closes the userContext race-on-first-mount that surfaced as a "10 fields overwritten" conflict toast pre-F2. Adds a fire-and-forget hook in the /register flow that writes the per-user `userContext` singleton straight into `mana_sync.sync_changes` with `client_id='system:bootstrap'` and `origin='system'`. Behavior: - On successful `signUpEmail`, `bootstrapUserSingletons(userId, syncSql)` inserts a `profile/userContext` row with the empty-default shape that mirrors the webapp's `emptyUserContext()` factory in `apps/mana/apps/web/src/lib/modules/profile/types.ts`. - The receiving client treats the change as origin='server-replay' on apply (per F2 conflict-gate), so no toasts on first pull. - Failure is logged but does not abort registration — the webapp's existing `ensureDoc()` fallback still works during the F4→F5 transition. Module-scoped postgres pool (max=2 connections) lazy-initialized on first signUp; reused for the lifetime of the process. Same pattern as `UserDataService.getSyncSql`. Out of scope for F4: - `kontextDoc` is per-Space (not per-user) — bootstrap there will be hooked into the Space-creation flow, not /register. The webapp's `ensureDoc()` for kontextDoc stays as-is for now. - Webapp `ensureDoc()` removal is F5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| mana-ai | ||
| mana-analytics | ||
| mana-api-gateway | ||
| mana-auth | ||
| mana-crawler | ||
| mana-credits | ||
| mana-events | ||
| mana-geocoding | ||
| mana-image-gen | ||
| mana-landing-builder | ||
| mana-llm | ||
| mana-mail | ||
| mana-mcp | ||
| mana-media | ||
| mana-notify | ||
| mana-persona-runner | ||
| mana-research | ||
| mana-search | ||
| mana-stt | ||
| mana-subscriptions | ||
| mana-sync | ||
| mana-tts | ||
| mana-user | ||
| mana-video-gen | ||
| mana-voice-bot | ||
| news-ingester | ||