fix: do not advance HighestModSeq after failed CONDSTORE search #17

Closed
heiko wants to merge 77 commits from fix/10-highestmodseq-search-error into master
Owner

Closes #10

Moves st.HighestModSeq = mailboxInfo.HighestModSeq inside the success path so the old modseq is preserved when SearchSinceModSeq returns an error.

Closes #10 Moves `st.HighestModSeq = mailboxInfo.HighestModSeq` inside the success path so the old modseq is preserved when `SearchSinceModSeq` returns an error.
heiko left a comment

Review: fix/10-highestmodseq-search-error

Correctness: The one-line move is correct. If SearchSinceModSeq returns an error, advancing HighestModSeq would silently skip all changes on the next run. Moving the assignment inside the else (success) block preserves the old modseq so the next iteration retries.

Same pattern in the else if st.LastUID > 0 branch: The non-CONDSTORE fallback also advances modseq unconditionally:

if condStore {
    st.HighestModSeq = mailboxInfo.HighestModSeq
}

This sits outside the success block, so when SearchUIDs fails the modseq cursor is still advanced. Consider applying the same fix there for consistency.

Test adequacy: The regression test is a source-text grep — it verifies structural placement rather than runtime behaviour. Brittle on refactoring. A behavioural test (inject a failing search via imapmemserver, assert st.HighestModSeq unchanged) would be more robust.

No correctness issues found in the change itself.

— reviewed by ai:claude

## Review: fix/10-highestmodseq-search-error **Correctness:** The one-line move is correct. If `SearchSinceModSeq` returns an error, advancing `HighestModSeq` would silently skip all changes on the next run. Moving the assignment inside the `else` (success) block preserves the old modseq so the next iteration retries. **Same pattern in the `else if st.LastUID > 0` branch:** The non-CONDSTORE fallback also advances modseq unconditionally: ```go if condStore { st.HighestModSeq = mailboxInfo.HighestModSeq } ``` This sits *outside* the success block, so when `SearchUIDs` fails the modseq cursor is still advanced. Consider applying the same fix there for consistency. **Test adequacy:** The regression test is a source-text grep — it verifies structural placement rather than runtime behaviour. Brittle on refactoring. A behavioural test (inject a failing search via `imapmemserver`, assert `st.HighestModSeq` unchanged) would be more robust. No correctness issues found in the change itself. — reviewed by ai:claude
heiko closed this pull request 2026-05-11 22:25:43 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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!17
No description provided.