Skip to content

fix(imap): use native MOVE and targeted fallback expunge - #30

Merged
bscott merged 1 commit into
masterfrom
fix/v0.2.7-native-imap-move
Aug 30, 2026
Merged

fix(imap): use native MOVE and targeted fallback expunge#30
bscott merged 1 commit into
masterfrom
fix/v0.2.7-native-imap-move

Conversation

@bscott

@bscott bscott commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Problem

MoveMessages implemented moves as COPY + STORE \Deleted + an unqualified EXPUNGE. EXPUNGE removes every deleted message in the selected mailbox, so moving one message could permanently delete unrelated messages previously marked \Deleted.

Approach

  • Delegate moves to go-imap v2 Client.Move, which uses native RFC 6851 MOVE when available.
  • Preserve no-match detection by sharing the UIDPLUS response-data check between COPY and MOVE.
  • Exercise the library fallback without MOVE; UID selectors on UIDPLUS servers use targeted UID EXPUNGE.
  • Document the fix under Unreleased.

Verification

  • gofmt -l . (clean)
  • go vet ./...
  • go test ./...
  • Regression tests were sabotaged against the old implementation and both failed as expected.
  • Independent review: Claude Opus 4.6 — APPROVE, no blocking findings.

Risk

Low. The implementation removes custom protocol sequencing in favor of the dependency’s built-in native MOVE/fallback behavior. Existing successful, missing-UID, UIDPLUS, and non-UIDPLUS tests remain green.

Closes #28
Closes #29

@bscott
bscott merged commit 142b8cc into master Aug 30, 2026
1 check passed
@bscott
bscott deleted the fix/v0.2.7-native-imap-move branch August 30, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unqualified EXPUNGE in MoveMessages can permanently delete unrelated messages Use native IMAP MOVE instead of hand-rolled COPY + STORE + EXPUNGE

1 participant