Repository navigation
fix: calendar-home-set with several hrefs; never retry a failed PUT - #889
Merged
Merged
Conversation
RFC 4791 lets calendar-home-set hold several hrefs, and Stalwart lists the user's own home plus one per account sharing calendars when WebDav.enableAssistedDiscovery is off. Both get_calendars() and Principal.calendar_home_set crash on that today. The new sync and async tests expect get_calendars() to query each home once and combine them, and calendar_home_set to be the first, own, home. Unit tests rather than integration tests: reproducing it on Stalwart needs a server-wide setting flipped and a calendar shared through a raw ACL request. Fails until the fix lands, ref #888 Prompts: > Please try to reproduce > #888 > The stalwart server should be up and running. Produce some > breaking integration test for it > Does it require special configuration of stalwart? Then it's > maybe non-trivial to create this as an integration test? In that > case, unit test is good enough > I'm going to bed. Please open a draft PR with just the unit tests. > You had some arguments against the proposed fix, make some > arguments for it and draft a comment. Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
NLnet's GenAI policy 2.0 only allows read-only use of GenAI. From 2026-12-04 the project follows it and stops accepting AI-generated contributions, except a PR fixing a serious bug for its author; the decision is to be evaluated in 2027-02. The old policy stays below for the time until then: it now also asks contributors to say why the PR matters to them, lets prompts be paraphrased when verbatim does not work, and drops the low-hanging-fruit paragraph and the funding-versus-vibe-engineering paragraph. The policy text is the maintainer's own; review fixed the rule list, the old policy's scope and wording nits. Prompts: > Commit and piggyback my change of the AI-POLICY in this PR > (on the bug-fix exception sitting in the old policy) I've tried > fixing this, do a QA > (on whether the old policy still applies) Applies until 2026-12-04 > and possibly after an evaluation in 2027-02 > (on the dangling fragment in the NLnet section) I've possibly fixed > this myself, have a look Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
A calendar-home-set may hold several hrefs (RFC 4791 section 6.2.1), and Stalwart lists one per account sharing calendars with the user. get_calendars() now queries each listed home once and combines the results, skipping an extra home that is refused or gone (a revoked share) rather than losing the user's own calendars over it; only the guessed fallbacks (principal URL, client URL) still stop at the first hit. Principal.calendar_home_set takes the first href, the user's own home, so new calendars never land in somebody else's. Fixes #888 Prompt: ... continue with [#889] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
The retry after a 4xx re-sent byte-identical data: the "clean-up" through vobject it once relied on no longer touches the body, since get_vobject_instance() returns a copy. So most refused saves (4xx) cost a second PUT, and only the second answer reached the caller, the same masking that the 5xx case had, ref #847 and #43. The retry_on_failure plumbing goes with it, and the retry design doc marks its section on this retry as resolved. Prompts: > [fix the review finding on #879 that the 4xx retry re-sends the same body] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
tobixen
force-pushed
the
fix/multi-href-home-set
branch
from
December 3, 2026 21:01
8c5a024 to
01ae3e4
Compare
tobixen
marked this pull request as ready for review
December 3, 2026 21:01
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.
Disclaimer: AI-generated code and text below the line, generated by Claude Opus 5.5. The prompts are in the commit messages.
get_calendars()andPrincipal.calendar_home_setboth crashed when the server listed several hrefs incalendar-home-set, as RFC 4791 allows and Stalwart does (withWebDav.enableAssistedDiscoveryoff) for calendars shared from other accounts.get_calendars()now queries each listed home once and combines the results. An extra home that is refused or gone is skipped, so a revoked share no longer costs the user their own calendars.calendar_home_setis the first href, the user's own home. The tests came first, as unit tests: reproducing this on Stalwart needs a server-wide setting flipped. Looking a calendar up by name or id still only searches the first home: #890.Piggy-backing, to save a CI run:
fix: never retry a failed PUT. The retry after a 4xx sent the same bytes again, and only the second answer reached the caller. This is the same problem fix: preserve uncertain PUT outcomes after server errors #879 fixed for 5xx, found in the review of fix: preserve uncertain PUT outcomes after server errors #879.docs: AI-POLICY moves to NLnet GenAI policy 2.0Fixes #888