fix(atlas): reconcile offline country and region changes together

Keep country and region reads in step with queued writes and with the mark source held by the server. Reconcile a delete already applied elsewhere before removing it from the account queue.
This commit is contained in:
Maurice
2026-12-06 17:20:49 +01:00
parent da0ecc3f88
commit e3922b76d8
13 changed files with 328 additions and 110 deletions
@@ -90,6 +90,7 @@ describe('VisitedCountriesRepository: countries that came in through a region (#
expect((await findRow(t, VisitedCountries, { user: user.id, country_code: 'NO' }))?.source).toBe('region');
expect(await repo.findSource(user.id, 'NO')).toEqual({ source: 'manual' });
expect(await repo.listMarksForUser(user.id)).toEqual([{ country_code: 'NO', source: 'region' }]);
expect((await repo.listForUser(user.id)).map((r) => r.source)).toEqual(['manual']);
expect(await repo.hasOwnMark(user.id, 'NO')).toBe(false);
});