From e0ea16f2ef982d37bb6e42912912e6b1f629b916 Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Thu, 2 Jul 2026 18:36:46 +0200 Subject: [PATCH] fix: include calendar_id in per-calendar sync errors Events already carry calendar_id, but the corresponding sync-error entries didn't, forcing clients to match errors to calendars by fragile name-suffix comparison. Account-level failures (whole account unreachable) still omit calendar_id since no single calendar is at fault. --- backend/routers/caldav_router.py | 1 + backend/routers/google_router.py | 1 + backend/routers/homeassistant_router.py | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/routers/caldav_router.py b/backend/routers/caldav_router.py index bc8e147..514017b 100644 --- a/backend/routers/caldav_router.py +++ b/backend/routers/caldav_router.py @@ -337,6 +337,7 @@ def get_events( sync_errors.append({ "source": "caldav", "name": f"{account.username} – {calendar.name}", + "calendar_id": calendar.id, "message": "Sync fehlgeschlagen", }) diff --git a/backend/routers/google_router.py b/backend/routers/google_router.py index 2d7d631..f63f35c 100644 --- a/backend/routers/google_router.py +++ b/backend/routers/google_router.py @@ -418,6 +418,7 @@ def get_google_events(account: models.GoogleAccount, start_dt: datetime, end_dt: errors.append({ "source": "google", "name": f"{account.email} – {gcal.name}", + "calendar_id": gcal.id, "message": "Sync fehlgeschlagen", }) diff --git a/backend/routers/homeassistant_router.py b/backend/routers/homeassistant_router.py index 3e3398f..b9c112e 100644 --- a/backend/routers/homeassistant_router.py +++ b/backend/routers/homeassistant_router.py @@ -317,8 +317,8 @@ def get_ha_events(account: models.HomeAssistantAccount, start_dt: datetime, end_ """Fetch events from all enabled HA calendars for an account. Returns (events, errors) — errors is a list of - {"source": "homeassistant", "name": ..., "message": ...} dicts for any - calendar that failed to sync. Never includes raw exception text. + {"source": "homeassistant", "name": ..., "calendar_id": ..., "message": ...} + dicts for any calendar that failed to sync. Never includes raw exception text. """ all_events = [] errors = [] @@ -340,6 +340,7 @@ def get_ha_events(account: models.HomeAssistantAccount, start_dt: datetime, end_ errors.append({ "source": "homeassistant", "name": f"{account.name} – {cal.name}", + "calendar_id": cal.id, "message": "Sync fehlgeschlagen", }) return all_events, errors