Repository navigation
feat(providers): improve provider structure - #474
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
11 issues found across 98 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/providers/src/calendars/microsoft-calendar/events/format.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/events/format.ts:217">
P1: Recurrence-only edits can silently move an existing series into UTC because the formatter receives the patch metadata rather than the master’s stored `recurrenceTimeZone`; this changes recurrence dates and DST behavior for non-UTC series. Preserve the existing master metadata when resolving a sparse recurrence update and pass that timezone through the formatter.</violation>
</file>
<file name="apps/app/src/lib/trpc/query-client.ts">
<violation number="1" location="apps/app/src/lib/trpc/query-client.ts:32">
P3: Removing the `?? "Something went wrong"` fallback means that when an error has no message (e.g. a thrown non-Error value), the console now logs `undefined` instead of the earlier friendly message. Consider keeping a fallback for robustness.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/utils.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/utils.ts:6">
P2: Environments that expose `Intl` as `undefined` or `null` now receive a `TypeError` while evaluating this condition instead of the function's documented/custom availability error. Keeping a safe `globalThis.Intl` check preserves the intended failure path for runtimes or tests without `Intl`.</violation>
</file>
<file name="packages/providers/src/lib/events.ts">
<violation number="1" location="packages/providers/src/lib/events.ts:4">
P3: Heuristic note: classifying "is a meeting" purely by `attendees?.length > 1` ignores attendee roles/status. An event whose only other attendee is a resource room, or a meeting whose counterpart declined (or only the organizer is listed), will be misclassified either way. Since Attendee carries `type` (required/optional/resource), `organizer`, and `status`, counting only non-resource, required attendees (or checking for a conference) would match the intent more reliably.</violation>
<violation number="2" location="packages/providers/src/lib/events.ts:4">
P2: The `isMeeting` predicate is inconsistent with the `Meeting` type it narrows to. `Meeting` only requires `attendees` to be present, so an event with 0 or 1 attendee is a valid `Meeting` value, yet `isMeeting` returns `false` for it (it only returns `true` when there are 2+ attendees). Any consumer relying on the guard to detect `Meeting`s will miss single-attendee events, and the type semantics ('has attendees') no longer match the runtime check ('has multiple attendees'). Consider aligning them: if a meeting means 'has attendees', use `(event.attendees?.length ?? 0) > 0` (or `event.attendees !== undefined`); if it genuinely means 'more than one attendee', update the `Meeting` type/name and add a comment documenting the stricter rule so the divergence is intentional.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/events/index.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/events/index.ts:494">
P3: The added Microsoft `move` implementation is dead from the application's current entry points: the API explicitly rejects Microsoft moves and its standalone move schema only accepts Google calendars. Either wire Microsoft into the move routing/validation or leave this method unsupported until a caller exists.</violation>
<violation number="2" location="packages/providers/src/calendars/microsoft-calendar/events/index.ts:516">
P1: A failed source deletion leaves the original and newly created destination event in place, so this copy-then-delete move can duplicate events and repeat the duplication on retry. The move should validate the source version before copying and provide cleanup/idempotency or an explicit reconciliation path when deletion fails.</violation>
</file>
<file name="packages/providers/src/calendars/google-calendar/events/parse.ts">
<violation number="1" location="packages/providers/src/calendars/google-calendar/events/parse.ts:253">
P2: An attendee response without `email` is emitted with `email: undefined`, violating the provider `Attendee` contract and its required email schema. Skip or otherwise explicitly handle attendees lacking an email before constructing the normalized attendee list rather than relying on `!`.</violation>
</file>
<file name="packages/providers/src/calendars/google-calendar/events/format.ts">
<violation number="1" location="packages/providers/src/calendars/google-calendar/events/format.ts:184">
P2: All-day mutations can be persisted as timed events because `allDay` is ignored; the Google payload must either derive the date/dateTime shape from this flag or reject inputs whose flag and Temporal values disagree, and patches must handle an all-day-only change.</violation>
</file>
<file name="packages/microsoft-calendar/src/interfaces.ts">
<violation number="1" location="packages/microsoft-calendar/src/interfaces.ts:230">
P2: Making `start`/`end` required on `Event` (and similarly `start`/`end`/`status` on `ScheduleItem`) now promises these fields are always present, but the same interfaces back GET/list/delta responses that support `select` and can legitimately omit those fields. The added comment acknowledges this '$select' caveat but the type still overpromises: consumers that call e.g. `get` with a `select` that excludes `start` can receive objects where `event.start.dateTime` is `undefined`, and code like `packages/providers/src/calendars/microsoft-calendar/events/parse.ts` dereferences it without a guard. Since these fields are required for create input but only conditionally present on `select`-filtered responses, consider separating the create-input shape from the response shape (or keeping the response `Event` fields optional) so the type doesn't force runtime assumptions that `$select` can violate.</violation>
</file>
<file name="packages/providers/src/calendars/google-calendar/conferences.ts">
<violation number="1" location="packages/providers/src/calendars/google-calendar/conferences.ts:271">
P2: In an event update, `formatEventInput` echoes the existing event's conference data through `formatConferenceInput`, and the completed-conference branch blindly dereferences `conferenceData.conferenceSolution!.key!.type!` even though the guard only verified `entryPoints?.length`. If an API response ever returns entry points without `conferenceSolution`, this throws and fails the update for a conference that could otherwise round-trip fine. The `!` here is only a type assertion, not a runtime check. Also, `...conferenceData` re-sends the original `createRequest` (status "success"), which contradicts the branch's stated intent of copying the conference "instead of re-echoing the request". Consider guarding on `conferenceSolution?.key?.type` and building the returned conference object field-by-field (or at least dropping `createRequest`) rather than re-spreading the whole payload.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ...formatRecurrencePatch( | ||
| event.recurrence, | ||
| options.startForRecurrence ?? event.start, | ||
| metadata.recurrenceTimeZone, |
There was a problem hiding this comment.
P1: Recurrence-only edits can silently move an existing series into UTC because the formatter receives the patch metadata rather than the master’s stored recurrenceTimeZone; this changes recurrence dates and DST behavior for non-UTC series. Preserve the existing master metadata when resolving a sparse recurrence update and pass that timezone through the formatter.
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 217:
<comment>Recurrence-only edits can silently move an existing series into UTC because the formatter receives the patch metadata rather than the master’s stored `recurrenceTimeZone`; this changes recurrence dates and DST behavior for non-UTC series. Preserve the existing master metadata when resolving a sparse recurrence update and pass that timezone through the formatter.</comment>
<file context>
@@ -0,0 +1,220 @@
+ ...formatRecurrencePatch(
+ event.recurrence,
+ options.startForRecurrence ?? event.start,
+ metadata.recurrenceTimeZone,
+ ),
+ };
</file context>
| headers: { Prefer: TEXT_BODY_PREFERENCE }, | ||
| }); | ||
|
|
||
| await this.eventsFor(sourceCalendar.id).delete({ |
There was a problem hiding this comment.
P1: A failed source deletion leaves the original and newly created destination event in place, so this copy-then-delete move can duplicate events and repeat the duplication on retry. The move should validate the source version before copying and provide cleanup/idempotency or an explicit reconciliation path when deletion fails.
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/index.ts, line 516:
<comment>A failed source deletion leaves the original and newly created destination event in place, so this copy-then-delete move can duplicate events and repeat the duplication on retry. The move should validate the source version before copying and provide cleanup/idempotency or an explicit reconciliation path when deletion fails.</comment>
<file context>
@@ -351,9 +491,38 @@ export class MicrosoftCalendarEvents implements CalendarProviderEvents {
+ headers: { Prefer: TEXT_BODY_PREFERENCE },
+ });
+
+ await this.eventsFor(sourceCalendar.id).delete({
+ userId: "me",
+ eventId,
</file context>
| description: event.description, | ||
| location: event.location, | ||
| visibility: event.visibility, | ||
| start: formatDate(event.start), |
There was a problem hiding this comment.
P2: All-day mutations can be persisted as timed events because allDay is ignored; the Google payload must either derive the date/dateTime shape from this flag or reject inputs whose flag and Temporal values disagree, and patches must handle an all-day-only 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/google-calendar/events/format.ts, line 184:
<comment>All-day mutations can be persisted as timed events because `allDay` is ignored; the Google payload must either derive the date/dateTime shape from this flag or reject inputs whose flag and Temporal values disagree, and patches must handle an all-day-only change.</comment>
<file context>
@@ -0,0 +1,297 @@
+ description: event.description,
+ location: event.location,
+ visibility: event.visibility,
+ start: formatDate(event.start),
+ end: formatDate(event.end),
+ transparency: formatTransparency(event),
</file context>
| conferenceSolution: { | ||
| iconUri: conferenceData.conferenceSolution?.iconUri, | ||
| key: { | ||
| type: conferenceData.conferenceSolution!.key!.type!, |
There was a problem hiding this comment.
P2: In an event update, formatEventInput echoes the existing event's conference data through formatConferenceInput, and the completed-conference branch blindly dereferences conferenceData.conferenceSolution!.key!.type! even though the guard only verified entryPoints?.length. If an API response ever returns entry points without conferenceSolution, this throws and fails the update for a conference that could otherwise round-trip fine. The ! here is only a type assertion, not a runtime check. Also, ...conferenceData re-sends the original createRequest (status "success"), which contradicts the branch's stated intent of copying the conference "instead of re-echoing the request". Consider guarding on conferenceSolution?.key?.type and building the returned conference object field-by-field (or at least dropping createRequest) rather than re-spreading the whole payload.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/google-calendar/conferences.ts, line 271:
<comment>In an event update, `formatEventInput` echoes the existing event's conference data through `formatConferenceInput`, and the completed-conference branch blindly dereferences `conferenceData.conferenceSolution!.key!.type!` even though the guard only verified `entryPoints?.length`. If an API response ever returns entry points without `conferenceSolution`, this throws and fails the update for a conference that could otherwise round-trip fine. The `!` here is only a type assertion, not a runtime check. Also, `...conferenceData` re-sends the original `createRequest` (status "success"), which contradicts the branch's stated intent of copying the conference "instead of re-echoing the request". Consider guarding on `conferenceSolution?.key?.type` and building the returned conference object field-by-field (or at least dropping `createRequest`) rather than re-spreading the whole payload.</comment>
<file context>
@@ -228,3 +230,70 @@ export function toConferenceData(
+ conferenceSolution: {
+ iconUri: conferenceData.conferenceSolution?.iconUri,
+ key: {
+ type: conferenceData.conferenceSolution!.key!.type!,
+ },
+ name: conferenceData.conferenceSolution?.name,
</file context>
| queryCache: new QueryCache({ | ||
| onError: (error) => { | ||
| console.error(error.message ?? "Something went wrong"); | ||
| console.error(error.message); |
There was a problem hiding this comment.
P3: Removing the ?? "Something went wrong" fallback means that when an error has no message (e.g. a thrown non-Error value), the console now logs undefined instead of the earlier friendly message. Consider keeping a fallback for robustness.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/lib/trpc/query-client.ts, line 32:
<comment>Removing the `?? "Something went wrong"` fallback means that when an error has no message (e.g. a thrown non-Error value), the console now logs `undefined` instead of the earlier friendly message. Consider keeping a fallback for robustness.</comment>
<file context>
@@ -29,7 +29,7 @@ export function makeQueryClient() {
queryCache: new QueryCache({
onError: (error) => {
- console.error(error.message ?? "Something went wrong");
+ console.error(error.message);
},
}),
</file context>
| import type { CalendarEvent, Meeting } from "../interfaces/events"; | ||
|
|
||
| export function isMeeting(event: CalendarEvent): event is Meeting { | ||
| return (event.attendees?.length ?? 0) > 1; |
There was a problem hiding this comment.
P3: Heuristic note: classifying "is a meeting" purely by attendees?.length > 1 ignores attendee roles/status. An event whose only other attendee is a resource room, or a meeting whose counterpart declined (or only the organizer is listed), will be misclassified either way. Since Attendee carries type (required/optional/resource), organizer, and status, counting only non-resource, required attendees (or checking for a conference) would match the intent more reliably.
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>Heuristic note: classifying "is a meeting" purely by `attendees?.length > 1` ignores attendee roles/status. An event whose only other attendee is a resource room, or a meeting whose counterpart declined (or only the organizer is listed), will be misclassified either way. Since Attendee carries `type` (required/optional/resource), `organizer`, and `status`, counting only non-resource, required attendees (or checking for a conference) would match the intent more reliably.</comment>
<file context>
@@ -0,0 +1,5 @@
+import type { CalendarEvent, Meeting } from "../interfaces/events";
+
+export function isMeeting(event: CalendarEvent): event is Meeting {
+ return (event.attendees?.length ?? 0) > 1;
+}
</file context>
| async move() { | ||
| return this.withErrorHandler("events.move", () => { | ||
| throw new Error("Moving Microsoft Calendar events is not supported"); | ||
| async move({ |
There was a problem hiding this comment.
P3: The added Microsoft move implementation is dead from the application's current entry points: the API explicitly rejects Microsoft moves and its standalone move schema only accepts Google calendars. Either wire Microsoft into the move routing/validation or leave this method unsupported until a caller exists.
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/index.ts, line 494:
<comment>The added Microsoft `move` implementation is dead from the application's current entry points: the API explicitly rejects Microsoft moves and its standalone move schema only accepts Google calendars. Either wire Microsoft into the move routing/validation or leave this method unsupported until a caller exists.</comment>
<file context>
@@ -351,9 +491,38 @@ export class MicrosoftCalendarEvents implements CalendarProviderEvents {
- async move() {
- return this.withErrorHandler("events.move", () => {
- throw new Error("Moving Microsoft Calendar events is not supported");
+ async move({
+ sourceCalendar,
+ destinationCalendar,
</file context>
There was a problem hiding this comment.
2 existing issues remain and 9 new issues found across 102 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/app/src/components/sign-in-with-google-button.tsx">
<violation number="1" location="apps/app/src/components/sign-in-with-google-button.tsx:25">
P3: Removing the fallback means toast.error() can receive an undefined/empty message. When better-auth's social sign-in error lacks a `message`, `new Error(error.message)` produces an empty string, and sonner renders a blank toast with no user feedback instead of the previous "An unknown error occurred" fallback.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/recurrence/parse.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/recurrence/parse.ts:79">
P1: Graph allows relative monthly/yearly patterns with multiple `daysOfWeek` and an index such as `second`. This emits `BYDAY=MO,WE;BYSETPOS=2`, but Graph chooses the earliest second weekday while RFC counts positions across the combined set, so occurrences shift. Reject or normalize this unsupported shape instead of returning an inaccurate recurrence.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/events/parse.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/events/parse.ts:258">
P2: When Graph omits an attendee's optional `type`, this assertion emits `type: undefined`, violating the shared attendee contract and causing schema validation or writes to fail. Default missing types to `"required"`, as the Google parser does.</violation>
</file>
<file name="packages/providers/src/calendars/google-calendar/conferences.ts">
<violation number="1" location="packages/providers/src/calendars/google-calendar/conferences.ts:262">
P1: When Google returns conference data without entry points, this guard skips the copy path and `formatConferenceInput` returns `undefined`, so full event updates can clear the existing conference. Handle empty or partial conference data before requiring `entryPoints?.length`, and return an appropriate copy payload instead of omitting `conferenceData`.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/events/index.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/events/index.ts:536">
P1: When the source GET includes read-only event fields such as `bodyPreview` or `responseStatus`, this copy sends them unchanged to Graph's create endpoint, so moving ordinary events can fail instead of completing. Build the destination payload from the writable event fields rather than forwarding the full GET response.</violation>
</file>
<file name="packages/providers/src/calendars/microsoft-calendar/recurrence/format.ts">
<violation number="1" location="packages/providers/src/calendars/microsoft-calendar/recurrence/format.ts:199">
P2: When `byDay` is an empty array, this branch silently changes the rule to the start weekday. Reject empty `byDay` values instead of treating them as omitted.</violation>
<violation number="2" location="packages/providers/src/calendars/microsoft-calendar/recurrence/format.ts:241">
P1: For a YEARLY `byDay`/`bySetPos` rule without `byMonth`, this fallback scopes the rule to `start.month`. Reject this unrepresentable case instead of silently changing the recurrence to one month.</violation>
<violation number="3" location="packages/providers/src/calendars/microsoft-calendar/recurrence/format.ts:312">
P1: When a recurring event starts with an IANA `ZonedDateTime`, this sends the IANA name directly as Graph's `recurrenceTimeZone`. Normalize IANA zones to the Microsoft/Windows identifier required by the Graph recurrence range before sending.</violation>
</file>
<file name="packages/providers/src/lib/events.ts">
<violation number="1" location="packages/providers/src/lib/events.ts:6">
P2: This exported `isMeeting` is never consumed, while the app keeps a second same-purpose implementation with different semantics. Import this helper in the app or remove the duplicate so meeting detection has one source of truth.</violation>
</file>
Requires human review: Auto-approval blocked because this review re-detected 2 unresolved issues already reported by Cubic.
Re-trigger cubic
| ...shared, | ||
| freq: "MONTHLY", | ||
| ...(byDay?.length ? { byDay } : {}), | ||
| bySetPos: [WEEK_INDEX_MAP[pattern.index ?? "first"]], |
There was a problem hiding this comment.
P1: Graph allows relative monthly/yearly patterns with multiple daysOfWeek and an index such as second. This emits BYDAY=MO,WE;BYSETPOS=2, but Graph chooses the earliest second weekday while RFC counts positions across the combined set, so occurrences shift. Reject or normalize this unsupported shape instead of returning an inaccurate recurrence.
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/recurrence/parse.ts, line 79:
<comment>Graph allows relative monthly/yearly patterns with multiple `daysOfWeek` and an index such as `second`. This emits `BYDAY=MO,WE;BYSETPOS=2`, but Graph chooses the earliest second weekday while RFC counts positions across the combined set, so occurrences shift. Reject or normalize this unsupported shape instead of returning an inaccurate recurrence.</comment>
<file context>
@@ -0,0 +1,115 @@
+ ...shared,
+ freq: "MONTHLY",
+ ...(byDay?.length ? { byDay } : {}),
+ bySetPos: [WEEK_INDEX_MAP[pattern.index ?? "first"]],
+ };
+ case "absoluteYearly": {
</file context>
| if ( | ||
| (!conferenceData.createRequest || | ||
| conferenceData.createRequest.status?.statusCode === "success") && | ||
| conferenceData.entryPoints?.length && |
There was a problem hiding this comment.
P1: When Google returns conference data without entry points, this guard skips the copy path and formatConferenceInput returns undefined, so full event updates can clear the existing conference. Handle empty or partial conference data before requiring entryPoints?.length, and return an appropriate copy payload instead of omitting conferenceData.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/providers/src/calendars/google-calendar/conferences.ts, line 262:
<comment>When Google returns conference data without entry points, this guard skips the copy path and `formatConferenceInput` returns `undefined`, so full event updates can clear the existing conference. Handle empty or partial conference data before requiring `entryPoints?.length`, and return an appropriate copy payload instead of omitting `conferenceData`.</comment>
<file context>
@@ -228,3 +230,83 @@ export function toConferenceData(
+ if (
+ (!conferenceData.createRequest ||
+ conferenceData.createRequest.status?.statusCode === "success") &&
+ conferenceData.entryPoints?.length &&
+ conferenceData.conferenceSolution
+ ) {
</file context>
|
|
||
| const createdEvent = await this.eventsFor(destinationCalendar.id).create({ | ||
| userId: "me", | ||
| event: stripServerOwnedFields(sourceEvent), |
There was a problem hiding this comment.
P1: When the source GET includes read-only event fields such as bodyPreview or responseStatus, this copy sends them unchanged to Graph's create endpoint, so moving ordinary events can fail instead of completing. Build the destination payload from the writable event fields rather than forwarding the full GET response.
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/index.ts, line 536:
<comment>When the source GET includes read-only event fields such as `bodyPreview` or `responseStatus`, this copy sends them unchanged to Graph's create endpoint, so moving ordinary events can fail instead of completing. Build the destination payload from the writable event fields rather than forwarding the full GET response.</comment>
<file context>
@@ -351,9 +510,58 @@ export class MicrosoftCalendarEvents implements CalendarProviderEvents {
+
+ const createdEvent = await this.eventsFor(destinationCalendar.id).create({
+ userId: "me",
+ event: stripServerOwnedFields(sourceEvent),
+ headers: { Prefer: TEXT_BODY_PREFERENCE },
+ });
</file context>
|
|
||
| const range: RecurrenceRange = { | ||
| startDate: startDate.toString(), | ||
| recurrenceTimeZone: timeZone, |
There was a problem hiding this comment.
P1: When a recurring event starts with an IANA ZonedDateTime, this sends the IANA name directly as Graph's recurrenceTimeZone. Normalize IANA zones to the Microsoft/Windows identifier required by the Graph recurrence range before sending.
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/recurrence/format.ts, line 312:
<comment>When a recurring event starts with an IANA `ZonedDateTime`, this sends the IANA name directly as Graph's `recurrenceTimeZone`. Normalize IANA zones to the Microsoft/Windows identifier required by the Graph recurrence range before sending.</comment>
<file context>
@@ -0,0 +1,359 @@
+
+ const range: RecurrenceRange = {
+ startDate: startDate.toString(),
+ recurrenceTimeZone: timeZone,
+ ...(recurrence.count !== undefined
+ ? { type: "numbered", numberOfOccurrences: recurrence.count }
</file context>
| ); | ||
| } | ||
|
|
||
| const month = recurrence.byMonth?.[0] ?? start.month; |
There was a problem hiding this comment.
P1: For a YEARLY byDay/bySetPos rule without byMonth, this fallback scopes the rule to start.month. Reject this unrepresentable case instead of silently changing the recurrence to one month.
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/recurrence/format.ts, line 241:
<comment>For a YEARLY `byDay`/`bySetPos` rule without `byMonth`, this fallback scopes the rule to `start.month`. Reject this unrepresentable case instead of silently changing the recurrence to one month.</comment>
<file context>
@@ -0,0 +1,359 @@
+ );
+ }
+
+ const month = recurrence.byMonth?.[0] ?? start.month;
+
+ if (recurrence.byDay?.length) {
</file context>
| email: attendee.emailAddress?.address ?? undefined, | ||
| name: attendee.emailAddress?.name ?? undefined, | ||
| status: parseAttendeeStatus(attendee.status?.response), | ||
| type: attendee.type!, |
There was a problem hiding this comment.
P2: When Graph omits an attendee's optional type, this assertion emits type: undefined, violating the shared attendee contract and causing schema validation or writes to fail. Default missing types to "required", as the Google parser does.
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/parse.ts, line 258:
<comment>When Graph omits an attendee's optional `type`, this assertion emits `type: undefined`, violating the shared attendee contract and causing schema validation or writes to fail. Default missing types to `"required"`, as the Google parser does.</comment>
<file context>
@@ -0,0 +1,260 @@
+ email: attendee.emailAddress?.address ?? undefined,
+ name: attendee.emailAddress?.name ?? undefined,
+ status: parseAttendeeStatus(attendee.status?.response),
+ type: attendee.type!,
+ };
+}
</file context>
| type: attendee.type!, | |
| type: attendee.type ?? "required", |
| return { | ||
| type: "weekly", | ||
| interval, | ||
| daysOfWeek: recurrence.byDay?.length |
There was a problem hiding this comment.
P2: When byDay is an empty array, this branch silently changes the rule to the start weekday. Reject empty byDay values instead of treating them as omitted.
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/recurrence/format.ts, line 199:
<comment>When `byDay` is an empty array, this branch silently changes the rule to the start weekday. Reject empty `byDay` values instead of treating them as omitted.</comment>
<file context>
@@ -0,0 +1,359 @@
+ return {
+ type: "weekly",
+ interval,
+ daysOfWeek: recurrence.byDay?.length
+ ? formatDaysOfWeek(recurrence.byDay)
+ : [formatDayOfWeek(start.dayOfWeek)],
</file context>
| // A meeting involves at least one participant besides the organizer: Graph | ||
| // omits the organizer from attendees while Google includes them, so counting | ||
| // entries is not portable — check for a non-resource, non-organizer attendee. | ||
| export function isMeeting(event: CalendarEvent): event is Meeting { |
There was a problem hiding this comment.
P2: This exported isMeeting is never consumed, while the app keeps a second same-purpose implementation with different semantics. Import this helper in the app or remove the duplicate so meeting detection has one source of truth.
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 6:
<comment>This exported `isMeeting` is never consumed, while the app keeps a second same-purpose implementation with different semantics. Import this helper in the app or remove the duplicate so meeting detection has one source of truth.</comment>
<file context>
@@ -0,0 +1,12 @@
+// A meeting involves at least one participant besides the organizer: Graph
+// omits the organizer from attendees while Google includes them, so counting
+// entries is not portable — check for a non-resource, non-organizer attendee.
+export function isMeeting(event: CalendarEvent): event is Meeting {
+ return (
+ event.attendees?.some(
</file context>
| }, | ||
| onError: (error) => { | ||
| toast.error(error.message ?? "An unknown error occurred"); | ||
| toast.error(error.message); |
There was a problem hiding this comment.
P3: Removing the fallback means toast.error() can receive an undefined/empty message. When better-auth's social sign-in error lacks a message, new Error(error.message) produces an empty string, and sonner renders a blank toast with no user feedback instead of the previous "An unknown error occurred" fallback.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/components/sign-in-with-google-button.tsx, line 25:
<comment>Removing the fallback means toast.error() can receive an undefined/empty message. When better-auth's social sign-in error lacks a `message`, `new Error(error.message)` produces an empty string, and sonner renders a blank toast with no user feedback instead of the previous "An unknown error occurred" fallback.</comment>
<file context>
@@ -22,7 +22,7 @@ export function SignInWithGoogleButton() {
},
onError: (error) => {
- toast.error(error.message ?? "An unknown error occurred");
+ toast.error(error.message);
},
});
</file context>
Description
Briefly describe what you did and why.
Screenshots / Recordings
Add screenshots or recordings here to help reviewers understand your changes.
Type of Change
Related Areas
Testing
Checklist
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
Reorganized calendar providers into clear parse/format modules, added solid recurrence/conference handling, and tightened types across Google and Microsoft. This reduces bugs, supports delta “removed” events, and makes provider code easier to maintain.
Refactors
@repo/providersGoogle/Microsoft code intoparseandformatmodules for calendars, events, freebusy; moved conference helpers toconferences.DeltaRemovedEventin all delta APIs.Partial<Event>;CalendarProviderEventsListOptions.timeZoneis now required;sendUpdatedefaults to true in events create.rscale/skiprules so Microsoft day-31 semantics are kept intact.Migration
parseConferenceData->parseConference,toGoogleCalendarEventInput->formatEventInput, Microsoft event helpers toevents/formatandevents/parse.timeZonetoCalendarProvider.events.list.Partial<Event>; handle delta results that may include removed items.@repo/providers/libisMeetingif needed; old meetings util was removed.Written for commit 959cde6. Summary will update on new commits.