Remember the folder's UIDVALIDITY and the last UID read, once the core keeps a sync's state #34

Open
opened 2026-10-31 03:04:36 +00:00 by tiagoagueda · 0 comments
Owner

In the modes that do not flag messages (the mailbox left untouched, or a folder that keeps no keywords), every message the rules did not recognise is downloaded again on every pass, within the look-back.

What would change

  • Remember {folder, uidvalidity, last_uid} in the per-connection state the core issue adds.
  • At the next pass, if the folder and UIDVALIDITY match, search UID <last_uid+1>:* SINCE <date> and drop any UID not above last_uid from the answer (RFC 3501 6.4.8: n:* always includes the highest UID, even below n). If UIDVALIDITY changed, read the look-back as today.
  • Record last_uid only for batches read to the end, so a pass cut short resumes where it stopped. The keyword mode is unchanged.
  • The test double gains UIDVALIDITY/UIDNEXT in its SELECT answer and a UID range in search.
  • README: lengthening the look-back no longer reaches back for mail already passed over; a changed days resets the state (the core drops it when the configuration is edited).

CONDSTORE/QRESYNC (RFC 7162) is not needed: the plugin never revisits a message.

Accessibility

None.

The whole finding, with its measurements and decisions, is postulo/postulo#1165.


Found by the efficiency and reliability audit of 2026-10-30 (finding PR2; index postulo/postulo#1108). Checked against main at daee30b15 (2026-10-30).

In the modes that do not flag messages (the mailbox left untouched, or a folder that keeps no keywords), every message the rules did not recognise is downloaded again on every pass, within the look-back. ## What would change - Remember `{folder, uidvalidity, last_uid}` in the per-connection state the core issue adds. - At the next pass, if the folder and `UIDVALIDITY` match, search `UID <last_uid+1>:* SINCE <date>` and drop any UID not above `last_uid` from the answer (RFC 3501 6.4.8: `n:*` always includes the highest UID, even below `n`). If `UIDVALIDITY` changed, read the look-back as today. - Record `last_uid` only for batches read to the end, so a pass cut short resumes where it stopped. The keyword mode is unchanged. - The test double gains `UIDVALIDITY`/`UIDNEXT` in its `SELECT` answer and a `UID` range in `search`. - README: lengthening the look-back no longer reaches back for mail already passed over; a changed `days` resets the state (the core drops it when the configuration is edited). CONDSTORE/QRESYNC (RFC 7162) is not needed: the plugin never revisits a message. ## Accessibility None. The whole finding, with its measurements and decisions, is postulo/postulo#1165. --- Found by the efficiency and reliability audit of 2026-10-30 (finding PR2; index postulo/postulo#1108). Checked against `main` at `daee30b15` (2026-10-30).
tiagoagueda added this to the 0.6.0 milestone 2026-10-31 03:04:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo-imap#34
No description provided.