Handle pending mail account provisioning case (#1081)#1082
Merged
Conversation
Appointment can call the CalDAV setup endpoint after subscription has marked a user active, but before the async Stalwart account provisioning task has completed. In that window the user has no local primary Stalwart email yet, so the old flow could throw AccountNotFoundError. Return a machine-readable 409 `mail_account_not_ready` response for that transient state where user.stalwart_primary_email is not set. We will continue to throw on other Stalwart lookup failures, as those remain unexpected.
davinotdavid
requested changes
Jul 8, 2026
davinotdavid
left a comment
Contributor
There was a problem hiding this comment.
Nice, thank you! Code diff lgtm but I think we should add a test for this as there's no coverage for this exact case with the status 409 and code mail_account_not_ready.
Even though it is a small enough change, since Appointment will rely on this in its counterpart implementation, we should harden this in tests.
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.
Appointment can call the CalDAV setup endpoint after subscription has marked a user active, but before the async Stalwart account provisioning task has completed. In that window the user has no local primary Stalwart email yet, so the old flow could throw AccountNotFoundError.
Return a machine-readable 409
mail_account_not_readyresponse for that transient state where user.stalwart_primary_email is not set.We will continue to throw on other Stalwart lookup failures, as those remain unexpected.
Applicable Issues
QA Log