Interrupted or failed scan advances state, messages are skipped ai:claude-sonnet-5-5 #47

Open
opened 2026-10-24 09:13:08 +02:00 by heiko · 0 comments
Owner

Found by a 100 Go Mistakes review (#53/#54: errors not handled). Verified by reading the code.

Where: internal/app/app.go scanDelta: modseq path (~l.346-358) and UID path (~l.380-400); idle path ~l.594.

Problem:

  • In the CONDSTORE path the loop breaks when ctx is cancelled, but st.HighestModSeq = mailboxInfo.HighestModSeq is set after the loop anyway. A SIGTERM during the startup scan advances the modseq; on the next start the search (UIDAfter: LastUID, ModSeq: HighestModSeq) no longer returns the unprocessed UIDs, so they are never scanned/tagged.
  • st.LastUID = uid is set even when ProcessUIDWithOptions returned an error (e.g. a transient FETCH failure), so such a message is never retried.

Fix: advance LastUID/HighestModSeq only for UIDs that were processed successfully, and skip the modseq advance if the loop was interrupted or any UID failed.

(co)authored by ai:claude-sonnet-5-5

Found by a 100 Go Mistakes review (#53/#54: errors not handled). Verified by reading the code. **Where:** `internal/app/app.go` `scanDelta`: modseq path (~l.346-358) and UID path (~l.380-400); idle path ~l.594. **Problem:** - In the CONDSTORE path the loop `break`s when `ctx` is cancelled, but `st.HighestModSeq = mailboxInfo.HighestModSeq` is set after the loop anyway. A SIGTERM during the startup scan advances the modseq; on the next start the search (`UIDAfter: LastUID`, `ModSeq: HighestModSeq`) no longer returns the unprocessed UIDs, so they are never scanned/tagged. - `st.LastUID = uid` is set even when `ProcessUIDWithOptions` returned an error (e.g. a transient FETCH failure), so such a message is never retried. **Fix:** advance `LastUID`/`HighestModSeq` only for UIDs that were processed successfully, and skip the modseq advance if the loop was interrupted or any UID failed. (co)authored by ai:claude-sonnet-5-5
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
IUS/xr-invoiced#47
No description provided.