mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:41:09 +02:00
Closes the client_id-inflation bug where every localStorage wipe spun up a fresh sync identity. Five distinct client_ids accumulated in mana_sync.sync_changes for a single physical browser over five days — every wipe made the device's own historical writes look like "another session" on replay. Architecture: - New Dexie v54 table `_clientIdentity` (single row keyed by `id='self'`) is the canonical source of the client id. - `restoreClientIdFromDexie()` runs once at app boot, before `createUnifiedSync`. Reconciles Dexie ↔ localStorage in three scenarios: Dexie has it (restore localStorage), only localStorage has it (canonicalise into Dexie), neither has it (mint + write both). Dexie wins on disagreement. - `getOrCreateClientId()` keeps reading from localStorage synchronously — that's the hot path inside push/pull. The async reconciliation just makes sure localStorage has the right value by the time sync starts. Survives: clear-site-data, incognito flush, Settings → "delete browser cache". Does not survive: full IndexedDB reset (intentional — that's a real device reset). Plan: docs/plans/sync-field-meta-overhaul.md F6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| calc/packages/shared | ||
| calendar | ||
| cards | ||
| chat | ||
| citycorners | ||
| contacts | ||
| context | ||
| docs | ||
| food | ||
| guides | ||
| inventory | ||
| mana | ||
| manavoxel | ||
| memoro | ||
| moodlit | ||
| mukke | ||
| news | ||
| photos | ||
| picture | ||
| plants | ||
| presi | ||
| questions | ||
| quotes/packages/content | ||
| skilltree | ||
| storage | ||
| times | ||
| todo | ||
| traces | ||
| uload | ||