Reusing the backup snapshot for sync had two bugs that would bite real use: 1. Deletions didn't propagate. exportInventory() filters isDeleted=false (user backups are tombstone-free by design) and the JSON codec dropped isDeleted (omitted on encode, hardcoded false on decode) — so deleting a variety on one device never reached the others. Now the codec round-trips isDeleted (emitted only when true, so backups stay byte-identical and it's backward compatible), and a new exportForSync() includes tombstones. The importer already merges them LWW-correctly. 2. Photos bloated events. The snapshot embeds photo bytes as base64, so a real inventory would blow past relay event-size limits and sync would silently fail. exportForSync() omits attachments entirely (photos stay device-local; media sync is a separate, deferred concern). buildSnapshot() now uses exportForSync(); backups keep using exportInventory (photos in, tombstones out) unchanged. Tests: a deletion replicates as a tombstone; the sync snapshot carries no photo bytes while a sealed backup still does. |
||
|---|---|---|
| .. | ||
| data | ||
| db | ||
| domain | ||
| i18n | ||
| security | ||
| services | ||
| state | ||
| support | ||
| tool | ||
| ui | ||
| flutter_test_config.dart | ||