Lesson 8: Sync & Accounts
Goal of this lesson
Explain guest vs. account use, the outbox pattern, how conflicts are detected, and exactly what syncs.
Guest vs. account
| Guest | Signed-in account | |
|---|---|---|
| Identity | local_guest_user on this phone | Cloud account (backend, Neon) |
| Planner, alarms, reminder calls | ✅ | ✅ |
| Offline voice, local Ask USTP | ✅ | ✅ |
| Sync across phone and PC | ❌ | ✅ |
| Online AI, online voice, documents | ❌ | ✅ (Online Mode, subject to account access and limits) |
Upgrading: when a guest signs in or registers, their tasks, notes, schedule, and chats are carried over to the account once, without duplicates.
The outbox pattern
Why one transaction?
If the record were saved but the outbox entry wasn’t (for example, if the app crashed in between), that change would never sync. Writing both together means either both happen or neither does. This is called the transactional outbox pattern.
Versions and conflicts
Each synced record has a version. A local change remembers the base version it was edited from.
Nothing is silently overwritten. The conflict stores the local payload, base version, server version, and server payload.
What syncs and what doesn’t
| Syncs (7 entity types) | Stays on the device |
|---|---|
| profile | Alarm clocks |
| tasks | Floating LAFINA settings and most local settings |
| events | Downloaded models, recordings, attachments |
| time blocks | Delivery jobs and history |
| reminders | Handbook index |
| notes | |
| custom categories |
Chats sync separately through chat history sync, up to 20 chats per account.
Sync is not a full backup
Clearing app data or uninstalling removes device-only content such as alarms and recordings. Sign Out and Clear All Data remove local leftovers thoroughly.
Check yourself
- What can a guest do, and what can’t they do?
- Explain the transactional outbox in one sentence. What problem does it prevent?
- How is a conflict detected, and what is stored when it happens?
- Name the 7 sync entity types. Name 3 things that never sync.