fix(calendar): keep default creation transactional#5657
Open
RaresKeY wants to merge 3 commits into
Open
Conversation
3 tasks
RaresKeY
marked this pull request as ready for review
July 21, 2026 12:21
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
Keep lazy default-calendar creation inside the caller's transaction. The helper
now flushes the new row without committing it, so a failed event request rolls
back both the event and the default calendar instead of leaving an orphan.
Callers that intentionally materialize a default during calendar reads commit
explicitly. Stable fallback IDs handle supported username rename/reuse without
breaking concurrent first use or caller rollback. Existing-calendar behavior
is unchanged.
Target branch
dev, notmain.Linked Issue
Fixes #5641
Part of #5637
Type of Change
Checklist
dev.How to Test
Run:
Create an invalid event for an owner with no calendar and verify neither a calendar nor event remains after rollback.
Create a valid event and verify its newly created default calendar commits with it.
List calendars for an owner with no calendar and verify the intentional lazy default is committed.
Rename that owner, recreate the old username, and verify lazy creation uses one stable fallback calendar under concurrent first use.
Exact-head validation passes 77 focused/rename tests and 189 calendar, CalDAV,
and rename tests plus Python compilation. The full repository result matches
the clean-
devbaseline; live external-database coverage remains a revieweritem.
Visual / UI changes — REQUIRED if you touched anything that renders
No visual or frontend files changed.