Skip to content

Conversation

@JeanMeijer
Copy link
Collaborator

@JeanMeijer JeanMeijer commented Dec 28, 2025

Description

Briefly describe what you did and why.

Screenshots / Recordings

Add screenshots or recordings here to help reviewers understand your changes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • UI/UX update
  • Docs update
  • Refactor / Cleanup

Related Areas

  • Authentication
  • Calendar UI
  • Data/API
  • Docs

Testing

  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Checklist

  • I’ve read the CONTRIBUTING guide
  • My code works and is understandable and follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation
  • Any dependent changes are merged and published

Notes

(Optional) Add anything else you'd like to share.

By submitting, I confirm I understand and stand behind this code. If AI was used, I’ve reviewed and verified everything myself.


Summary by cubic

Improves the Microsoft calendar provider with full recurrence support, more reliable delta sync, and better event operations. Also refactors parsing/formatting to handle Microsoft Graph quirks more accurately.

  • New Features

    • Full recurrence support: parse/format PatternedRecurrence, map seriesMasterId to recurringEventId, and include master events in list/sync.
    • Implemented moveEvent (copy to destination, then delete source) and smarter delete (sends cancellation when sendUpdate is true).
    • Better event payloads: attendees, visibility -> sensitivity, Teams online meetings, and normalized dial-in numbers.
    • Added Meeting type and isMeeting helper.
  • Bug Fixes

    • Delta sync now falls back to a full sync on 410/syncStateNotFound/resyncRequired and returns correct incremental/full status.
    • More robust date/time handling (original time zones, schedule input) and calendar flags (primary, readOnly).
    • More accurate parsing for free/busy and attendee response statuses.

Written for commit fa60b9e. Summary will update automatically on new commits.

@vercel
Copy link

vercel bot commented Dec 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
analog Ready Ready Preview, Comment Dec 28, 2025 11:54pm

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 14 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/providers/src/calendars/microsoft-calendar/events/format.ts">

<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/events/format.ts:47">
P1: For `ZonedDateTime`, `value.toInstant().toString()` returns a UTC timestamp with &#39;Z&#39; suffix (e.g., &quot;2024-12-28T10:00:00.000Z&quot;). Microsoft Graph API expects `dateTime` to be a local datetime string without timezone offset when `timeZone` is specified separately. Use `toPlainDateTime()` instead to match the API contract and the parsing logic in parse.ts.</violation>
</file>

<file name="packages/providers/src/calendars/microsoft-calendar.ts">

<violation number="1" location="packages/providers/src/calendars/microsoft-calendar.ts:427">
P2: Empty catch block swallows all errors from cancel API. If cancel fails for unexpected reasons (network error, auth issue, rate limit), the code silently falls back to delete without notifications. Consider catching only expected errors (e.g., &#39;cancel endpoint not available for this event type&#39;) and re-throwing unexpected errors.</violation>

<violation number="2" location="packages/providers/src/calendars/microsoft-calendar.ts:458">
P1: The `sendUpdate` parameter doesn&#39;t actually control attendee notifications. The &#39;Prefer: return=minimal&#39; header only affects response size, not notification behavior. When `sendUpdate` is true, an empty header value is set which has no effect. Consider documenting this limitation or removing the unused parameter.</violation>
</file>

<file name="packages/providers/src/lib/events.ts">

<violation number="1" location="packages/providers/src/lib/events.ts:4">
P2: Type guard condition is more restrictive than the `Meeting` type definition. The `Meeting` type only requires `attendees` to be present, but this check requires `length &gt; 1`. An event with exactly 1 attendee would satisfy the `Meeting` type but fail this type guard. Consider using `event.attendees.length &gt; 0` or `event.attendees.length &gt;= 1` to match the type definition, or update the `Meeting` type if the business logic truly requires multiple attendees.</violation>
</file>

<file name="packages/providers/src/calendars/microsoft-calendar/calendars.ts">

<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/calendars.ts:23">
P2: Semantic change in `readOnly` handling: When `canEdit` is `undefined`/`null`, the old logic (`!calendar.canEdit`) defaulted to read-only (safer), but the new logic (`calendar.canEdit === false`) now defaults to writable. Consider using `calendar.canEdit !== true` to preserve the conservative behavior, or document this intentional change.</violation>
</file>

Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.

}

