From de160f4fe774e0ed60b8a5f6605857f6bf33f1a9 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Sat, 3 Oct 2026 22:13:33 -0400 Subject: [PATCH] fix(calendar): hash calendar IDs in the events cache key (1.2.12) The cache key joined every selected calendar ID and becomes a filename. With a few long Google calendar IDs (holidays, sports) it ran past the 255-byte filename limit, so every write failed ("Could not write cache") and events were refetched from Google on every update. The key now carries a 16-char sha256 of the sorted IDs instead. Co-Authored-By: Claude Opus 5.5 --- plugins.json | 7 +++---- plugins/calendar/manager.py | 10 ++++++++-- plugins/calendar/manifest.json | 8 +++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/plugins.json b/plugins.json index fcd23da6..d278272a 100644 --- a/plugins.json +++ b/plugins.json @@ -129,12 +129,11 @@ "plugin_path": "plugins/calendar", "stars": 0, "downloads": 0, - "last_updated": "2026-10-02", + "last_updated": "2026-10-03", "verified": true, "screenshot": "", - "latest_version": "1.2.11", - "ledmatrix_min_version": "3.3.0", - "commit": "886d2038d22a35c962beac0ea261543339cffec9" + "latest_version": "1.2.12", + "ledmatrix_min_version": "3.3.0" }, { "id": "christmas-countdown", diff --git a/plugins/calendar/manager.py b/plugins/calendar/manager.py index 97a70a9d..4d1ecbf5 100644 --- a/plugins/calendar/manager.py +++ b/plugins/calendar/manager.py @@ -16,6 +16,7 @@ API Version: 1.0.1 """ +import hashlib import os import logging import time @@ -407,8 +408,13 @@ def update(self) -> None: self.logger.warning("Calendar service not available - authentication may be required") return - # Check cache first - cache_key = f"{self.plugin_id}_events_{'_'.join(sorted(self.calendars))}" + # Check cache first. The calendar IDs are hashed, not joined into the + # key: the key becomes a filename, and a few long Google calendar IDs + # (holidays, sports) push it past the filesystem's 255-byte limit. + calendars_digest = hashlib.sha256( + '\n'.join(sorted(self.calendars)).encode('utf-8') + ).hexdigest()[:16] + cache_key = f"{self.plugin_id}_events_{calendars_digest}" cached_events = self.cache_manager.get(cache_key, max_age=self.update_interval) if cached_events is not None: diff --git a/plugins/calendar/manifest.json b/plugins/calendar/manifest.json index 052d82b1..a9ae00e2 100644 --- a/plugins/calendar/manifest.json +++ b/plugins/calendar/manifest.json @@ -1,7 +1,7 @@ { "id": "calendar", "name": "Google Calendar", - "version": "1.2.11", + "version": "1.2.12", "author": "ChuckBuilds", "description": "Display upcoming events from Google Calendar with date, time, and event details. Shows next 1-3 events with automatic rotation and timezone support.", "category": "productivity", @@ -35,6 +35,12 @@ } ], "versions": [ + { + "version": "1.2.12", + "released": "2026-10-03", + "ledmatrix_min_version": "3.3.0", + "notes": "The events cache key now carries a short hash of the selected calendar IDs instead of the IDs themselves. The key becomes a filename, and with a few long Google calendar IDs (holidays, sports) it ran past the 255-byte filename limit, so every write failed with 'Could not write cache' and the calendar refetched from Google on every update. Core floor unchanged." + }, { "version": "1.2.11", "released": "2026-10-02",