fix: invalidate cached SEARCH results on message deletion/move - #52
Merged
ralflang merged 1 commit intoAug 29, 2026
Merged
Conversation
When the backend's 'cache' parameter is enabled, _deleteMsgs() correctly invalidates the FETCH data cache and the message map for a mailbox when messages vanish (VANISHED response after EXPUNGE or MOVE), but never touched the SEARCH result cache (CACHE_SEARCH/ CACHE_SEARCHID metadata). Since that cache's validity is keyed off the mailbox's tracked sync token rather than off actual message-set changes, a MOVE that does not visibly advance the local HIGHESTMODSEQ leaves stale UIDs in the SEARCH cache. A subsequent search() on that mailbox then serves those vanished UIDs, and any FETCH/STORE issued against them silently returns nothing.
PR Summary
|
Member
|
@jcdelepine Thank you! I will add a unit test to this after merge. I will also add a guard test to #51 but it doesn't cache search results yet so cannot have the same bug (until that feature is added). |
ralflang
added a commit
that referenced
this pull request
Aug 29, 2026
ralflang
added a commit
that referenced
this pull request
Aug 29, 2026
ralflang
added a commit
that referenced
this pull request
Aug 29, 2026
Release version 3.1.0 test: Add test coverage for #52 search cache invalidation bug chore(metadata) add dependency on horde/sasl and bump horde/socket_client dependency to 3.1 style: php-cs-fixer feat: IMAP4rev2 implementation on src/ PSR-4 codebase fix: invalidate cached SEARCH results on message deletion/move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the backend's 'cache' parameter is enabled, _deleteMsgs() correctly invalidates the FETCH data cache and the message map for a mailbox when messages vanish (VANISHED response after EXPUNGE or MOVE), but never touched the SEARCH result cache (CACHE_SEARCH/ CACHE_SEARCHID metadata). Since that cache's validity is keyed off the mailbox's tracked sync token rather than off actual message-set changes, a MOVE that does not visibly advance the local HIGHESTMODSEQ leaves stale UIDs in the SEARCH cache. A subsequent search() on that mailbox then serves those vanished UIDs, and any FETCH/STORE issued against them silently returns nothing.