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.
This commit is contained in:
Linus Rath
2026-09-27 05:14:04 +02:00
parent ad0f83c72f
commit 9d83b2fb62
2 changed files with 6 additions and 6 deletions
@@ -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);
});
+4 -4
View File
@@ -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<T>(
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;
}