feat: jmap support - part 2 - #12800
SebastianKrupinski wants to merge 16 commits into
Conversation
f3ed4a9 to
c56f384
Compare
3b35d0b to
ee47083
Compare
Thank you, for getting that far |
|
I have addressed / changed all requested via comments... will clean up CI once code is approved. |
|
I moved the psalm-types to the class level docblock, otherwise the import from other classes wont work. |
Saw that thank you. I address the last comment you made |
| } finally { | ||
| $client->logout(); | ||
| // update local store | ||
| $this->dbMessageMapper->updateBulk($account, false, ...$mutatedMessages); |
There was a problem hiding this comment.
One would assume MessageMapper::updateBulk() would update entities in one go, but that's apparently not the case ;)
I'd agree it would be nice to have more batch methods (like moveMessages), but I'd see that as its own feature, and would really appreciate keeping this PR focused on the necessary changes. So far I don't see why JMAP needs a moveMessages method.
The updateBulk() call here is dead code because it never writes mailbox_id/uid, so it can't do what these two call sites need it to do.
IMAP has two paths calling deleteByUid:
- lib/Cache/Cache.php deleteMsgs
- MessageCacheUpdaterListener, in response to a MessageDeletedEvent
moveMessages and moveMessage no longer emit MessageDeletedEvent. That's a regression and should be resolved.
I'd prefer to keep moveMessages out. If the method has to stay, it must emit MessageDeletedEvent.
There was a problem hiding this comment.
So far I don't see why JMAP needs a moveMessages method.
JMAP operates in bulk by design a single request moves N messages, there's no per-message round trip. Restricting this PR to single-message moves would mean adding a batch capability that the protocol already gives us for free, only to bolt it back on in a follow-up. All the connector interfaces here already operate on Message ...$messages for the other operations (flag, tag, delete); moveMessages being singular would be the outlier, not the norm. Also I don't understand the lets fix it later approach that we never end up doing... since the mail manager had to be re-write to be protocol agnostic... why not do it correctly from the start, why handicap the new protocol with the bad logic from the old one.
The updateBulk() call here is dead code because it never writes mailbox_id/uid,
Ugh... another thing that makes no sense... why are we matching the rows by mailbox_id and uid when there is a perfectly fine record id...
Okay, I've changed the code to push the changes row by row. This should get refactored into a real bulk update-by-id later, since updateBulk() as written can't do it — it never writes mailbox_id/uid at all.
That's a regression and should be resolved.
Fixed
|
I have addressed / changed all requested in your most recent comments |
|
@DerDreschner since you tested this positively, could you please review and approve? Thanks |
ChristophWurst
left a comment
There was a problem hiding this comment.
As far as I can see you removed the explicit try-finally handling of IMAP connections as resource.
There is no replacement mechanism to manage them.
Doesn't this mean that we might end up with a pile of open connections by the end of a cron execution but possibly also during initial sync when we need to hop between caching and non-caching clients?
As a reminder, there is a common per-IP connection limit on mail servers. IIRC it was five connections per IP for Dovecot. That would bite us rather quickly.
The last commit addresses the open connections
As for this connection reuse/caching is on my list of after this is merged follow ups, |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Pure rename with no behavior or signature change, unrelated to the JMAP protocol work (flagged in review as noise). Restores the name main already uses. Assisted-by: ClaudeCode:claude-opus-4-8 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
The rename touched the OCS route id (mail.messages.getSource -> ...getRawMessage) with no behavior change and no stated reason, unrelated to the JMAP protocol work. Restore the original name to drop this from the JMAP diff; the OCS route id and controller/service method name are back to what main already has. Assisted-by: ClaudeCode:claude-opus-4-8 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
Summary
Adds a protocol abstraction so Mail can talk to both IMAP and JMAP servers through a
common set of interfaces, and reworks the existing IMAP code to implement them.
ProtocolFactory— selects the right connector for an account's protocolIMailboxConnector(+ImapMailboxConnector,JmapMailboxConnector)IMessageConnector(+ImapMessageConnector,JmapMessageConnector)Scope
Sending operations are in feat: jmap support - part 2b #12871.
Automated tests
composer psalmcleancomposer test:unitgreencomposer test:integrationgreencomposer cs:checkcleanTesting
Every operation that talks to an external server must be tested twice — once against an IMAP account/server and once against a JMAP account/server.
Copy a block below into a comment and tick the boxes for the server you tested against.
Each operation has one checkbox per protocol.
Mailbox operations
Message operations
Console operations
mail:account:create— alias ofmail:account:create-imapmail:account:create-imapmail:account:create-jmapmail:account:debugmail:account:deletemail:account:diagnose— alias ofmail:account:testmail:account:exportmail:account:export-threadsmail:account:run-meta-estimatormail:account:syncmail:account:testmail:account:trainmail:account:updatemail:clean-upmail:predict-importancemail:repair:system-autorespondersmail:repair:tagsmail:tags:migration-jobsmail:thread