From 9d83b2fb6221bb7312097c00604070defa2f0611 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sun, 27 Sep 2026 05:14:04 +0200 Subject: [PATCH] fix: stop warning about shared accounts that share only mail #34 434c554 left an account that refuses to list its address books or calendars out of the run, but reported it as an item error. The sync settings then said "1 item could not be synced" after every run for an account that merely shares a mailbox: nothing the user can fix, and no item behind it. Such an account is now only logged. Checked: the engine tests, `npm run typecheck` and `npm test` on this commit, and the sync settings of usera on the API 32 emulator after a new run. --- src/device-sync/__tests__/engine/failures.test.ts | 4 ++-- src/device-sync/engine/item-sync.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device-sync/__tests__/engine/failures.test.ts b/src/device-sync/__tests__/engine/failures.test.ts index efa05ce6..af4903cc 100644 --- a/src/device-sync/__tests__/engine/failures.test.ts +++ b/src/device-sync/__tests__/engine/failures.test.ts @@ -621,7 +621,7 @@ describe('device sync engine: accounts that refuse access', () => { const report = await h.run(); expect(report.outcome).toBe('ok'); - expect(report.itemErrors).toEqual([expect.objectContaining({ ref: 'team', side: 'download', type: 'forbidden' })]); + expect(report.itemErrors).toEqual([]); expect(h.contactNamed('Ada')).toBeDefined(); }); @@ -665,7 +665,7 @@ describe('device sync engine: accounts that refuse access', () => { const report = await h.run(CALENDAR_AUTHORITY); expect(report.outcome).toBe('ok'); - expect(report.itemErrors).toEqual([expect.objectContaining({ ref: 'team', type: 'forbidden' })]); + expect(report.itemErrors).toEqual([]); expect(h.events()).toHaveLength(1); expect(h.device.rows('calendars').some((c) => c._sync_id === `team/${teamCalendar}`)).toBe(true); }); diff --git a/src/device-sync/engine/item-sync.ts b/src/device-sync/engine/item-sync.ts index 942e1204..e4c96911 100644 --- a/src/device-sync/engine/item-sync.ts +++ b/src/device-sync/engine/item-sync.ts @@ -189,9 +189,10 @@ export abstract class ItemSync { * One account's collections, or null when the account refuses to list them * (`forbidden`, `accountNotFound`, `accountNotSupportedByMethod`): Stalwart * lists an account shared for mail only with every capability, and access - * can go away. Such an account is left out of the run and reported; the - * rows written for it stay as they are, since a refusal can pass and must - * not drop anything from the device. + * can go away. Such an account is left out of the run, and not reported + * as a problem: for a mail-only share there is nothing to fix, and the + * warning would never go away. The rows written for it stay as they are, + * since a refusal can pass and must not drop anything from the device. */ protected async containersOf( type: 'AddressBook' | 'Calendar', @@ -203,7 +204,6 @@ export abstract class ItemSync { } catch (error) { if (!isMethodError(error) || !ACCOUNT_UNREADABLE.has(error.type)) throw error; this.unreadable.add(accountId); - this.env.report.itemError({ ref: accountId, side: 'download', type: error.type, description: error.message }); this.env.log(`account ${accountId} left out: ${error.type}`); return null; }