return {
dateTime: value.toInstant().toString(),
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: For ZonedDateTime, value.toInstant().toString() returns a UTC timestamp with 'Z' suffix (e.g., "2024-12-28T10:00:00.000Z"). Microsoft Graph API expects dateTime to be a local datetime string without timezone offset when timeZone is specified separately. Use toPlainDateTime() instead to match the API contract and the parsing logic in parse.ts.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/microsoft-calendar/events/format.ts, line 47:

<comment>For `ZonedDateTime`, `value.toInstant().toString()` returns a UTC timestamp with &#39;Z&#39; suffix (e.g., &quot;2024-12-28T10:00:00.000Z&quot;). Microsoft Graph API expects `dateTime` to be a local datetime string without timezone offset when `timeZone` is specified separately. Use `toPlainDateTime()` instead to match the API contract and the parsing logic in parse.ts.</comment>

<file context>
@@ -0,0 +1,168 @@
+  }
+
+  return {
+    dateTime: value.toInstant().toString(),
+    timeZone:
+      originalTimeZone?.parsed === value.timeZoneId
</file context>
Fix with Cubic

await this.graphClient
.api(`${calendarPath(calendarId)}/events/${eventId}/cancel`)
.post({});
} catch {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Empty catch block swallows all errors from cancel API. If cancel fails for unexpected reasons (network error, auth issue, rate limit), the code silently falls back to delete without notifications. Consider catching only expected errors (e.g., 'cancel endpoint not available for this event type') and re-throwing unexpected errors.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/microsoft-calendar.ts, line 427:

<comment>Empty catch block swallows all errors from cancel API. If cancel fails for unexpected reasons (network error, auth issue, rate limit), the code silently falls back to delete without notifications. Consider catching only expected errors (e.g., &#39;cancel endpoint not available for this event type&#39;) and re-throwing unexpected errors.</comment>

<file context>
@@ -327,41 +411,57 @@ export class MicrosoftCalendarProvider implements CalendarProvider {
+          await this.graphClient
+            .api(`${calendarPath(calendarId)}/events/${eventId}/cancel`)
+            .post({});
+        } catch {
+          await this.graphClient
+            .api(`${calendarPath(calendarId)}/events/${eventId}`)
</file context>
Suggested change
} catch {
} catch (error) {
// Only fallback to delete if cancel endpoint is not available for this event
const err = error as { statusCode?: number; code?: string };
if (err.statusCode !== 400 && err.code !== 'ErrorInvalidRequest') {
throw error;
}
Fix with Cubic


await this.graphClient
.api(`${calendarPath(sourceCalendar.id)}/events/${eventId}`)
.header("Prefer", sendUpdate ? "" : "return=minimal")
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The sendUpdate parameter doesn't actually control attendee notifications. The 'Prefer: return=minimal' header only affects response size, not notification behavior. When sendUpdate is true, an empty header value is set which has no effect. Consider documenting this limitation or removing the unused parameter.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/microsoft-calendar.ts, line 458:

<comment>The `sendUpdate` parameter doesn&#39;t actually control attendee notifications. The &#39;Prefer: return=minimal&#39; header only affects response size, not notification behavior. When `sendUpdate` is true, an empty header value is set which has no effect. Consider documenting this limitation or removing the unused parameter.</comment>

<file context>
@@ -327,41 +411,57 @@ export class MicrosoftCalendarProvider implements CalendarProvider {
+
+      await this.graphClient
+        .api(`${calendarPath(sourceCalendar.id)}/events/${eventId}`)
+        .header(&quot;Prefer&quot;, sendUpdate ? &quot;&quot; : &quot;return=minimal&quot;)
+        .delete();
+
</file context>
Fix with Cubic

import type { CalendarEvent, Meeting } from "../interfaces/events";

export function isMeeting(event: CalendarEvent): event is Meeting {
return !!event.attendees && event.attendees.length > 1;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Type guard condition is more restrictive than the Meeting type definition. The Meeting type only requires attendees to be present, but this check requires length > 1. An event with exactly 1 attendee would satisfy the Meeting type but fail this type guard. Consider using event.attendees.length > 0 or event.attendees.length >= 1 to match the type definition, or update the Meeting type if the business logic truly requires multiple attendees.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/lib/events.ts, line 4:

<comment>Type guard condition is more restrictive than the `Meeting` type definition. The `Meeting` type only requires `attendees` to be present, but this check requires `length &gt; 1`. An event with exactly 1 attendee would satisfy the `Meeting` type but fail this type guard. Consider using `event.attendees.length &gt; 0` or `event.attendees.length &gt;= 1` to match the type definition, or update the `Meeting` type if the business logic truly requires multiple attendees.</comment>

<file context>
@@ -0,0 +1,5 @@
+import type { CalendarEvent, Meeting } from &quot;../interfaces/events&quot;;
+
+export function isMeeting(event: CalendarEvent): event is Meeting {
+  return !!event.attendees &amp;&amp; event.attendees.length &gt; 1;
+}
</file context>
Fix with Cubic

},
color: calendar.hexColor!,
readOnly: !calendar.canEdit,
readOnly: calendar.canEdit === false,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Semantic change in readOnly handling: When canEdit is undefined/null, the old logic (!calendar.canEdit) defaulted to read-only (safer), but the new logic (calendar.canEdit === false) now defaults to writable. Consider using calendar.canEdit !== true to preserve the conservative behavior, or document this intentional change.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/microsoft-calendar/calendars.ts, line 23:

<comment>Semantic change in `readOnly` handling: When `canEdit` is `undefined`/`null`, the old logic (`!calendar.canEdit`) defaulted to read-only (safer), but the new logic (`calendar.canEdit === false`) now defaults to writable. Consider using `calendar.canEdit !== true` to preserve the conservative behavior, or document this intentional change.</comment>

<file context>
@@ -2,31 +2,25 @@ import type { Calendar as MicrosoftCalendar } from &quot;@microsoft/microsoft-graph-t
     },
     color: calendar.hexColor!,
-    readOnly: !calendar.canEdit,
+    readOnly: calendar.canEdit === false,
     syncToken: null,
   };
</file context>
Suggested change
readOnly: calendar.canEdit === false,
readOnly: calendar.canEdit !== true,
Fix with Cubic

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.

2 participants