Skip to content

fix: calendar-home-set with several hrefs; never retry a failed PUT - #889

Merged
tobixen merged 4 commits into
masterfrom
fix/multi-href-home-set
Dec 3, 2026
Merged

tobixen merged 4 commits into
masterfrom
fix/multi-href-home-set

Conversation

@tobixen

@tobixen tobixen commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Disclaimer: AI-generated code and text below the line, generated by Claude Opus 5.5. The prompts are in the commit messages.


get_calendars() and Principal.calendar_home_set both crashed when the server listed several hrefs in calendar-home-set, as RFC 4791 allows and Stalwart does (with WebDav.enableAssistedDiscovery off) 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_set is 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:

Fixes #888

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
tobixen force-pushed the fix/multi-href-home-set branch from 8c5a024 to 01ae3e4 Compare December 3, 2026 21:01
@tobixen tobixen changed the title test: calendar-home-set with several hrefs (#888) fix: calendar-home-set with several hrefs; never retry a failed PUT Dec 3, 2026
@tobixen
tobixen marked this pull request as ready for review December 3, 2026 21:01
@tobixen
tobixen merged commit 207d391 into master Dec 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_calendars() crashes when calendar-home-set contains multiple hrefs

1 participant