Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(notification): skip Microsoft and Apple Calendar time blocks without attendees (#1696)

Chad Piha33f86301f387
diff --git a/src/helpers/calendarReminderScheduler.js b/src/helpers/calendarReminderScheduler.js
index dd6fbcbf5..6e1df1110 100644
--- a/src/helpers/calendarReminderScheduler.js
+++ b/src/helpers/calendarReminderScheduler.js
@@ -7,8 +7,10 @@ function notificationKey(event) {
return `${event.provider || "google"}:${event.id}`;
}
+// A solo event with no invitees and no meeting link is a time block (focus
+// time, a personal reminder), not a meeting — every provider syncs those.
function isReminderEligible(event) {
- return event.provider !== "google" || event.attendees_count > 0 || getMeetingJoinUrl(event);
+ return event.attendees_count > 0 || getMeetingJoinUrl(event);
}
// Provider-agnostic meeting reminder scheduling. Reads only the shared
diff --git a/src/helpers/microsoftCalendarManager.js b/src/helpers/microsoftCalendarManager.js
index 7f5eaeb43..6f8d69570 100644
--- a/src/helpers/microsoftCalendarManager.js
+++ b/src/helpers/microsoftCalendarManager.js
@@ -219,6 +219,13 @@ class MicrosoftCalendarManager {
const toUpsert = [];
const contactsToUpsert = [];
for (const item of events) {
+ // An occurrence still stripped after backfill (master fetch failed) has no
+ // subject, attendees, or join link. Overwriting a row a previous sync
+ // stored in full would demote that meeting to an untitled time block, so
+ // keep the stored row and only insert bare stubs we've never seen.
+ if (isStrippedOccurrence(item) && this.databaseManager.getCalendarEventById(item.id)) {
+ continue;
+ }
toUpsert.push(this._mapEvent(item, calendar));
for (const a of item.attendees || []) {
if (a.emailAddress?.address) {
@@ -232,12 +239,12 @@ class MicrosoftCalendarManager {
// A full sync has no delta baseline, so deletions that happened while the
// token was invalid never arrive as @removed — prune what the fresh
- // snapshot no longer contains.
+ // snapshot no longer contains (kept stripped rows included).
if (isFullSync) {
this.databaseManager.removeStaleCalendarEvents(
"microsoft",
calendar.id,
- toUpsert.map((event) => event.id)
+ events.map((event) => event.id)
);
}
if (toUpsert.length > 0) this.databaseManager.upsertCalendarEvents(toUpsert);
@@ -250,7 +257,8 @@ class MicrosoftCalendarManager {
// Merges each stripped occurrence with its series master (fetched once per
// series); the occurrence's own id/start/end win. A failed master fetch
- // leaves its occurrences bare instead of failing the calendar's sync.
+ // leaves its occurrences bare instead of failing the calendar's sync;
+ // _syncCalendar decides whether a bare stub may be written.
async _backfillStrippedOccurrences(items, accountEmail) {
const masterIds = new Set(
items.filter(isStrippedOccurrence).map((item) => item.seriesMasterId)
diff --git a/test/helpers/appleCalendarManager.test.js b/test/helpers/appleCalendarManager.test.js
index 20c7f5149..d29f8e8a8 100644
--- a/test/helpers/appleCalendarManager.test.js
+++ b/test/helpers/appleCalendarManager.test.js
@@ -45,6 +45,29 @@ test("an unexpected helper exit schedules a restart while Apple Calendar is conn
}
});
+test("_mapEvent falls back to a meeting link found in location or notes", () => {
+ const AppleCalendarManager = loadManager();
+ const manager = new AppleCalendarManager({}, {});
+
+ const mapped = manager._mapEvent({
+ id: "evt-1:1755165600",
+ calendar_id: "calendar-1",
+ title: "External call",
+ start: "2026-08-14T10:00:00Z",
+ end: "2026-08-14T10:30:00Z",
+ is_all_day: false,
+ status: "confirmed",
+ location: "Zoom: https://example.zoom.us/j/123456789",
+ notes_urls: [],
+ attendees: [],
+ });
+
+ assert.equal(mapped.provider, "apple");
+ assert.equal(mapped.hangout_link, "https://example.zoom.us/j/123456789");
+ assert.equal(mapped.attendees_count, 0);
+ assert.equal(mapped.attendees, null);
+});
+
test("a deliberate stop prevents the exited child from scheduling a restart", () => {
const AppleCalendarManager = loadManager();
const databaseManager = {
diff --git a/test/helpers/calendarReminderScheduler.test.js b/test/helpers/calendarReminderScheduler.test.js
index ab99d4c0c..37c2f049b 100644
--- a/test/helpers/calendarReminderScheduler.test.js
+++ b/test/helpers/calendarReminderScheduler.test.js
@@ -15,48 +15,80 @@ function activeEvent(provider, id) {
};
}
-test("does not remind for a Google time block without attendees or a meeting link", () => {
- const timeBlock = activeEvent("google", "time-block");
- timeBlock.attendees_count = 0;
- const databaseManager = {
- getUpcomingEvents: () => [timeBlock],
- getActiveEvents: () => [timeBlock],
- };
- const scheduler = new CalendarReminderScheduler(databaseManager);
- let promptCount = 0;
- scheduler.meetingDetectionEngine = {
- handleCalendarReminder: () => {
- promptCount += 1;
- },
- };
-
- scheduler.scheduleNextMeeting();
-
- assert.equal(promptCount, 0);
- scheduler.stop();
-});
-
-test("reminds for a Google time block with a Google Meet link", () => {
- const timeBlock = activeEvent("google", "meet-block");
- timeBlock.attendees_count = 0;
- timeBlock.hangout_link = "https://meet.google.com/abc-defg-hij";
- const databaseManager = {
- getUpcomingEvents: () => [timeBlock],
- getActiveEvents: () => [timeBlock],
- };
- const scheduler = new CalendarReminderScheduler(databaseManager);
- let promptCount = 0;
- scheduler.meetingDetectionEngine = {
- handleCalendarReminder: () => {
- promptCount += 1;
- },
- };
-
- scheduler.scheduleNextMeeting();
-
- assert.equal(promptCount, 1);
- scheduler.stop();
-});
+const MEETING_LINK_BY_PROVIDER = {
+ google: "https://meet.google.com/abc-defg-hij",
+ microsoft: "https://teams.microsoft.com/l/meetup-join/19%3ameeting_abc",
+ apple: "https://example.zoom.us/j/123456789",
+};
+
+for (const provider of Object.keys(MEETING_LINK_BY_PROVIDER)) {
+ test(`does not remind for a ${provider} time block without attendees or a meeting link`, () => {
+ const timeBlock = activeEvent(provider, "time-block");
+ timeBlock.attendees_count = 0;
+ const databaseManager = {
+ getUpcomingEvents: () => [timeBlock],
+ getActiveEvents: () => [timeBlock],
+ };
+ const scheduler = new CalendarReminderScheduler(databaseManager);
+ let promptCount = 0;
+ scheduler.meetingDetectionEngine = {
+ handleCalendarReminder: () => {
+ promptCount += 1;
+ },
+ };
+
+ scheduler.scheduleNextMeeting();
+
+ assert.equal(promptCount, 0);
+ scheduler.stop();
+ });
+
+ test(`reminds for a ${provider} time block with a meeting link`, () => {
+ const timeBlock = activeEvent(provider, "meet-block");
+ timeBlock.attendees_count = 0;
+ timeBlock.hangout_link = MEETING_LINK_BY_PROVIDER[provider];
+ const databaseManager = {
+ getUpcomingEvents: () => [timeBlock],
+ getActiveEvents: () => [timeBlock],
+ };
+ const scheduler = new CalendarReminderScheduler(databaseManager);
+ let promptCount = 0;
+ scheduler.meetingDetectionEngine = {
+ handleCalendarReminder: () => {
+ promptCount += 1;
+ },
+ };
+
+ scheduler.scheduleNextMeeting();
+
+ assert.equal(promptCount, 1);
+ scheduler.stop();
+ });
+
+ // onWakeFromSleep hands the first active event straight to onMeetingStart,
+ // bypassing the scheduleNextMeeting filter.
+ test(`waking during a ${provider} time block does not remind`, () => {
+ const timeBlock = activeEvent(provider, "time-block");
+ timeBlock.attendees_count = 0;
+ const databaseManager = {
+ getUpcomingEvents: () => [timeBlock],
+ getActiveEvents: () => [timeBlock],
+ };
+ const scheduler = new CalendarReminderScheduler(databaseManager);
+ let promptCount = 0;
+ scheduler.meetingDetectionEngine = {
+ handleCalendarReminder: () => {
+ promptCount += 1;
+ },
+ };
+
+ scheduler.onWakeFromSleep();
+
+ assert.equal(promptCount, 0);
+ assert.equal(scheduler.activeMeeting, null);
+ scheduler.stop();
+ });
+}
test("resetting one provider preserves reminders delivered by another provider", () => {
const googleEvent = activeEvent("google", "meeting-1");
diff --git a/test/helpers/microsoftCalendarManager.test.js b/test/helpers/microsoftCalendarManager.test.js
index 843dbfd21..1deb39ad4 100644
--- a/test/helpers/microsoftCalendarManager.test.js
+++ b/test/helpers/microsoftCalendarManager.test.js
@@ -101,7 +101,7 @@ test("_mapEvent falls back to a meeting link found in location or body text", ()
assert.equal(mapped.attendees, null);
});
-function createManager(MicrosoftCalendarManager, upserted, contacts = []) {
+function createManager(MicrosoftCalendarManager, upserted, contacts = [], overrides = {}) {
return new MicrosoftCalendarManager(
{
removeStaleCalendarEvents: () => {},
@@ -109,6 +109,8 @@ function createManager(MicrosoftCalendarManager, upserted, contacts = []) {
removeCalendarEvents: () => {},
updateMicrosoftCalendarSyncToken: () => {},
upsertContacts: (rows) => contacts.push(...rows),
+ getCalendarEventById: () => null,
+ ...overrides,
},
{}
);
@@ -182,7 +184,7 @@ test("_syncCalendar backfills stripped recurring occurrences from their series m
assert.ok(contacts.some((contact) => contact.email === "[email protected]"));
});
-test("_syncCalendar keeps stripped occurrences when the series master fetch fails", async () => {
+test("_syncCalendar inserts a never-seen stripped occurrence bare when the series master fetch fails", async () => {
const MicrosoftCalendarManager = loadManagerModule();
const upserted = [];
const manager = createManager(MicrosoftCalendarManager, upserted);
@@ -201,3 +203,42 @@ test("_syncCalendar keeps stripped occurrences when the series master fetch fail
assert.equal(upserted[0].summary, null);
assert.equal(upserted[0].start_time, "2026-07-20T09:25:00Z");
});
+
+// A bare stub has attendees_count 0 and no join link, which the reminder
+// scheduler treats as a time block — it must not overwrite a full row.
+test("_syncCalendar keeps the stored row when a stripped occurrence's master fetch fails", async () => {
+ const MicrosoftCalendarManager = loadManagerModule();
+ const upserted = [];
+ const staleKeepLists = [];
+ const manager = createManager(MicrosoftCalendarManager, upserted, [], {
+ getCalendarEventById: (id) => (id === "occ-1" ? { id, summary: "Standup" } : null),
+ removeStaleCalendarEvents: (_provider, _calendarId, keepIds) => staleKeepLists.push(keepIds),
+ });
+
+ manager._apiGet = async (url) => {
+ if (url.includes("/calendarView/delta")) {
+ return {
+ "@odata.deltaLink": "delta-link",
+ value: [
+ STRIPPED_OCCURRENCE,
+ {
+ id: "evt-1",
+ subject: "One-off",
+ start: { dateTime: "2026-07-20T17:00:00.0000000" },
+ end: { dateTime: "2026-07-20T17:30:00.0000000" },
+ },
+ ],
+ };
+ }
+ throw new Error("master gone");
+ };
+
+ // No sync_token → full sync, so the stale prune runs and must spare occ-1.
+ await manager._syncCalendar({ id: "cal-1", account_email: "[email protected]" });
+
+ assert.deepEqual(
+ upserted.map((event) => event.id),
+ ["evt-1"]
+ );
+ assert.deepEqual(staleKeepLists, [["occ-1", "evt-1"]]);
+});