Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(calendar): preserve per-occurrence RSVP state and scope event responses (#5533)

gbirmanc44b576651e1
diff --git a/.sqlx/query-2174a00b6587755c83f5f0008950918ae8b8b8d00d05857cb8a78e8bd0a71dd0.json b/.sqlx/query-2174a00b6587755c83f5f0008950918ae8b8b8d00d05857cb8a78e8bd0a71dd0.json
new file mode 100644
index 0000000000..39d935df2f
--- /dev/null
+++ b/.sqlx/query-2174a00b6587755c83f5f0008950918ae8b8b8d00d05857cb8a78e8bd0a71dd0.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO calendar_event_override_attendees (\n event_id, recurrence_id, email, display_name, response_status,\n is_organizer, is_optional, is_self, comment\n )\n VALUES ($1, $2, lower($3), $4, $5, $6, $7, $8, $9)\n ON CONFLICT (event_id, recurrence_id, email) DO UPDATE SET\n display_name = EXCLUDED.display_name,\n response_status = EXCLUDED.response_status,\n is_organizer = EXCLUDED.is_organizer,\n is_optional = EXCLUDED.is_optional,\n is_self = EXCLUDED.is_self,\n comment = EXCLUDED.comment\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Bool",
+ "Bool",
+ "Bool",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "2174a00b6587755c83f5f0008950918ae8b8b8d00d05857cb8a78e8bd0a71dd0"
+}
diff --git a/.sqlx/query-ef9d633f5ed4b99d7861b675347a25fa83810ab374f1a893dfbd29ada20e2553.json b/.sqlx/query-e0117e2e48606652ecd1faed86e4587a33bb66157bef8596808c956009c4031e.json
similarity index 70%
rename from .sqlx/query-ef9d633f5ed4b99d7861b675347a25fa83810ab374f1a893dfbd29ada20e2553.json
rename to .sqlx/query-e0117e2e48606652ecd1faed86e4587a33bb66157bef8596808c956009c4031e.json
index c1e08c4fb6..6a2db35b2f 100644
--- a/.sqlx/query-ef9d633f5ed4b99d7861b675347a25fa83810ab374f1a893dfbd29ada20e2553.json
+++ b/.sqlx/query-e0117e2e48606652ecd1faed86e4587a33bb66157bef8596808c956009c4031e.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO calendar_event_overrides (\n event_id, recurrence_id, original_starts_at, original_start_date,\n starts_at, ends_at, start_date, end_date,\n title, description, location, status\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)\n ",
+ "query": "\n INSERT INTO calendar_event_overrides (\n event_id, recurrence_id, original_starts_at, original_start_date,\n starts_at, ends_at, start_date, end_date,\n title, description, location, status, attendees_overridden\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n ",
"describe": {
"columns": [],
"parameters": {
@@ -16,10 +16,11 @@
"Text",
"Text",
"Text",
- "Text"
+ "Text",
+ "Bool"
]
},
"nullable": []
},
- "hash": "ef9d633f5ed4b99d7861b675347a25fa83810ab374f1a893dfbd29ada20e2553"
+ "hash": "e0117e2e48606652ecd1faed86e4587a33bb66157bef8596808c956009c4031e"
}
diff --git a/.sqlx/query-ffcc4591da041c08fc2e723ceca3760965b14e07eb07a0f5bc7d304de66187da.json b/.sqlx/query-ffcc4591da041c08fc2e723ceca3760965b14e07eb07a0f5bc7d304de66187da.json
new file mode 100644
index 0000000000..b73e797a5e
--- /dev/null
+++ b/.sqlx/query-ffcc4591da041c08fc2e723ceca3760965b14e07eb07a0f5bc7d304de66187da.json
@@ -0,0 +1,70 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n override.event_id,\n override.recurrence_id,\n attendee.email AS \"email?\",\n attendee.display_name,\n attendee.response_status AS \"response_status?\",\n attendee.is_organizer AS \"is_organizer?\",\n attendee.is_optional AS \"is_optional?\",\n attendee.is_self AS \"is_self?\",\n attendee.comment\n FROM calendar_event_overrides override\n LEFT JOIN calendar_event_override_attendees attendee\n ON attendee.event_id = override.event_id\n AND attendee.recurrence_id = override.recurrence_id\n WHERE override.event_id = ANY($1)\n AND override.attendees_overridden\n ORDER BY override.event_id, override.recurrence_id, attendee.email\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "event_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "recurrence_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "email?",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "display_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "response_status?",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "is_organizer?",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "is_optional?",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 7,
+ "name": "is_self?",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 8,
+ "name": "comment",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "UuidArray"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ true,
+ false,
+ false,
+ false,
+ false,
+ true
+ ]
+ },
+ "hash": "ffcc4591da041c08fc2e723ceca3760965b14e07eb07a0f5bc7d304de66187da"
+}
diff --git a/apps/web/src/features/calendar/events/EventRsvpSection.tsx b/apps/web/src/features/calendar/events/EventRsvpSection.tsx
index aeeef9ac6c..2eddd813b9 100644
--- a/apps/web/src/features/calendar/events/EventRsvpSection.tsx
+++ b/apps/web/src/features/calendar/events/EventRsvpSection.tsx
@@ -1,38 +1,94 @@
import { toast } from '@core/component/Toast/Toast';
+import CloseIcon from '@phosphor/x.svg';
import { useRsvpCalendarEventMutation } from '@queries/calendar/mutations';
+import type { CalendarRsvpScope } from '@service-email/client';
import type { AttendeeResponseStatus } from '@service-storage/generated/schemas/attendeeResponseStatus';
-import { Button } from '@ui';
-import { createMemo, For, Show } from 'solid-js';
+import { Button, Dialog, Panel } from '@ui';
+import { createSignal, For, Show } from 'solid-js';
import type { CalendarEvent } from './types';
+type RsvpResponse = Exclude<AttendeeResponseStatus, 'needs_action'>;
+
const RSVP_OPTIONS = [
{ response: 'accepted', label: 'Yes' },
{ response: 'tentative', label: 'Maybe' },
{ response: 'declined', label: 'No' },
] as const satisfies readonly {
- response: Exclude<AttendeeResponseStatus, 'needs_action'>;
+ response: RsvpResponse;
+ label: string;
+}[];
+
+const SCOPE_OPTIONS = [
+ { scope: 'this_event', label: 'This event' },
+ { scope: 'all', label: 'All events' },
+] as const satisfies readonly {
+ scope: CalendarRsvpScope;
label: string;
}[];
/**
- * RSVP controls for the connected account's own attendance. Recurring
- * events respond for the entire series, matching the backend semantics.
+ * RSVP controls for the connected account's own attendance.
+ *
+ * A recurring event asks whether the answer covers this occurrence or the
+ * whole series. Google records an occurrence answer as an exception
+ * instance, so responses can differ per occurrence. There is deliberately no
+ * "this and following" option: the provider API cannot express a forward
+ * response, so it would silently expire past the synced window.
*/
export function EventRsvpSection(props: { event: CalendarEvent }) {
- const selfAttendee = createMemo(() =>
- props.event.attendees.find((attendee) => attendee.isSelf)
- );
+ const selfAttendee = () =>
+ props.event.attendees.find((attendee) => attendee.isSelf);
+ const isRecurring = () =>
+ props.event.recurrenceLines.length > 0 ||
+ props.event.recurrenceId !== undefined;
const canRespond = () =>
selfAttendee() !== undefined &&
!props.event.isReadOnly &&
!props.event.isCancelled;
+ const [pendingResponse, setPendingResponse] = createSignal<RsvpResponse>();
+ const [scope, setScope] = createSignal<CalendarRsvpScope>('this_event');
+
const rsvp = useRsvpCalendarEventMutation({
onError: (error) => {
toast.failure('Failed to update RSVP', { subtext: error.message });
},
});
+ const submit = (
+ response: RsvpResponse,
+ effectiveScope: CalendarRsvpScope
+ ) => {
+ rsvp.mutate({
+ eventId: props.event.eventId,
+ response,
+ scope: effectiveScope,
+ recurrenceId:
+ effectiveScope === 'all'
+ ? undefined
+ : (props.event.recurrenceId ?? props.event.occurrenceKey),
+ occurrenceKey:
+ effectiveScope === 'all' ? undefined : props.event.occurrenceKey,
+ });
+ };
+
+ const respond = (response: RsvpResponse) => {
+ // A single occurrence is its own series, so there is nothing to scope.
+ if (!isRecurring()) {
+ submit(response, 'all');
+ return;
+ }
+ setScope('this_event');
+ setPendingResponse(response);
+ };
+
+ const confirm = () => {
+ const response = pendingResponse();
+ if (response === undefined) return;
+ submit(response, scope());
+ setPendingResponse(undefined);
+ };
+
return (
<Show when={canRespond()}>
<div class="border-edge-muted flex items-center gap-3 border-t px-4 py-2.5 text-xs text-ink-muted">
@@ -50,12 +106,7 @@ export function EventRsvpSection(props: { event: CalendarEvent }) {
class="rounded-lg px-2.5"
disabled={rsvp.isPending}
label={option.label}
- onClick={() =>
- rsvp.mutate({
- eventId: props.event.eventId,
- response: option.response,
- })
- }
+ onClick={() => respond(option.response)}
>
{option.label}
</Button>
@@ -63,6 +114,65 @@ export function EventRsvpSection(props: { event: CalendarEvent }) {
</For>
</div>
</div>
+ <Dialog
+ open={pendingResponse() !== undefined}
+ onOpenChange={(open) =>
+ !open && !rsvp.isPending && setPendingResponse(undefined)
+ }
+ >
+ <Panel depth={2} class="max-w-[calc(100vw-2rem)] rounded-xl text-ink">
+ <Panel.Header class="gap-1 px-2">
+ <Dialog.CloseButton
+ as={Button}
+ variant="ghost"
+ size="icon-sm"
+ disabled={rsvp.isPending}
+ >
+ <CloseIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="m-0 p-0 text-sm font-medium">
+ RSVP to recurring event
+ </Dialog.Title>
+ </Panel.Header>
+ <Panel.Body class="flex flex-col gap-3 p-3">
+ <div class="flex max-w-80 flex-col gap-2 text-sm text-ink-muted">
+ <For each={SCOPE_OPTIONS}>
+ {(option) => (
+ <label class="flex items-center gap-2">
+ <input
+ type="radio"
+ name="rsvp-scope"
+ checked={scope() === option.scope}
+ onChange={() => setScope(option.scope)}
+ />
+ {option.label}
+ </label>
+ )}
+ </For>
+ </div>
+ <div class="flex justify-end gap-1 pt-2">
+ <Button
+ variant="ghost"
+ class="rounded-lg"
+ disabled={rsvp.isPending}
+ label="Cancel"
+ onClick={() => setPendingResponse(undefined)}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="active"
+ class="rounded-lg"
+ disabled={rsvp.isPending}
+ label="OK"
+ onClick={confirm}
+ >
+ OK
+ </Button>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </Dialog>
</Show>
);
}
diff --git a/apps/web/src/lib/queries/calendar/mutations.ts b/apps/web/src/lib/queries/calendar/mutations.ts
index 3c40e1601f..26959eedb1 100644
--- a/apps/web/src/lib/queries/calendar/mutations.ts
+++ b/apps/web/src/lib/queries/calendar/mutations.ts
@@ -1,7 +1,11 @@
import { throwOnErr } from '@core/util/result';
import { queryClient } from '@queries/client';
import { type MutationCallbacks, withCallbacks } from '@queries/utils';
-import { type CalendarDeletionScope, emailClient } from '@service-email/client';
+import {
+ type CalendarDeletionScope,
+ type CalendarRsvpScope,
+ emailClient,
+} from '@service-email/client';
import type { CalendarEvent as CalendarEventEntity } from '@service-email/generated/schemas/calendarEvent';
import type { CreateCalendarEventRequest } from '@service-email/generated/schemas/createCalendarEventRequest';
import type { UpdateCalendarEventRequest } from '@service-email/generated/schemas/updateCalendarEventRequest';
@@ -60,6 +64,33 @@ function patchEventItems(
export interface RsvpCalendarEventArgs {
eventId: string;
response: Exclude<AttendeeResponseStatus, 'needs_action'>;
+ /** How much of a recurring series to answer for; defaults to all of it. */
+ scope?: CalendarRsvpScope;
+ /** Original-start key of the occurrence a scoped response targets. */
+ recurrenceId?: string;
+ /** Cache key of the occurrence, for the optimistic update. */
+ occurrenceKey?: string;
+}
+
+/**
+ * Whether a cached occurrence is covered by a scoped response. An omitted
+ * scope with a recurrenceId is occurrence-scoped, matching the API default.
+ */
+function answeredByRsvp(
+ item: CalendarOccurrenceItem,
+ args: RsvpCalendarEventArgs
+): boolean {
+ if (item.event.id !== args.eventId) return false;
+ if (
+ args.scope === 'this_event' ||
+ (args.scope === undefined && args.recurrenceId !== undefined)
+ ) {
+ return (
+ args.occurrenceKey !== undefined &&
+ item.occurrence.occurrenceKey === args.occurrenceKey
+ );
+ }
+ return true;
}
type RsvpCallbacks = MutationCallbacks<
@@ -69,13 +100,19 @@ type RsvpCallbacks = MutationCallbacks<
CalendarMutationContext
>;
-/** Sets the viewer's RSVP; recurring events respond for the whole series. */
+/**
+ * Sets the viewer's RSVP for one occurrence or the whole series. Google
+ * records an occurrence-scoped response as an exception instance, so the
+ * answer can differ per occurrence.
+ */
export function useRsvpCalendarEventMutation(callbacks?: RsvpCallbacks) {
return useMutation(() => ({
mutationFn: async (args: RsvpCalendarEventArgs) =>
await throwOnErr(() =>
emailClient.rsvpCalendarEvent(args.eventId, {
response: args.response,
+ scope: args.scope,
+ recurrenceId: args.recurrenceId,
})
),
...withCallbacks<
@@ -86,18 +123,22 @@ export function useRsvpCalendarEventMutation(callbacks?: RsvpCallbacks) {
>(
{
onMutate: (args) =>
- patchOccurrenceCaches(
- patchEventItems(args.eventId, (item) => ({
- ...item,
- event: {
- ...item.event,
- attendees: item.event.attendees.map((attendee) =>
- attendee.isSelf
- ? { ...attendee, responseStatus: args.response }
- : attendee
- ),
- },
- }))
+ patchOccurrenceCaches((items) =>
+ items.map((item) =>
+ answeredByRsvp(item, args)
+ ? {
+ ...item,
+ event: {
+ ...item.event,
+ attendees: item.event.attendees.map((attendee) =>
+ attendee.isSelf
+ ? { ...attendee, responseStatus: args.response }
+ : attendee
+ ),
+ },
+ }
+ : item
+ )
),
onError: (_error, _args, context) => context?.rollback(),
onSettled: () => invalidateCalendarOccurrences(),
diff --git a/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx b/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx
index b999de89bb..9b8ba0bb3e 100644
--- a/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx
+++ b/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx
@@ -182,6 +182,89 @@ describe('useRsvpCalendarEventMutation', () => {
});
});
+ it('scopes the optimistic answer to the occurrences it covers', async () => {
+ // Three occurrences of one series, so a scoped answer has something to
+ // leave alone.
+ const seriesOccurrence = (key: string): CalendarOccurrenceItem =>
+ ({
+ event: {
+ id: 'event-3',
+ title: 'Standup',
+ recurrenceLines: ['RRULE:FREQ=DAILY'],
+ time: { kind: 'timed', startsAt: key, endsAt: key },
+ attendees: [
+ {
+ email: '[email protected]',
+ isSelf: true,
+ responseStatus: 'accepted',
+ },
+ ],
+ },
+ occurrence: {
+ eventId: 'event-3',
+ occurrenceKey: key,
+ recurrenceId: key,
+ time: { kind: 'timed', startsAt: key, endsAt: key },
+ },
+ }) as unknown as CalendarOccurrenceItem;
+ const keys = [
+ '2026-08-04T09:00:00Z',
+ '2026-08-05T09:00:00Z',
+ '2026-08-06T09:00:00Z',
+ ];
+ testQueryClient.setQueryData(
+ calendarKeys.occurrences('user', viewportA).queryKey,
+ { items: keys.map(seriesOccurrence), syncStatus: 'ready' }
+ );
+ const responseAt = (key: string) =>
+ viewportData(viewportA)
+ ?.items.find((item) => item.occurrence.occurrenceKey === key)
+ ?.event.attendees.find((attendee) => attendee.isSelf)?.responseStatus;
+
+ rsvpCalendarEventMock.mockResolvedValue(ok({ id: 'event-3' }));
+ const rsvp = renderHook(() => useRsvpCalendarEventMutation());
+
+ await rsvp.mutateAsync({
+ eventId: 'event-3',
+ response: 'declined',
+ scope: 'this_event',
+ recurrenceId: keys[1],
+ occurrenceKey: keys[1],
+ });
+
+ expect(responseAt(keys[0])).toBe('accepted');
+ expect(responseAt(keys[1])).toBe('declined');
+ expect(responseAt(keys[2])).toBe('accepted');
+ expect(rsvpCalendarEventMock).toHaveBeenCalledWith('event-3', {
+ response: 'declined',
+ scope: 'this_event',
+ recurrenceId: keys[1],
+ });
+
+ await rsvp.mutateAsync({
+ eventId: 'event-3',
+ response: 'tentative',
+ scope: 'all',
+ });
+
+ expect(responseAt(keys[0])).toBe('tentative');
+ expect(responseAt(keys[1])).toBe('tentative');
+ expect(responseAt(keys[2])).toBe('tentative');
+
+ // An omitted scope with a recurrenceId is occurrence-scoped on the
+ // server, so the optimistic patch must not widen it to the series.
+ await rsvp.mutateAsync({
+ eventId: 'event-3',
+ response: 'declined',
+ recurrenceId: keys[2],
+ occurrenceKey: keys[2],
+ });
+
+ expect(responseAt(keys[0])).toBe('tentative');
+ expect(responseAt(keys[1])).toBe('tentative');
+ expect(responseAt(keys[2])).toBe('declined');
+ });
+
it('rolls back every viewport when the request fails', async () => {
rsvpCalendarEventMock.mockResolvedValue(failure());
const rsvp = renderHook(() => useRsvpCalendarEventMutation());
diff --git a/apps/web/src/lib/service-clients/service-email/client.ts b/apps/web/src/lib/service-clients/service-email/client.ts
index eb124d58bd..f24dab7ab5 100644
--- a/apps/web/src/lib/service-clients/service-email/client.ts
+++ b/apps/web/src/lib/service-clients/service-email/client.ts
@@ -54,6 +54,9 @@ const EMAIL_LINK_ID_HEADER = 'X-Email-Link-Id';
/** How much of a recurring series a calendar deletion removes. */
export type CalendarDeletionScope = 'all' | 'this_event' | 'this_and_following';
+/** How much of a recurring series a calendar RSVP answers for. */
+export type CalendarRsvpScope = 'all' | 'this_event';
+
function emailLinkHeaders(linkId?: string): Record<string, string> | undefined {
return linkId ? { [EMAIL_LINK_ID_HEADER]: linkId } : undefined;
}
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/calendarRsvpScopeParam.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/calendarRsvpScopeParam.ts
new file mode 100644
index 0000000000..c32afb7e95
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/calendarRsvpScopeParam.ts
@@ -0,0 +1,22 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * How much of a recurring series an RSVP applies to.
+
+Unlike deletion there is no this-and-following variant: the provider
+cannot express a forward-scoped response, so offering one would be a
+promise sync could not keep.
+ */
+export type CalendarRsvpScopeParam =
+ (typeof CalendarRsvpScopeParam)[keyof typeof CalendarRsvpScopeParam];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const CalendarRsvpScopeParam = {
+ all: 'all',
+ this_event: 'this_event',
+} as const;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
index 9a8d550081..9261ff07af 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
@@ -157,6 +157,7 @@ export * from './calendarEventOrganizerEmail';
export * from './calendarEventOrganizerName';
export * from './calendarMutationApiError';
export * from './calendarMutationErrorCode';
+export * from './calendarRsvpScopeParam';
export * from './cancelBackfillParams';
export * from './contact';
export * from './contactEmailAddress';
@@ -278,6 +279,8 @@ export * from './refreshEmailEventOneOfThree';
export * from './refreshEmailEventOneOfThreeEvent';
export * from './resyncResponse';
export * from './rsvpCalendarEventRequest';
+export * from './rsvpCalendarEventRequestRecurrenceId';
+export * from './rsvpCalendarEventRequestScope';
export * from './sendMessageRequest';
export * from './sendMessageResponse';
export * from './settings';
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequest.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequest.ts
index da233e5cc6..e3f2cfc4a0 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequest.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequest.ts
@@ -4,12 +4,18 @@
* email_service
* OpenAPI spec version: 0.1.0
*/
+
import type { AttendeeResponseStatus } from './attendeeResponseStatus';
+import type { RsvpCalendarEventRequestRecurrenceId } from './rsvpCalendarEventRequestRecurrenceId';
+import type { RsvpCalendarEventRequestScope } from './rsvpCalendarEventRequestScope';
/**
* Request body setting the requester's RSVP on an event.
*/
export interface RsvpCalendarEventRequest {
+ /** Original-start key of the occurrence the response targets. */
+ recurrenceId?: RsvpCalendarEventRequestRecurrenceId;
/** The response to record for the connected account. */
response: AttendeeResponseStatus;
+ scope?: RsvpCalendarEventRequestScope;
}
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestRecurrenceId.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestRecurrenceId.ts
new file mode 100644
index 0000000000..a7b7e62d3e
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestRecurrenceId.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Original-start key of the occurrence the response targets.
+ */
+export type RsvpCalendarEventRequestRecurrenceId = string | null;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestScope.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestScope.ts
new file mode 100644
index 0000000000..94052afe5a
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/rsvpCalendarEventRequestScope.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { CalendarRsvpScopeParam } from './calendarRsvpScopeParam';
+
+export type RsvpCalendarEventRequestScope = null | CalendarRsvpScopeParam;
diff --git a/apps/web/src/lib/service-clients/service-email/openapi.json b/apps/web/src/lib/service-clients/service-email/openapi.json
index 5dd2f739e0..653b791466 100644
--- a/apps/web/src/lib/service-clients/service-email/openapi.json
+++ b/apps/web/src/lib/service-clients/service-email/openapi.json
@@ -4475,6 +4475,11 @@
"persist_failed"
]
},
+ "CalendarRsvpScopeParam": {
+ "type": "string",
+ "description": "How much of a recurring series an RSVP applies to.\n\nUnlike deletion there is no this-and-following variant: the provider\ncannot express a forward-scoped response, so offering one would be a\npromise sync could not keep.",
+ "enum": ["all", "this_event"]
+ },
"CancelBackfillParams": {
"type": "object",
"required": ["job_id"],
@@ -5589,9 +5594,24 @@
"description": "Request body setting the requester's RSVP on an event.",
"required": ["response"],
"properties": {
+ "recurrenceId": {
+ "type": ["string", "null"],
+ "description": "Original-start key of the occurrence the response targets."
+ },
"response": {
"$ref": "#/components/schemas/AttendeeResponseStatus",
"description": "The response to record for the connected account."
+ },
+ "scope": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/CalendarRsvpScopeParam",
+ "description": "How much of a recurring series the response covers. Omit to let\n`recurrenceId` decide: the identified occurrence alone when one is\nsupplied, otherwise the whole series. An explicit `this_event` scope\nrequires `recurrenceId`, so a scoped request is never silently\nwidened to the series."
+ }
+ ]
}
}
},
diff --git a/crates/calendar_events/src/domain/models.rs b/crates/calendar_events/src/domain/models.rs
index 00a86a3ad8..133541bd57 100644
--- a/crates/calendar_events/src/domain/models.rs
+++ b/crates/calendar_events/src/domain/models.rs
@@ -311,6 +311,12 @@ pub struct CalendarEventOverride {
pub location: Option<String>,
/// Optional replacement status.
pub status: Option<EventStatus>,
+ /// Replacement attendee list for this occurrence alone. `None` inherits
+ /// the series attendees. Google carries the complete list on every
+ /// exception it returns, so a single instance-scoped RSVP — including the
+ /// auto-decline an out-of-office event performs — arrives here rather than
+ /// on the master.
+ pub attendees: Option<Vec<CalendarAttendee>>,
}
/// A start-only value used to identify an overridden occurrence.
diff --git a/crates/calendar_events/src/domain/mutations.rs b/crates/calendar_events/src/domain/mutations.rs
index 42c3741a31..c663bda4fd 100644
--- a/crates/calendar_events/src/domain/mutations.rs
+++ b/crates/calendar_events/src/domain/mutations.rs
@@ -16,9 +16,9 @@ use super::{
},
ports::{
CalendarAccessTokenProvider, CalendarDeletionScope, CalendarEventWrite,
- CalendarMutationError, CalendarMutationService, CalendarRepository, CalendarTokenError,
- GoogleCalendarMutationProvider, GoogleProviderError, GoogleProviderErrorKind,
- GoogleRsvpOutcome, GoogleSeriesMutationOutcome,
+ CalendarMutationError, CalendarMutationService, CalendarRepository, CalendarRsvpScope,
+ CalendarTokenError, GoogleCalendarMutationProvider, GoogleProviderError,
+ GoogleProviderErrorKind, GoogleRsvpOutcome, GoogleSeriesMutationOutcome,
},
};
@@ -239,6 +239,7 @@ where
requester_id: &str,
event_id: Uuid,
response: AttendeeResponseStatus,
+ scope: CalendarRsvpScope,
) -> Result<CalendarEvent, CalendarMutationError> {
let target = self.resolve_mutation_target(requester_id, event_id).await?;
if target.is_read_only {
@@ -253,6 +254,7 @@ where
target.master_provider_event_id(),
&target.token_identity.email_address,
response,
+ &scope,
)
.await
.map_err(provider_error)?;
diff --git a/crates/calendar_events/src/domain/mutations/test.rs b/crates/calendar_events/src/domain/mutations/test.rs
index cfc12714bc..0e9866b9e8 100644
--- a/crates/calendar_events/src/domain/mutations/test.rs
+++ b/crates/calendar_events/src/domain/mutations/test.rs
@@ -371,14 +371,19 @@ impl GoogleCalendarMutationProvider for FakeProvider {
&self,
_access_token: &str,
target: &GoogleCalendarTarget,
- provider_event_id: &str,
+ master_provider_event_id: &str,
_self_email: &str,
_response: AttendeeResponseStatus,
+ scope: &CalendarRsvpScope,
) -> Result<GoogleRsvpOutcome, GoogleProviderError> {
+ let scope = match scope {
+ CalendarRsvpScope::All => "all".to_string(),
+ CalendarRsvpScope::ThisEvent { recurrence_id } => format!("this:{recurrence_id}"),
+ };
self.calls
.lock()
.unwrap()
- .push(format!("rsvp:{provider_event_id}"));
+ .push(format!("rsvp:{master_provider_event_id}:{scope}"));
if let Some(error) = self.fail() {
return Err(error);
}
@@ -641,7 +646,8 @@ async fn rsvp_surfaces_attendance_and_persists_the_echo() {
.respond_to_event(
"macro|user",
Uuid::now_v7(),
- AttendeeResponseStatus::Accepted
+ AttendeeResponseStatus::Accepted,
+ CalendarRsvpScope::All,
)
.await,
Err(CalendarMutationError::NotAttendee)
@@ -652,19 +658,26 @@ async fn rsvp_surfaces_attendance_and_persists_the_echo() {
..FakeRepo::default()
};
let upserts = repo.upserts.clone();
- service(
- repo,
- FakeProvider::new(FakeProviderBehavior::Echo),
- FakeTokens::ok(),
- )
- .respond_to_event(
- "macro|user",
- Uuid::now_v7(),
- AttendeeResponseStatus::Declined,
- )
- .await
- .unwrap();
+ let provider = FakeProvider::new(FakeProviderBehavior::Echo);
+ let calls = provider.calls.clone();
+ service(repo, provider, FakeTokens::ok())
+ .respond_to_event(
+ "macro|user",
+ Uuid::now_v7(),
+ AttendeeResponseStatus::Declined,
+ CalendarRsvpScope::ThisEvent {
+ recurrence_id: "2026-08-14T22:00:00+00:00".to_string(),
+ },
+ )
+ .await
+ .unwrap();
assert_eq!(upserts.lock().unwrap().len(), 1);
+ // The scope reaches the provider intact: an occurrence-scoped response
+ // must not silently widen to the series.
+ assert_eq!(
+ calls.lock().unwrap().as_slice(),
+ ["rsvp:master-id:this:2026-08-14T22:00:00+00:00"]
+ );
}
#[tokio::test]
diff --git a/crates/calendar_events/src/domain/ports.rs b/crates/calendar_events/src/domain/ports.rs
index 4c58278f3f..aef918d918 100644
--- a/crates/calendar_events/src/domain/ports.rs
+++ b/crates/calendar_events/src/domain/ports.rs
@@ -161,13 +161,18 @@ pub trait GoogleCalendarMutationProvider: Send + Sync + 'static {
/// longer exists at the provider surfaces as [`GoogleRsvpOutcome::Gone`];
/// absence of a self attendee surfaces as
/// [`GoogleRsvpOutcome::NotAttendee`].
+ ///
+ /// `scope` selects what the response covers: the master for
+ /// [`CalendarRsvpScope::All`], one exception instance for
+ /// [`CalendarRsvpScope::ThisEvent`].
fn rsvp_event(
&self,
access_token: &str,
target: &GoogleCalendarTarget,
- provider_event_id: &str,
+ master_provider_event_id: &str,
self_email: &str,
response: AttendeeResponseStatus,
+ scope: &CalendarRsvpScope,
) -> impl Future<Output = Result<GoogleRsvpOutcome, GoogleProviderError>> + Send;
}
@@ -188,6 +193,25 @@ pub enum CalendarDeletionScope {
},
}
+/// How much of a recurring series an RSVP applies to.
+///
+/// There is deliberately no this-and-following variant. The provider's Event
+/// resource addresses an exception by `originalStartTime` — exactly one
+/// instance — with no range field, so a forward response is inexpressible as
+/// a provider write and could only be emulated by enumerating instances,
+/// which an unbounded series never finishes. Both variants here are one
+/// exact provider call that Google remains authoritative for.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CalendarRsvpScope {
+ /// The entire series, recorded on the master.
+ All,
+ /// One occurrence, identified by its original start key.
+ ThisEvent {
+ /// Stable original-start key of the occurrence.
+ recurrence_id: String,
+ },
+}
+
/// Result of a provider mutation that reshapes a recurring series.
pub enum GoogleSeriesMutationOutcome {
/// The series survives; the echo carries its refreshed state.
@@ -386,12 +410,14 @@ pub trait CalendarMutationService: Send + Sync + 'static {
scope: CalendarDeletionScope,
) -> impl Future<Output = Result<(), CalendarMutationError>> + Send;
- /// Set the requester's inbox RSVP on an event and persist the echo.
+ /// Set the requester's inbox RSVP on an event — the whole series, one
+ /// occurrence, or an occurrence onward — and persist the echo.
fn respond_to_event(
&self,
requester_id: &str,
event_id: Uuid,
response: AttendeeResponseStatus,
+ scope: CalendarRsvpScope,
) -> impl Future<Output = Result<CalendarEvent, CalendarMutationError>> + Send;
}
diff --git a/crates/calendar_events/src/inbound/mutation_router.rs b/crates/calendar_events/src/inbound/mutation_router.rs
index 16901d83e4..75e6ba6e83 100644
--- a/crates/calendar_events/src/inbound/mutation_router.rs
+++ b/crates/calendar_events/src/inbound/mutation_router.rs
@@ -27,7 +27,9 @@ use crate::domain::{
AttendeeResponseStatus, CalendarAttendeeInput, CalendarEvent, CalendarEventDraft,
CalendarEventPatch, EventTime, EventTransparency, EventVisibility, VisibleCalendar,
},
- ports::{CalendarDeletionScope, CalendarMutationError, CalendarMutationService},
+ ports::{
+ CalendarDeletionScope, CalendarMutationError, CalendarMutationService, CalendarRsvpScope,
+ },
};
/// Router state for authenticated calendar mutations.
@@ -182,12 +184,34 @@ pub struct DeleteCalendarEventQuery {
pub recurrence_id: Option<String>,
}
+/// How much of a recurring series an RSVP applies to.
+///
+/// Unlike deletion there is no this-and-following variant: the provider
+/// cannot express a forward-scoped response, so offering one would be a
+/// promise sync could not keep.
+#[derive(Clone, Copy, Debug, Deserialize, utoipa::ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum CalendarRsvpScopeParam {
+ /// The entire series.
+ All,
+ /// One occurrence.
+ ThisEvent,
+}
+
/// Request body setting the requester's RSVP on an event.
#[derive(Debug, Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RsvpCalendarEventRequest {
/// The response to record for the connected account.
pub response: AttendeeResponseStatus,
+ /// How much of a recurring series the response covers. Omit to let
+ /// `recurrenceId` decide: the identified occurrence alone when one is
+ /// supplied, otherwise the whole series. An explicit `this_event` scope
+ /// requires `recurrenceId`, so a scoped request is never silently
+ /// widened to the series.
+ pub scope: Option<CalendarRsvpScopeParam>,
+ /// Original-start key of the occurrence the response targets.
+ pub recurrence_id: Option<String>,
}
/// Machine-readable failure category for calendar mutations.
@@ -517,12 +541,25 @@ where
S: CalendarMutationService,
Auth: MacroAuthorizationService,
{
+ let scope = match (request.scope, request.recurrence_id) {
+ (Some(CalendarRsvpScopeParam::All), _) | (None, None) => CalendarRsvpScope::All,
+ (Some(CalendarRsvpScopeParam::ThisEvent), Some(recurrence_id))
+ | (None, Some(recurrence_id)) => CalendarRsvpScope::ThisEvent { recurrence_id },
+ (Some(CalendarRsvpScopeParam::ThisEvent), None) => {
+ return Err(CalendarMutationApiError {
+ code: CalendarMutationErrorCode::InvalidInput,
+ message: "a this-event response requires recurrenceId".to_string(),
+ status: StatusCode::BAD_REQUEST,
+ });
+ }
+ };
let event = state
.service
.respond_to_event(
user.authorization.user.macro_user_id.as_ref(),
event_id,
request.response,
+ scope,
)
.await?;
Ok(Json(event))
diff --git a/crates/calendar_events/src/outbound/google.rs b/crates/calendar_events/src/outbound/google.rs
index e396a5606e..df645828f5 100644
--- a/crates/calendar_events/src/outbound/google.rs
+++ b/crates/calendar_events/src/outbound/google.rs
@@ -18,8 +18,8 @@ use crate::domain::{
OccurrenceRange, ProviderCalendar,
},
ports::{
- GoogleCalendarMutationProvider, GoogleCalendarProvider, GoogleEventSyncContext,
- GoogleProviderError, GoogleProviderErrorKind, GoogleRsvpOutcome,
+ CalendarRsvpScope, GoogleCalendarMutationProvider, GoogleCalendarProvider,
+ GoogleEventSyncContext, GoogleProviderError, GoogleProviderErrorKind, GoogleRsvpOutcome,
GoogleSeriesMutationOutcome,
},
};
@@ -1032,12 +1032,118 @@ impl<G: GoogleRequestGate> GoogleCalendarMutationProvider for GoogleCalendarClie
&self,
access_token: &str,
target: &GoogleCalendarTarget,
- provider_event_id: &str,
+ master_provider_event_id: &str,
self_email: &str,
response: AttendeeResponseStatus,
+ scope: &CalendarRsvpScope,
) -> Result<GoogleRsvpOutcome, GoogleProviderError> {
- // Patching `attendees` replaces the whole array, so start from the
- // provider's current list rather than a possibly stale projection.
+ let patch_target = match scope {
+ CalendarRsvpScope::All => Some(master_provider_event_id.to_string()),
+ CalendarRsvpScope::ThisEvent { recurrence_id } => {
+ // The occurrence being gone from the series does not doom the
+ // series itself; the refresh below converges the projection.
+ self.instance_id_at(
+ access_token,
+ target,
+ master_provider_event_id,
+ recurrence_id,
+ )
+ .await?
+ }
+ };
+ if let Some(provider_event_id) = &patch_target {
+ match self
+ .patch_self_response(
+ access_token,
+ target,
+ provider_event_id,
+ self_email,
+ response,
+ )
+ .await?
+ {
+ RsvpPatch::Applied => {}
+ RsvpPatch::NotAttendee => return Ok(GoogleRsvpOutcome::NotAttendee),
+ RsvpPatch::Gone => return Ok(GoogleRsvpOutcome::Gone),
+ }
+ }
+
+ // Every scope resolves by refreshing the series from Google, which
+ // owns recurrence expansion and now holds the exceptions just written.
+ match self
+ .series_outcome(access_token, target, master_provider_event_id)
+ .await?
+ {
+ GoogleSeriesMutationOutcome::Applied(upsert) => Ok(GoogleRsvpOutcome::Applied(upsert)),
+ GoogleSeriesMutationOutcome::SeriesDeleted | GoogleSeriesMutationOutcome::Gone => {
+ Ok(GoogleRsvpOutcome::Gone)
+ }
+ }
+ }
+}
+
+/// Outcome of writing the connected account's response to one provider event.
+enum RsvpPatch {
+ Applied,
+ NotAttendee,
+ Gone,
+}
+
+impl<G: GoogleRequestGate> GoogleCalendarClient<G> {
+ /// Resolve one occurrence of a series to the provider id that carries it,
+ /// creating no exception of its own.
+ async fn instance_id_at(
+ &self,
+ access_token: &str,
+ target: &GoogleCalendarTarget,
+ master_provider_event_id: &str,
+ recurrence_id: &str,
+ ) -> Result<Option<String>, GoogleProviderError> {
+ let Some(start) = parse_occurrence_start(recurrence_id) else {
+ return Err(GoogleProviderError::new(
+ GoogleProviderErrorKind::Permanent,
+ "the occurrence identifier is not a recognizable start",
+ ));
+ };
+ let window = occurrence_window(&start);
+ Ok(self
+ .instances(
+ access_token,
+ target.email_link_id,
+ &target.provider_calendar_id,
+ master_provider_event_id,
+ &window,
+ )
+ .await?
+ .into_iter()
+ .find(|instance| {
+ instance
+ .original_start_time
+ .as_ref()
+ .and_then(google_start)
+ .is_some_and(|candidate| candidate == start)
+ })
+ .map(|instance| instance.id))
+ }
+
+ /// Rewrite just the connected account's `responseStatus` on one provider
+ /// event, leaving every other attendee untouched.
+ ///
+ /// The patch sends `attendeesOmitted: true` with only the connected
+ /// attendee's entry — Google's documented mechanism for updating one
+ /// participant's response — so a concurrent attendee change between our
+ /// read and this write cannot be overwritten by a full-array replace.
+ /// The read stays: it distinguishes a vanished event from a requester
+ /// who simply is not on the guest list, which the patch alone would
+ /// answer by quietly adding them.
+ async fn patch_self_response(
+ &self,
+ access_token: &str,
+ target: &GoogleCalendarTarget,
+ provider_event_id: &str,
+ self_email: &str,
+ response: AttendeeResponseStatus,
+ ) -> Result<RsvpPatch, GoogleProviderError> {
let Some(current) = self
.event(
access_token,
@@ -1047,37 +1153,30 @@ impl<G: GoogleRequestGate> GoogleCalendarMutationProvider for GoogleCalendarClie
)
.await?
else {
- return Ok(GoogleRsvpOutcome::Gone);
+ return Ok(RsvpPatch::Gone);
};
- let mut attendees: Vec<GoogleAttendee> = current.attendees.clone().unwrap_or_default();
- let self_position = attendees
+ let attendees: Vec<GoogleAttendee> = current.attendees.clone().unwrap_or_default();
+ let self_attendee = attendees
.iter()
- .position(|attendee| attendee.is_self)
+ .find(|attendee| attendee.is_self)
.or_else(|| {
- attendees.iter().position(|attendee| {
+ attendees.iter().find(|attendee| {
attendee
.email
.as_deref()
.is_some_and(|email| email.eq_ignore_ascii_case(self_email))
})
});
- let Some(position) = self_position else {
- return Ok(GoogleRsvpOutcome::NotAttendee);
- };
- attendees[position].response_status = Some(google_response_status(response).to_string());
- let body = serde_json::json!({ "attendees": attendees });
- let Some(updated) = self
- .patch_event_raw(access_token, target, provider_event_id, body)
- .await?
- else {
- return Ok(GoogleRsvpOutcome::Gone);
+ let Some(self_attendee) = self_attendee else {
+ return Ok(RsvpPatch::NotAttendee);
};
+ let body = rsvp_patch_body(self_attendee, response);
match self
- .mutation_readback(access_token, target, updated)
+ .patch_event_raw(access_token, target, provider_event_id, body)
.await?
{
- Some(upsert) => Ok(GoogleRsvpOutcome::Applied(Box::new(upsert))),
- None => Ok(GoogleRsvpOutcome::Gone),
+ Some(_) => Ok(RsvpPatch::Applied),
+ None => Ok(RsvpPatch::Gone),
}
}
}
@@ -1175,6 +1274,20 @@ fn google_response_status(status: AttendeeResponseStatus) -> &'static str {
}
}
+/// Body updating only the connected attendee's response: `attendeesOmitted`
+/// tells Google the array is partial, so other attendees survive untouched.
+fn rsvp_patch_body(
+ self_attendee: &GoogleAttendee,
+ response: AttendeeResponseStatus,
+) -> serde_json::Value {
+ let mut entry = self_attendee.clone();
+ entry.response_status = Some(google_response_status(response).to_string());
+ serde_json::json!({
+ "attendeesOmitted": true,
+ "attendees": [entry],
+ })
+}
+
/// Serialize an event time as Google `start`/`end` objects. The unused shape
/// is set to an explicit `null` so a patch can switch between timed and
/// all-day; inserts ignore the nulls.
@@ -1520,6 +1633,9 @@ fn map_upsert(
description: exception.description,
location: exception.location,
status: Some(google_status(exception.status.as_deref())),
+ attendees: exception
+ .attendees
+ .map(|attendees| attendees.into_iter().filter_map(map_attendee).collect()),
})
})()
.inspect_err(|error| {
diff --git a/crates/calendar_events/src/outbound/google/test.rs b/crates/calendar_events/src/outbound/google/test.rs
index 5ffa6a6d20..7d5643eabf 100644
--- a/crates/calendar_events/src/outbound/google/test.rs
+++ b/crates/calendar_events/src/outbound/google/test.rs
@@ -439,3 +439,122 @@ fn occurrence_keys_parse_back_to_starts() {
&master
));
}
+
+/// Google's out-of-office auto-decline leaves the master untouched and writes
+/// the decline onto the exception instance, so the exception's attendee list
+/// must survive mapping — it is the only record that the occurrence changed.
+#[test]
+fn exception_attendees_are_carried_onto_the_override() {
+ let master: GoogleEvent = serde_json::from_value(serde_json::json!({
+ "id": "provider-master",
+ "iCalUID": "[email protected]",
+ "summary": "Prod Deploy",
+ "start": {"dateTime": "2026-08-13T22:00:00Z", "timeZone": "UTC"},
+ "end": {"dateTime": "2026-08-13T22:30:00Z", "timeZone": "UTC"},
+ "recurrence": ["RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"],
+ "attendees": [
+ {"email": "[email protected]", "self": true, "responseStatus": "accepted"},
+ {"email": "[email protected]", "organizer": true, "responseStatus": "accepted"}
+ ],
+ "created": "2026-05-18T22:00:00Z",
+ "updated": "2026-05-18T22:00:00Z"
+ }))
+ .unwrap();
+ let exception: GoogleEvent = serde_json::from_value(serde_json::json!({
+ "id": "provider-master_20260814T220000Z",
+ "iCalUID": "[email protected]",
+ "summary": "Prod Deploy",
+ "recurringEventId": "provider-master",
+ "originalStartTime": {"dateTime": "2026-08-14T22:00:00Z", "timeZone": "UTC"},
+ "start": {"dateTime": "2026-08-14T22:00:00Z", "timeZone": "UTC"},
+ "end": {"dateTime": "2026-08-14T22:30:00Z", "timeZone": "UTC"},
+ "status": "confirmed",
+ "attendees": [
+ {
+ "email": "[email protected]",
+ "self": true,
+ "responseStatus": "declined",
+ "comment": "Declined because I am out of office"
+ },
+ {"email": "[email protected]", "organizer": true, "responseStatus": "accepted"}
+ ],
+ "created": "2026-05-18T22:00:00Z",
+ "updated": "2026-08-10T14:48:00Z"
+ }))
+ .unwrap();
+ let range = OccurrenceRange {
+ starts_at: DateTime::parse_from_rfc3339("2026-08-01T00:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc),
+ ends_at: DateTime::parse_from_rfc3339("2026-09-01T00:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc),
+ start_date: NaiveDate::from_ymd_opt(2026, 8, 1).unwrap(),
+ end_date: NaiveDate::from_ymd_opt(2026, 9, 1).unwrap(),
+ };
+ let target = GoogleCalendarTarget {
+ owner_id: "macro|[email protected]".to_string(),
+ email_link_id: Uuid::now_v7(),
+ account_id: Uuid::now_v7(),
+ calendar_id: Uuid::now_v7(),
+ provider_calendar_id: "primary".to_string(),
+ is_read_only: false,
+ range,
+ };
+
+ let upsert = map_upsert(&target, master, vec![exception], Vec::new()).unwrap();
+
+ // The series answer is unchanged: only the one occurrence declined.
+ let series_self = upsert
+ .event
+ .attendees
+ .iter()
+ .find(|attendee| attendee.is_self)
+ .expect("the master carries a self attendee");
+ assert_eq!(
+ series_self.response_status,
+ AttendeeResponseStatus::Accepted
+ );
+
+ let override_attendees = upsert.overrides[0]
+ .attendees
+ .as_ref()
+ .expect("the exception carried an attendee list");
+ let override_self = override_attendees
+ .iter()
+ .find(|attendee| attendee.is_self)
+ .expect("the exception carries a self attendee");
+ assert_eq!(
+ override_self.response_status,
+ AttendeeResponseStatus::Declined
+ );
+ assert_eq!(
+ override_self.comment.as_deref(),
+ Some("Declined because I am out of office")
+ );
+ // Every attendee survives, not just the one whose response changed.
+ assert_eq!(override_attendees.len(), 2);
+}
+
+/// The RSVP patch must not replace the full attendee array: a concurrent
+/// attendee change between our read and the patch would be silently undone.
+/// `attendeesOmitted` marks the array partial so Google merges by email.
+#[test]
+fn rsvp_patch_updates_only_the_connected_attendee() {
+ let self_attendee: GoogleAttendee = serde_json::from_value(serde_json::json!({
+ "email": "[email protected]",
+ "self": true,
+ "responseStatus": "needsAction",
+ "comment": "unrelated state that must survive"
+ }))
+ .unwrap();
+
+ let body = rsvp_patch_body(&self_attendee, AttendeeResponseStatus::Declined);
+
+ assert_eq!(body["attendeesOmitted"], serde_json::json!(true));
+ let attendees = body["attendees"].as_array().unwrap();
+ assert_eq!(attendees.len(), 1);
+ assert_eq!(attendees[0]["email"], "[email protected]");
+ assert_eq!(attendees[0]["responseStatus"], "declined");
+ assert_eq!(attendees[0]["comment"], "unrelated state that must survive");
+}
diff --git a/crates/calendar_events/src/outbound/pg.rs b/crates/calendar_events/src/outbound/pg.rs
index d08f7e2065..67de3da57d 100644
--- a/crates/calendar_events/src/outbound/pg.rs
+++ b/crates/calendar_events/src/outbound/pg.rs
@@ -3,6 +3,7 @@
use std::collections::HashMap;
use chrono::{DateTime, NaiveDate, Utc};
+use futures::try_join;
use rootcause::Report;
use serde::{Deserialize, Serialize};
use sqlx::{PgPool, Postgres, Transaction};
@@ -298,6 +299,18 @@ struct OccurrenceJoinRow {
updated_at: DateTime<Utc>,
}
+struct OverrideAttendeeRow {
+ event_id: Uuid,
+ recurrence_id: String,
+ email: Option<String>,
+ display_name: Option<String>,
+ response_status: Option<String>,
+ is_organizer: Option<bool>,
+ is_optional: Option<bool>,
+ is_self: Option<bool>,
+ comment: Option<String>,
+}
+
struct AttendeeRow {
event_id: Uuid,
email: String,
@@ -752,13 +765,27 @@ impl CalendarRepository for PgCalendarRepository {
.await
.map_err(report)?;
let event_ids: Vec<_> = rows.iter().map(|row| row.event_id).collect();
- let attendees = fetch_attendees(&self.pool, &event_ids).await?;
+ let (attendees, override_attendees) = try_join!(
+ fetch_attendees(&self.pool, &event_ids),
+ fetch_override_attendees(&self.pool, &event_ids),
+ )?;
rows.into_iter()
.map(|row| {
let event_id = row.event_id;
let occurrence = occurrence_from_join(&row)?;
- let event =
- event_from_join(row, attendees.get(&event_id).cloned().unwrap_or_default())?;
+ // An exception's attendee list replaces the series list for
+ // that occurrence alone: Google records an instance-scoped
+ // RSVP there and never on the master.
+ let effective = occurrence
+ .recurrence_id
+ .as_ref()
+ .and_then(|recurrence_id| {
+ override_attendees.get(&(event_id, recurrence_id.clone()))
+ })
+ .or_else(|| attendees.get(&event_id))
+ .cloned()
+ .unwrap_or_default();
+ let event = event_from_join(row, effective)?;
Ok((event, occurrence))
})
.collect()
@@ -2244,9 +2271,9 @@ async fn replace_overrides(
INSERT INTO calendar_event_overrides (
event_id, recurrence_id, original_starts_at, original_start_date,
starts_at, ends_at, start_date, end_date,
- title, description, location, status
+ title, description, location, status, attendees_overridden
)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
"#,
event_id,
&event_override.recurrence_id,
@@ -2260,10 +2287,41 @@ async fn replace_overrides(
event_override.description.as_deref(),
event_override.location.as_deref(),
event_override.status.map(EventStatus::as_str),
+ event_override.attendees.is_some(),
)
.execute(&mut **tx)
.await
.map_err(report)?;
+ for attendee in event_override.attendees.iter().flatten() {
+ sqlx::query!(
+ r#"
+ INSERT INTO calendar_event_override_attendees (
+ event_id, recurrence_id, email, display_name, response_status,
+ is_organizer, is_optional, is_self, comment
+ )
+ VALUES ($1, $2, lower($3), $4, $5, $6, $7, $8, $9)
+ ON CONFLICT (event_id, recurrence_id, email) DO UPDATE SET
+ display_name = EXCLUDED.display_name,
+ response_status = EXCLUDED.response_status,
+ is_organizer = EXCLUDED.is_organizer,
+ is_optional = EXCLUDED.is_optional,
+ is_self = EXCLUDED.is_self,
+ comment = EXCLUDED.comment
+ "#,
+ event_id,
+ &event_override.recurrence_id,
+ &attendee.email,
+ attendee.display_name.as_deref(),
+ attendee.response_status.as_str(),
+ attendee.is_organizer,
+ attendee.is_optional,
+ attendee.is_self,
+ attendee.comment.as_deref(),
+ )
+ .execute(&mut **tx)
+ .await
+ .map_err(report)?;
+ }
}
Ok(())
}
@@ -2348,6 +2406,64 @@ async fn fetch_attendees(
Ok(by_event)
}
+/// Per-occurrence attendee overrides for the supplied events, keyed by
+/// `(event_id, recurrence_id)`.
+async fn fetch_override_attendees(
+ pool: &PgPool,
+ event_ids: &[Uuid],
+) -> Result<HashMap<(Uuid, String), Vec<CalendarAttendee>>, Report> {
+ if event_ids.is_empty() {
+ return Ok(HashMap::new());
+ }
+ // Driven from the overrides table so an explicitly-empty replacement
+ // list still produces a map entry: absence of an entry means "inherit
+ // the series attendees", never "the exception has no attendees".
+ let rows = sqlx::query_as!(
+ OverrideAttendeeRow,
+ r#"
+ SELECT
+ override.event_id,
+ override.recurrence_id,
+ attendee.email AS "email?",
+ attendee.display_name,
+ attendee.response_status AS "response_status?",
+ attendee.is_organizer AS "is_organizer?",
+ attendee.is_optional AS "is_optional?",
+ attendee.is_self AS "is_self?",
+ attendee.comment
+ FROM calendar_event_overrides override
+ LEFT JOIN calendar_event_override_attendees attendee
+ ON attendee.event_id = override.event_id
+ AND attendee.recurrence_id = override.recurrence_id
+ WHERE override.event_id = ANY($1)
+ AND override.attendees_overridden
+ ORDER BY override.event_id, override.recurrence_id, attendee.email
+ "#,
+ event_ids,
+ )
+ .fetch_all(pool)
+ .await
+ .map_err(report)?;
+ let mut by_occurrence: HashMap<(Uuid, String), Vec<CalendarAttendee>> = HashMap::new();
+ for row in rows {
+ let attendees = by_occurrence
+ .entry((row.event_id, row.recurrence_id))
+ .or_default();
+ if let (Some(email), Some(response_status)) = (row.email, row.response_status) {
+ attendees.push(CalendarAttendee {
+ email,
+ display_name: row.display_name,
+ response_status: attendee_status(&response_status),
+ is_organizer: row.is_organizer.unwrap_or_default(),
+ is_optional: row.is_optional.unwrap_or_default(),
+ is_self: row.is_self.unwrap_or_default(),
+ comment: row.comment,
+ });
+ }
+ }
+ Ok(by_occurrence)
+}
+
type SplitTime = (
Option<DateTime<Utc>>,
Option<DateTime<Utc>>,
diff --git a/crates/calendar_events/src/outbound/pg/test.rs b/crates/calendar_events/src/outbound/pg/test.rs
index bcfd1757fc..20d8e8ea7e 100644
--- a/crates/calendar_events/src/outbound/pg/test.rs
+++ b/crates/calendar_events/src/outbound/pg/test.rs
@@ -1145,6 +1145,161 @@ async fn occurrence_range_uses_overlap_indexes_and_preserves_attendees(pool: PgP
assert!(result.iter().all(|(event, _)| event.attendees.len() == 1));
}
+/// A Google out-of-office auto-decline records the decline on the exception
+/// instance and never on the series master, so the occurrence carrying that
+/// exception must project the exception's attendees while its siblings keep
+/// the series answer.
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn occurrence_attendee_override_shadows_the_series_response(pool: PgPool) {
+ let owner_id = "macro|[email protected]";
+ let link_id = insert_link(&pool, owner_id).await;
+ let repo = PgCalendarRepository::new(pool);
+ let provider = provider_ids(&repo, link_id).await;
+ let mut upsert = timed_upsert(
+ owner_id,
+ link_id,
+ provider,
+ "Declined instance",
+ 1,
+ );
+ let self_attendee = CalendarAttendee {
+ email: "[email protected]".to_string(),
+ display_name: Some("Self".to_string()),
+ response_status: AttendeeResponseStatus::Accepted,
+ is_organizer: false,
+ is_optional: false,
+ is_self: true,
+ comment: None,
+ };
+ upsert.event.attendees.push(self_attendee.clone());
+
+ // The second occurrence is the exception: same event, declined for us.
+ let declined_start = Utc.with_ymd_and_hms(2026, 7, 25, 14, 0, 0).unwrap();
+ let recurrence_id = declined_start.to_rfc3339();
+ upsert.occurrences[1].recurrence_id = Some(recurrence_id.clone());
+ upsert.overrides = vec![CalendarEventOverride {
+ recurrence_id: recurrence_id.clone(),
+ original_time: EventStart::Timed(declined_start),
+ time: EventTime::Timed {
+ starts_at: declined_start,
+ ends_at: declined_start + Duration::hours(1),
+ time_zone: Some("UTC".to_string()),
+ },
+ title: None,
+ description: None,
+ location: None,
+ status: Some(EventStatus::Confirmed),
+ attendees: Some(vec![CalendarAttendee {
+ response_status: AttendeeResponseStatus::Declined,
+ comment: Some("Declined because I am out of office".to_string()),
+ ..self_attendee
+ }]),
+ }];
+ repo.upsert_event_fixture(upsert).await.unwrap();
+
+ let starts_at = Utc.with_ymd_and_hms(2026, 7, 24, 0, 0, 0).unwrap();
+ let ends_at = Utc.with_ymd_and_hms(2026, 7, 26, 0, 0, 0).unwrap();
+ let result = repo
+ .list_occurrences(
+ owner_id,
+ OccurrenceRange {
+ starts_at,
+ ends_at,
+ start_date: starts_at.date_naive(),
+ end_date: ends_at.date_naive(),
+ },
+ None,
+ 100,
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(result.len(), 2);
+ let response_at = |key: &str| {
+ result
+ .iter()
+ .find(|(_, occurrence)| occurrence.occurrence_key == key)
+ .and_then(|(event, _)| event.attendees.iter().find(|attendee| attendee.is_self))
+ .map(|attendee| attendee.response_status)
+ };
+ assert_eq!(
+ response_at(&recurrence_id),
+ Some(AttendeeResponseStatus::Declined)
+ );
+ let series_start = Utc.with_ymd_and_hms(2026, 7, 24, 14, 0, 0).unwrap();
+ assert_eq!(
+ response_at(&series_start.to_rfc3339()),
+ Some(AttendeeResponseStatus::Accepted)
+ );
+}
+
+/// An exception that explicitly replaces the attendee list with an empty one
+/// must project no attendees for that occurrence — not fall back to the
+/// series list, which only an exception without an attendee list inherits.
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn explicitly_empty_override_attendees_do_not_inherit_the_series_list(pool: PgPool) {
+ let owner_id = "macro|[email protected]";
+ let link_id = insert_link(&pool, owner_id).await;
+ let repo = PgCalendarRepository::new(pool);
+ let provider = provider_ids(&repo, link_id).await;
+ let mut upsert = timed_upsert(
+ owner_id,
+ link_id,
+ provider,
+ "Emptied instance",
+ 1,
+ );
+
+ let emptied_start = Utc.with_ymd_and_hms(2026, 7, 25, 14, 0, 0).unwrap();
+ let recurrence_id = emptied_start.to_rfc3339();
+ upsert.occurrences[1].recurrence_id = Some(recurrence_id.clone());
+ upsert.overrides = vec![CalendarEventOverride {
+ recurrence_id: recurrence_id.clone(),
+ original_time: EventStart::Timed(emptied_start),
+ time: EventTime::Timed {
+ starts_at: emptied_start,
+ ends_at: emptied_start + Duration::hours(1),
+ time_zone: Some("UTC".to_string()),
+ },
+ title: None,
+ description: None,
+ location: None,
+ status: Some(EventStatus::Confirmed),
+ attendees: Some(Vec::new()),
+ }];
+ repo.upsert_event_fixture(upsert).await.unwrap();
+
+ let starts_at = Utc.with_ymd_and_hms(2026, 7, 24, 0, 0, 0).unwrap();
+ let ends_at = Utc.with_ymd_and_hms(2026, 7, 26, 0, 0, 0).unwrap();
+ let result = repo
+ .list_occurrences(
+ owner_id,
+ OccurrenceRange {
+ starts_at,
+ ends_at,
+ start_date: starts_at.date_naive(),
+ end_date: ends_at.date_naive(),
+ },
+ None,
+ 100,
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(result.len(), 2);
+ let attendees_at = |key: &str| {
+ result
+ .iter()
+ .find(|(_, occurrence)| occurrence.occurrence_key == key)
+ .map(|(event, _)| event.attendees.len())
+ };
+ let series_start = Utc.with_ymd_and_hms(2026, 7, 24, 14, 0, 0).unwrap();
+ assert_eq!(attendees_at(&series_start.to_rfc3339()), Some(1));
+ assert_eq!(attendees_at(&recurrence_id), Some(0));
+}
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn occurrence_cursor_is_stable_when_occurrences_share_a_start(pool: PgPool) {
let owner_id = "macro|[email protected]";
diff --git a/crates/macro_db_client/migrations/20260810154320_calendar_override_attendees.sql b/crates/macro_db_client/migrations/20260810154320_calendar_override_attendees.sql
new file mode 100644
index 0000000000..e47c6f431f
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260810154320_calendar_override_attendees.sql
@@ -0,0 +1,36 @@
+-- Per-occurrence attendee state for recurrence exceptions.
+--
+-- Google never records an instance-scoped RSVP on the series master: an
+-- attendee responding to one occurrence — or Google auto-declining it for an
+-- out-of-office event — produces an exception instance carrying the full
+-- attendee list with that one responseStatus changed. `calendar_event_attendees`
+-- is keyed by event alone, so that state had nowhere to live and was dropped.
+--
+-- The marker distinguishes an exception that replaces the attendee list with
+-- an empty one from an exception that inherits the series attendees: both
+-- store zero attendee rows, and only the marker keeps reads from falling
+-- back to the series list for an explicitly-empty override.
+ALTER TABLE calendar_event_overrides
+ ADD COLUMN IF NOT EXISTS attendees_overridden boolean NOT NULL DEFAULT false;
+
+CREATE TABLE IF NOT EXISTS calendar_event_override_attendees (
+ event_id uuid NOT NULL,
+ recurrence_id text NOT NULL,
+ email text NOT NULL,
+ display_name text,
+ response_status text NOT NULL DEFAULT 'needs_action'
+ CHECK (response_status IN ('needs_action', 'accepted', 'declined', 'tentative')),
+ is_organizer boolean NOT NULL DEFAULT false,
+ is_optional boolean NOT NULL DEFAULT false,
+ is_self boolean NOT NULL DEFAULT false,
+ comment text,
+ PRIMARY KEY (event_id, recurrence_id, email),
+ -- Overrides are replaced wholesale on every series refresh, so cascading
+ -- keeps this table from outliving the exception it describes.
+ FOREIGN KEY (event_id, recurrence_id)
+ REFERENCES calendar_event_overrides (event_id, recurrence_id)
+ ON DELETE CASCADE
+);
+
+CREATE INDEX IF NOT EXISTS calendar_event_override_attendees_event_idx
+ ON calendar_event_override_attendees (event_id);
diff --git a/packages/sdk/generated/email/index.ts b/packages/sdk/generated/email/index.ts
index 74fe03b4a4..61cb1b35ef 100644
--- a/packages/sdk/generated/email/index.ts
+++ b/packages/sdk/generated/email/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarAttendeeInputBody, CalendarDeletionScopeParam, CalendarEvent, CalendarMutationApiError, CalendarMutationErrorCode, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventStatus, EventTime, EventTransparency, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, Message, MessageListVisibility, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RefreshCalendarEvent, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadSummary, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, VisibleCalendar } from './types.gen';
+export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarAttendeeInputBody, CalendarDeletionScopeParam, CalendarEvent, CalendarMutationApiError, CalendarMutationErrorCode, CalendarRsvpScopeParam, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventStatus, EventTime, EventTransparency, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, Message, MessageListVisibility, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RefreshCalendarEvent, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadSummary, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, VisibleCalendar } from './types.gen';
diff --git a/packages/sdk/generated/email/types.gen.ts b/packages/sdk/generated/email/types.gen.ts
index 0c881ec6fe..38c18d53a3 100644
--- a/packages/sdk/generated/email/types.gen.ts
+++ b/packages/sdk/generated/email/types.gen.ts
@@ -693,6 +693,15 @@ export type CalendarMutationApiError = {
*/
export type CalendarMutationErrorCode = 'not_found' | 'read_only' | 'no_writable_calendar' | 'not_attendee' | 'invalid_input' | 'reauth_required' | 'provider_rejected' | 'retryable' | 'persist_failed';
+/**
+ * How much of a recurring series an RSVP applies to.
+ *
+ * Unlike deletion there is no this-and-following variant: the provider
+ * cannot express a forward-scoped response, so offering one would be a
+ * promise sync could not keep.
+ */
+export type CalendarRsvpScopeParam = 'all' | 'this_event';
+
export type CancelBackfillParams = {
job_id: string;
};
@@ -1198,10 +1207,15 @@ export type ResyncResponse = {
* Request body setting the requester's RSVP on an event.
*/
export type RsvpCalendarEventRequest = {
+ /**
+ * Original-start key of the occurrence the response targets.
+ */
+ recurrenceId?: string | null;
/**
* The response to record for the connected account.
*/
response: AttendeeResponseStatus;
+ scope?: null | CalendarRsvpScopeParam;
};
/**
diff --git a/packages/sdk/specs/email.json b/packages/sdk/specs/email.json
index 5dd2f739e0..653b791466 100644
--- a/packages/sdk/specs/email.json
+++ b/packages/sdk/specs/email.json
@@ -4475,6 +4475,11 @@
"persist_failed"
]
},
+ "CalendarRsvpScopeParam": {
+ "type": "string",
+ "description": "How much of a recurring series an RSVP applies to.\n\nUnlike deletion there is no this-and-following variant: the provider\ncannot express a forward-scoped response, so offering one would be a\npromise sync could not keep.",
+ "enum": ["all", "this_event"]
+ },
"CancelBackfillParams": {
"type": "object",
"required": ["job_id"],
@@ -5589,9 +5594,24 @@
"description": "Request body setting the requester's RSVP on an event.",
"required": ["response"],
"properties": {
+ "recurrenceId": {
+ "type": ["string", "null"],
+ "description": "Original-start key of the occurrence the response targets."
+ },
"response": {
"$ref": "#/components/schemas/AttendeeResponseStatus",
"description": "The response to record for the connected account."
+ },
+ "scope": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/CalendarRsvpScopeParam",
+ "description": "How much of a recurring series the response covers. Omit to let\n`recurrenceId` decide: the identified occurrence alone when one is\nsupplied, otherwise the whole series. An explicit `this_event` scope\nrequires `recurrenceId`, so a scoped request is never silently\nwidened to the series."
+ }
+ ]
}
}
},