Uses UID-only search for mailbox discovery - #10
Open
bramato wants to merge 4 commits into
Open
Conversation
Avoid materializing flags and RFC822 headers while discovering mailbox UIDs. Force UID sequence mode, preserve incremental cursor filtering and ordering, and require Webklex 6.2 where Query::search() is public. Cover the 5,000-message regression with string UID tokens and an explicit no-FETCH expectation.
Add the 1.5.4 changelog entry with the large-mailbox failure mode, provider-wide performance impact, regression coverage and Webklex 6.2 compatibility floor.
Configure Webklex to request BODY[TEXT] so servers such as Stalwart return the MIME body instead of embedding the complete RFC822 entity in message content. Add a factory regression test that locks the body-only fetch mode.
Explain the Stalwart RFC822.TEXT behavior, the BODY[TEXT] correction, and its compatibility characteristics in the 1.5.4 changelog.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes IMAP mailbox discovery by switching WebklexImapClient::searchUids() to a UID-only search path, avoiding per-message metadata fetches (flags/headers) and improving robustness/performance on large mailboxes and servers with command-length limits.
Changes:
- Update UID discovery to use
setSequence(IMAP::ST_UID)+Query::search()instead ofget()(avoids metadata fetch during discovery). - Configure the Webklex client to fetch body-only content (
rfc => BODY) for better server interoperability. - Add/adjust unit tests and bump
webklex/php-imaprequirement to^6.2, plus document the change in the changelog.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Imap/WebklexImapClient.php |
Switches discovery to UID-only search and preserves filtering/sorting behavior. |
tests/Unit/WebklexImapClientTest.php |
Adds regression coverage ensuring discovery uses UID-only search and avoids metadata fetch calls. |
src/Imap/ImapClientFactory.php |
Sets Webklex rfc option to BODY to fetch body-only content. |
tests/Unit/ImapClientFactoryTest.php |
Adds regression test asserting the factory configures body-only fetch mode. |
composer.json |
Bumps webklex/php-imap minimum requirement to ^6.2. |
CHANGELOG.md |
Documents the UID discovery fix, body-only fetch mode, and compatibility notes for 1.5.4. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+34
to
+35
| $property = new ReflectionProperty($client, 'client'); | ||
| $webklexClient = $property->getValue($client); |
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.
Summary of changes
What and why
Tests
Dependency and compatibility
Changelog
Breaking Changes
Review Focus