CalDAV exposes ignored event alerts as active VALARMs when useDefaultAlerts is true

Issue Description

When a CalendarEvent has useDefaultAlerts: true, Stalwart exposes event-level alerts as active CalDAV VALARMs in addition to the calendar defaults.

JMAP Calendars says that when default alerts are enabled, the event’s alerts property is ignored except for acknowledgement/snooze state.

For example, I have an event with an old 30-minute event alert and a 10-minute calendar default. JMAP correctly treats only the 10-minute alert as effective, but a CalDAV client receives and fires both.

Current main appears to retain event alerts during JSCalendar → iCalendar conversion, then append defaults via default_alert_to_ical.

Expected Behavior

With useDefaultAlerts: true, CalDAV should expose only the effective calendar defaults, plus any necessary acknowledgement/snooze state.

Actual Behavior

CalDAV exposes both the inactive event alert and the calendar default as active VALARMs.

Reproduction Steps

  1. Set a calendar default alert for 10 minutes before.
  2. Create an event with useDefaultAlerts: true and a 30-minute event alert.
  3. Fetch it through CalDAV.
  4. Observe both 30-minute and 10-minute VALARMs.

Relevant Log Output

N/A

Stalwart Version

v0.16.x

Installation Method

Built from source

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This is a valid bug report about behavior in the code, not something covered by a doc I can point to as a fix. Let me check the code path to confirm the mechanics before replying.

That behavior lines up with what the code currently does. When useDefaultAlerts is set, CalendarEvent/set converts the JSCalendar object (including any event-level alerts) to iCalendar via into_icalendar(), and then separately appends the calendar’s default alerts (via default_alert_to_ical) as additional VALARM components on the same event. Nothing in that path strips or suppresses the original event-level alerts before they’re serialized, so both the stale event alert and the calendar default end up as active VALARMs in the CalDAV representation, exactly as you describe, even though JMAP CalendarEvent/get correctly treats the event alerts as inactive when useDefaultAlerts is true.

This looks like a genuine bug rather than a documented/expected behavior, so I can’t point you to docs that resolve it. A human maintainer will need to follow up on fixing the ical conversion to drop or ignore event-level alerts (aside from acknowledgment/snooze state) when default alerts are in effect.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

This had been fixed as part of the v1.0.0 refactor and it can’t be backported to v0.16. v1 is expected for late October early November.