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 imported point events across sync and cache (#7762)

gbirmanad3de7b3e0f2
diff --git a/.sqlx/query-6324a86788fa01ce25e2440f0ae0bdeb160386e08a08a7b9d388eaeceb79b081.json b/.sqlx/query-6324a86788fa01ce25e2440f0ae0bdeb160386e08a08a7b9d388eaeceb79b081.json
new file mode 100644
index 0000000000..e7b35a8d08
--- /dev/null
+++ b/.sqlx/query-6324a86788fa01ce25e2440f0ae0bdeb160386e08a08a7b9d388eaeceb79b081.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE calendar_event_occurrences SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE event_id=$1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Timestamptz",
+ "Timestamptz",
+ "Date"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "6324a86788fa01ce25e2440f0ae0bdeb160386e08a08a7b9d388eaeceb79b081"
+}
diff --git a/.sqlx/query-1fd7598ab3adbedd997125565b274d743814a4006e7abba1d646aa5cfe2b28b1.json b/.sqlx/query-930a7c65f953793b5279d182c50bbb4bf710b4b8861201c1b5c068074a005c4c.json
similarity index 88%
rename from .sqlx/query-1fd7598ab3adbedd997125565b274d743814a4006e7abba1d646aa5cfe2b28b1.json
rename to .sqlx/query-930a7c65f953793b5279d182c50bbb4bf710b4b8861201c1b5c068074a005c4c.json
index ea39d758cd..341e5bb16f 100644
--- a/.sqlx/query-1fd7598ab3adbedd997125565b274d743814a4006e7abba1d646aa5cfe2b28b1.json
+++ b/.sqlx/query-930a7c65f953793b5279d182c50bbb4bf710b4b8861201c1b5c068074a005c4c.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n occurrence.event_id,\n event.source_link_id,\n occurrence.occurrence_key,\n occurrence.recurrence_id,\n occurrence.starts_at AS occurrence_starts_at,\n occurrence.ends_at AS occurrence_ends_at,\n occurrence.start_date AS occurrence_start_date,\n occurrence.end_date AS occurrence_end_date,\n occurrence.is_cancelled,\n override.title AS override_title,\n override.description AS override_description,\n override.location AS override_location,\n override.status AS override_status,\n event.owner_id,\n event.ical_uid,\n event.title,\n event.description,\n event.location,\n event.status,\n event.visibility,\n event.transparency,\n event.event_type,\n event.starts_at,\n event.ends_at,\n event.start_date,\n event.end_date,\n event.time_zone,\n event.recurrence_lines,\n event.organizer_email,\n event.organizer_name,\n event.creator_email,\n event.creator_name,\n event.conference_url,\n event.conference_provider,\n event.sequence,\n event.is_read_only,\n event.reminders_use_default,\n event.reminder_overrides,\n event.created_at,\n event.updated_at\n FROM calendar_event_occurrences occurrence\n JOIN calendar_events event ON event.id = occurrence.event_id\n LEFT JOIN calendar_event_overrides override\n ON override.event_id = occurrence.event_id\n AND override.recurrence_id = occurrence.recurrence_id\n WHERE occurrence.owner_id IN (\n SELECT $1::text\n UNION\n SELECT link.child_macro_id\n FROM macro_user_links link\n WHERE link.primary_macro_id = $1\n )\n AND event.status <> 'cancelled'\n AND NOT occurrence.is_cancelled\n AND (\n event.owner_id = $1\n OR EXISTS (\n SELECT 1\n FROM macro_user_links link\n WHERE link.link_id = event.source_link_id\n AND link.primary_macro_id = $1\n )\n )\n AND (\n occurrence.timed_span && tstzrange($2, $3, '[)')\n OR occurrence.day_span && daterange($4, $5, '[)')\n )\n AND (\n $6::timestamptz IS NULL\n OR (\n COALESCE(\n occurrence.starts_at,\n occurrence.start_date::timestamp AT TIME ZONE 'UTC'\n ),\n occurrence.event_id,\n occurrence.occurrence_key\n ) > ($6, $7, $8)\n )\n ORDER BY\n COALESCE(occurrence.starts_at, occurrence.start_date::timestamp AT TIME ZONE 'UTC'),\n occurrence.event_id,\n occurrence.occurrence_key\n LIMIT $9\n ",
+ "query": "\n SELECT\n occurrence.event_id,\n event.source_link_id,\n occurrence.occurrence_key,\n occurrence.recurrence_id,\n occurrence.starts_at AS occurrence_starts_at,\n occurrence.ends_at AS occurrence_ends_at,\n occurrence.start_date AS occurrence_start_date,\n occurrence.end_date AS occurrence_end_date,\n occurrence.is_cancelled,\n override.title AS override_title,\n override.description AS override_description,\n override.location AS override_location,\n override.status AS override_status,\n event.owner_id,\n event.ical_uid,\n event.title,\n event.description,\n event.location,\n event.status,\n event.visibility,\n event.transparency,\n event.event_type,\n event.starts_at,\n event.ends_at,\n event.start_date,\n event.end_date,\n event.time_zone,\n event.recurrence_lines,\n event.organizer_email,\n event.organizer_name,\n event.creator_email,\n event.creator_name,\n event.conference_url,\n event.conference_provider,\n event.sequence,\n event.is_read_only,\n event.reminders_use_default,\n event.reminder_overrides,\n event.created_at,\n event.updated_at\n FROM calendar_event_occurrences occurrence\n JOIN calendar_events event ON event.id = occurrence.event_id\n LEFT JOIN calendar_event_overrides override\n ON override.event_id = occurrence.event_id\n AND override.recurrence_id = occurrence.recurrence_id\n WHERE occurrence.owner_id IN (\n SELECT $1::text\n UNION\n SELECT link.child_macro_id\n FROM macro_user_links link\n WHERE link.primary_macro_id = $1\n )\n AND event.status <> 'cancelled'\n AND NOT occurrence.is_cancelled\n AND (\n event.owner_id = $1\n OR EXISTS (\n SELECT 1\n FROM macro_user_links link\n WHERE link.link_id = event.source_link_id\n AND link.primary_macro_id = $1\n )\n )\n AND (\n occurrence.timed_span && tstzrange($2, $3, '[)')\n OR (occurrence.starts_at = occurrence.ends_at\n AND occurrence.starts_at >= $2 AND occurrence.starts_at < $3)\n OR occurrence.day_span && daterange($4, $5, '[)')\n )\n AND (\n $6::timestamptz IS NULL\n OR (\n COALESCE(\n occurrence.starts_at,\n occurrence.start_date::timestamp AT TIME ZONE 'UTC'\n ),\n occurrence.event_id,\n occurrence.occurrence_key\n ) > ($6, $7, $8)\n )\n ORDER BY\n COALESCE(occurrence.starts_at, occurrence.start_date::timestamp AT TIME ZONE 'UTC'),\n occurrence.event_id,\n occurrence.occurrence_key\n LIMIT $9\n ",
"describe": {
"columns": [
{
@@ -260,5 +260,5 @@
false
]
},
- "hash": "1fd7598ab3adbedd997125565b274d743814a4006e7abba1d646aa5cfe2b28b1"
+ "hash": "930a7c65f953793b5279d182c50bbb4bf710b4b8861201c1b5c068074a005c4c"
}
diff --git a/.sqlx/query-a7e5ec2e4ad17eb542f4a5c5b0328bcf9fabb4835a641d02f307279ff26af8de.json b/.sqlx/query-a7e5ec2e4ad17eb542f4a5c5b0328bcf9fabb4835a641d02f307279ff26af8de.json
new file mode 100644
index 0000000000..7c0b2b82fb
--- /dev/null
+++ b/.sqlx/query-a7e5ec2e4ad17eb542f4a5c5b0328bcf9fabb4835a641d02f307279ff26af8de.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT provider_access_role FROM calendar_event_sources WHERE id=$1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "provider_access_role",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ true
+ ]
+ },
+ "hash": "a7e5ec2e4ad17eb542f4a5c5b0328bcf9fabb4835a641d02f307279ff26af8de"
+}
diff --git a/.sqlx/query-c101454ec5644bd0e219cc112b975205f73c5e2853ee4ad5e213249fb5c2aee5.json b/.sqlx/query-c101454ec5644bd0e219cc112b975205f73c5e2853ee4ad5e213249fb5c2aee5.json
new file mode 100644
index 0000000000..d95d326220
--- /dev/null
+++ b/.sqlx/query-c101454ec5644bd0e219cc112b975205f73c5e2853ee4ad5e213249fb5c2aee5.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE calendar_event_overrides SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE event_id=$1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Timestamptz",
+ "Timestamptz",
+ "Date"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c101454ec5644bd0e219cc112b975205f73c5e2853ee4ad5e213249fb5c2aee5"
+}
diff --git a/.sqlx/query-c24c56dc8063f9c911e9d839dbea07785d609f3edadb5853cafec4944f83dd40.json b/.sqlx/query-c24c56dc8063f9c911e9d839dbea07785d609f3edadb5853cafec4944f83dd40.json
new file mode 100644
index 0000000000..84f13fefc0
--- /dev/null
+++ b/.sqlx/query-c24c56dc8063f9c911e9d839dbea07785d609f3edadb5853cafec4944f83dd40.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE calendar_events SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE id=$1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Timestamptz",
+ "Timestamptz",
+ "Date"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c24c56dc8063f9c911e9d839dbea07785d609f3edadb5853cafec4944f83dd40"
+}
diff --git a/.sqlx/query-a80af1e649658d0f93352dba62789fe3cf2ab557d512e6f03f5d44a3ed05cb27.json b/.sqlx/query-daf4ceb8675891ee6383e3e5c6edb5a6fe628ce324423e8aefd430af3c490b7a.json
similarity index 80%
rename from .sqlx/query-a80af1e649658d0f93352dba62789fe3cf2ab557d512e6f03f5d44a3ed05cb27.json
rename to .sqlx/query-daf4ceb8675891ee6383e3e5c6edb5a6fe628ce324423e8aefd430af3c490b7a.json
index 8970419822..f5dc6c417f 100644
--- a/.sqlx/query-a80af1e649658d0f93352dba62789fe3cf2ab557d512e6f03f5d44a3ed05cb27.json
+++ b/.sqlx/query-daf4ceb8675891ee6383e3e5c6edb5a6fe628ce324423e8aefd430af3c490b7a.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT owner_id AS \"owner_id!\", event_id AS \"event_id!\", ical_uid AS \"ical_uid!\",\n occurrence_key AS \"occurrence_key!\", title AS \"title!\", time AS \"time!\"\n FROM (\n SELECT DISTINCT ON (event.owner_id,event.ical_uid,occurrence.value->>'occurrenceKey')\n event.owner_id, event.id AS event_id, event.ical_uid,\n occurrence.value->>'occurrenceKey' AS occurrence_key,\n COALESCE(exception.value->>'title',source.normalized_payload->'event'->>'title') AS title,\n occurrence.value->'time' AS time\n FROM calendar_event_sources source\n JOIN calendar_events event ON event.id=source.event_id\n JOIN calendars calendar ON calendar.id=source.calendar_id AND calendar.is_primary\n AND NOT calendar.is_deleted AND calendar.synced_at IS NOT NULL AND calendar.last_sync_error IS NULL\n AND calendar.snapshot_normalization_version >= 1\n JOIN calendar_accounts account ON account.id=source.account_id\n AND account.owner_id=event.owner_id\n AND account.sync_status IN ('ready','syncing') AND account.last_sync_error IS NULL\n AND account.last_synced_at > now() - interval '15 minutes'\n JOIN calendar_team_sharing sharing ON sharing.user_id=event.owner_id AND sharing.sharing='all'\n CROSS JOIN LATERAL jsonb_array_elements(source.normalized_payload->'occurrences') occurrence(value)\n LEFT JOIN LATERAL (\n SELECT candidate.value FROM jsonb_array_elements(source.normalized_payload->'overrides') candidate(value)\n WHERE candidate.value->>'recurrenceId'=occurrence.value->>'recurrenceId'\n LIMIT 1\n ) exception ON true\n WHERE event.owner_id IN (\n SELECT teammate.user_id FROM team_user viewer JOIN team_user teammate ON teammate.team_id=viewer.team_id\n WHERE viewer.user_id=$1 AND teammate.user_id<>$1\n )\n AND source.provider_access_role = calendar.access_role\n AND source.normalized_payload->'event'->>'eventType'='out_of_office'\n AND source.normalized_payload->'event'->>'visibility' IN ('default','public')\n AND COALESCE(exception.value->>'visibility','default') IN ('default','public')\n AND source.normalized_payload->'event'->>'status'<>'cancelled'\n AND COALESCE(exception.value->>'status','confirmed')<>'cancelled'\n AND NOT COALESCE((occurrence.value->>'isCancelled')::boolean,false)\n AND (\n (occurrence.value->'time'->>'kind'='timed'\n AND (occurrence.value->'time'->>'startsAt')::timestamptz<$3\n AND (occurrence.value->'time'->>'endsAt')::timestamptz>$2)\n OR (occurrence.value->'time'->>'kind'='allDay'\n AND (occurrence.value->'time'->>'startDate')::date<$5\n AND (occurrence.value->'time'->>'endDate')::date>$4)\n )\n ORDER BY event.owner_id,event.ical_uid,occurrence.value->>'occurrenceKey',source.source_updated_at DESC,source.id DESC\n ) sources\n ORDER BY COALESCE((time->>'startsAt')::timestamptz,(time->>'startDate')::date::timestamp AT TIME ZONE 'UTC'),event_id,occurrence_key\n LIMIT $6\n ",
+ "query": "\n SELECT owner_id AS \"owner_id!\", event_id AS \"event_id!\", ical_uid AS \"ical_uid!\",\n occurrence_key AS \"occurrence_key!\", title AS \"title!\", time AS \"time!\"\n FROM (\n SELECT DISTINCT ON (event.owner_id,event.ical_uid,occurrence.value->>'occurrenceKey')\n event.owner_id, event.id AS event_id, event.ical_uid,\n occurrence.value->>'occurrenceKey' AS occurrence_key,\n COALESCE(exception.value->>'title',source.normalized_payload->'event'->>'title') AS title,\n occurrence.value->'time' AS time\n FROM calendar_event_sources source\n JOIN calendar_events event ON event.id=source.event_id\n JOIN calendars calendar ON calendar.id=source.calendar_id AND calendar.is_primary\n AND NOT calendar.is_deleted AND calendar.synced_at IS NOT NULL AND calendar.last_sync_error IS NULL\n AND calendar.snapshot_normalization_version >= 1\n JOIN calendar_accounts account ON account.id=source.account_id\n AND account.owner_id=event.owner_id\n AND account.sync_status IN ('ready','syncing') AND account.last_sync_error IS NULL\n AND account.last_synced_at > now() - interval '15 minutes'\n JOIN calendar_team_sharing sharing ON sharing.user_id=event.owner_id AND sharing.sharing='all'\n CROSS JOIN LATERAL jsonb_array_elements(source.normalized_payload->'occurrences') occurrence(value)\n LEFT JOIN LATERAL (\n SELECT candidate.value FROM jsonb_array_elements(source.normalized_payload->'overrides') candidate(value)\n WHERE candidate.value->>'recurrenceId'=occurrence.value->>'recurrenceId'\n LIMIT 1\n ) exception ON true\n WHERE event.owner_id IN (\n SELECT teammate.user_id FROM team_user viewer JOIN team_user teammate ON teammate.team_id=viewer.team_id\n WHERE viewer.user_id=$1 AND teammate.user_id<>$1\n )\n AND source.provider_access_role = calendar.access_role\n AND source.normalized_payload->'event'->>'eventType'='out_of_office'\n AND source.normalized_payload->'event'->>'visibility' IN ('default','public')\n AND COALESCE(exception.value->>'visibility','default') IN ('default','public')\n AND source.normalized_payload->'event'->>'status'<>'cancelled'\n AND COALESCE(exception.value->>'status','confirmed')<>'cancelled'\n AND NOT COALESCE((occurrence.value->>'isCancelled')::boolean,false)\n AND (\n (occurrence.value->'time'->>'kind'='timed'\n AND (occurrence.value->'time'->>'endsAt')::timestamptz>(occurrence.value->'time'->>'startsAt')::timestamptz\n AND (occurrence.value->'time'->>'startsAt')::timestamptz<$3\n AND (occurrence.value->'time'->>'endsAt')::timestamptz>$2)\n OR (occurrence.value->'time'->>'kind'='allDay'\n AND (occurrence.value->'time'->>'startDate')::date<$5\n AND (occurrence.value->'time'->>'endDate')::date>$4)\n )\n ORDER BY event.owner_id,event.ical_uid,occurrence.value->>'occurrenceKey',source.source_updated_at DESC,source.id DESC\n ) sources\n ORDER BY COALESCE((time->>'startsAt')::timestamptz,(time->>'startDate')::date::timestamp AT TIME ZONE 'UTC'),event_id,occurrence_key\n LIMIT $6\n ",
"describe": {
"columns": [
{
@@ -53,5 +53,5 @@
null
]
},
- "hash": "a80af1e649658d0f93352dba62789fe3cf2ab557d512e6f03f5d44a3ed05cb27"
+ "hash": "daf4ceb8675891ee6383e3e5c6edb5a6fe628ce324423e8aefd430af3c490b7a"
}
diff --git a/.sqlx/query-893970f8005d7fbaaa3da2a1a5c8507f2a43d141c568d9c70b9a954c86285b6c.json b/.sqlx/query-fedcb133dd9ba625014a0aee5129c3e3cfd470cc4f0c008cb1a670e6333535b7.json
similarity index 85%
rename from .sqlx/query-893970f8005d7fbaaa3da2a1a5c8507f2a43d141c568d9c70b9a954c86285b6c.json
rename to .sqlx/query-fedcb133dd9ba625014a0aee5129c3e3cfd470cc4f0c008cb1a670e6333535b7.json
index 3a21d653dd..96663c8fb2 100644
--- a/.sqlx/query-893970f8005d7fbaaa3da2a1a5c8507f2a43d141c568d9c70b9a954c86285b6c.json
+++ b/.sqlx/query-fedcb133dd9ba625014a0aee5129c3e3cfd470cc4f0c008cb1a670e6333535b7.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n WITH eligible AS (\n SELECT teammate.user_id FROM team_user viewer\n JOIN team_user teammate ON teammate.team_id = viewer.team_id\n LEFT JOIN calendar_team_sharing policy ON policy.user_id = teammate.user_id\n WHERE viewer.user_id = $1 AND COALESCE(policy.sharing, 'busy_only') <> 'none'\n UNION SELECT $1::text\n ), visible_accounts AS MATERIALIZED (\n SELECT eligible.user_id, account.id AS account_id\n FROM eligible JOIN calendar_accounts account ON account.owner_id = eligible.user_id\n WHERE eligible.user_id = ANY($2::text[])\n UNION\n SELECT eligible.user_id, account.id AS account_id\n FROM eligible\n JOIN macro_user_links link ON link.primary_macro_id = eligible.user_id\n JOIN calendar_accounts account ON account.email_link_id = link.link_id\n WHERE eligible.user_id = ANY($2::text[])\n ), authorized_sources AS MATERIALIZED (\n SELECT eligible.user_id AS shared_by, source.id AS source_id,\n calendar.id AS calendar_id, calendar.name AS calendar_name, calendar.time_zone,\n COALESCE(preference.contributes_to_availability,\n account.owner_id = eligible.user_id AND calendar.is_primary) AS contributes,\n source.normalized_payload\n FROM visible_accounts eligible\n JOIN calendar_accounts account ON account.id = eligible.account_id\n AND account.sync_status IN ('ready', 'syncing')\n AND account.last_sync_error IS NULL\n AND account.last_synced_at > now() - interval '15 minutes'\n JOIN calendars calendar ON calendar.account_id = account.id AND NOT calendar.is_deleted\n AND calendar.synced_at IS NOT NULL AND calendar.last_sync_error IS NULL\n AND calendar.snapshot_normalization_version >= 1\n JOIN calendar_event_sources source ON source.calendar_id = calendar.id AND source.account_id = account.id\n AND source.provider_access_role IS NOT NULL\n AND source.provider_access_role IS NOT DISTINCT FROM calendar.access_role\n LEFT JOIN calendar_availability_preferences preference ON preference.user_id = eligible.user_id AND preference.calendar_id = calendar.id\n WHERE ($7::text IS NULL OR (eligible.user_id, source.id) >= ($7,$8))\n )\n SELECT shared_by AS \"shared_by!\", source_id AS \"source_id!\",\n calendar_id AS \"calendar_id!\", calendar_name AS \"calendar_name!\", time_zone,\n contributes AS \"contributes!\",\n ARRAY(SELECT owned.email_address::text FROM email_links owned WHERE owned.macro_id = shared_by) AS \"owner_emails!\",\n (normalized_payload - 'occurrences') AS \"snapshot!\", occurrence.value AS \"occurrence!\"\n FROM authorized_sources\n CROSS JOIN LATERAL jsonb_array_elements(normalized_payload->'occurrences') occurrence(value)\n WHERE (normalized_payload->'event'->>'status') <> 'cancelled'\n AND NOT COALESCE((occurrence.value->>'isCancelled')::boolean, false)\n AND (\n ((occurrence.value->'time'->>'kind') = 'timed'\n AND (occurrence.value->'time'->>'startsAt')::timestamptz < $4\n AND (occurrence.value->'time'->>'endsAt')::timestamptz > $3)\n OR ((occurrence.value->'time'->>'kind') = 'allDay'\n AND (occurrence.value->'time'->>'startDate')::date < $6\n AND (occurrence.value->'time'->>'endDate')::date > $5)\n )\n AND ($7::text IS NULL OR (shared_by, source_id, occurrence.value->>'occurrenceKey') > ($7,$8,$9))\n ORDER BY shared_by, source_id, occurrence.value->>'occurrenceKey'\n LIMIT $10\n ",
+ "query": "\n WITH eligible AS (\n SELECT teammate.user_id FROM team_user viewer\n JOIN team_user teammate ON teammate.team_id = viewer.team_id\n LEFT JOIN calendar_team_sharing policy ON policy.user_id = teammate.user_id\n WHERE viewer.user_id = $1 AND COALESCE(policy.sharing, 'busy_only') <> 'none'\n UNION SELECT $1::text\n ), visible_accounts AS MATERIALIZED (\n SELECT eligible.user_id, account.id AS account_id\n FROM eligible JOIN calendar_accounts account ON account.owner_id = eligible.user_id\n WHERE eligible.user_id = ANY($2::text[])\n UNION\n SELECT eligible.user_id, account.id AS account_id\n FROM eligible\n JOIN macro_user_links link ON link.primary_macro_id = eligible.user_id\n JOIN calendar_accounts account ON account.email_link_id = link.link_id\n WHERE eligible.user_id = ANY($2::text[])\n ), authorized_sources AS MATERIALIZED (\n SELECT eligible.user_id AS shared_by, source.id AS source_id,\n calendar.id AS calendar_id, calendar.name AS calendar_name, calendar.time_zone,\n COALESCE(preference.contributes_to_availability,\n account.owner_id = eligible.user_id AND calendar.is_primary) AS contributes,\n source.normalized_payload\n FROM visible_accounts eligible\n JOIN calendar_accounts account ON account.id = eligible.account_id\n AND account.sync_status IN ('ready', 'syncing')\n AND account.last_sync_error IS NULL\n AND account.last_synced_at > now() - interval '15 minutes'\n JOIN calendars calendar ON calendar.account_id = account.id AND NOT calendar.is_deleted\n AND calendar.synced_at IS NOT NULL AND calendar.last_sync_error IS NULL\n AND calendar.snapshot_normalization_version >= 1\n JOIN calendar_event_sources source ON source.calendar_id = calendar.id AND source.account_id = account.id\n AND source.provider_access_role IS NOT NULL\n AND source.provider_access_role IS NOT DISTINCT FROM calendar.access_role\n LEFT JOIN calendar_availability_preferences preference ON preference.user_id = eligible.user_id AND preference.calendar_id = calendar.id\n WHERE ($7::text IS NULL OR (eligible.user_id, source.id) >= ($7,$8))\n )\n SELECT shared_by AS \"shared_by!\", source_id AS \"source_id!\",\n calendar_id AS \"calendar_id!\", calendar_name AS \"calendar_name!\", time_zone,\n contributes AS \"contributes!\",\n ARRAY(SELECT owned.email_address::text FROM email_links owned WHERE owned.macro_id = shared_by) AS \"owner_emails!\",\n (normalized_payload - 'occurrences') AS \"snapshot!\", occurrence.value AS \"occurrence!\"\n FROM authorized_sources\n CROSS JOIN LATERAL jsonb_array_elements(normalized_payload->'occurrences') occurrence(value)\n WHERE (normalized_payload->'event'->>'status') <> 'cancelled'\n AND NOT COALESCE((occurrence.value->>'isCancelled')::boolean, false)\n AND (\n ((occurrence.value->'time'->>'kind') = 'timed'\n AND (occurrence.value->'time'->>'startsAt')::timestamptz < $4\n AND ((occurrence.value->'time'->>'endsAt')::timestamptz > $3\n OR ((occurrence.value->'time'->>'startsAt')::timestamptz = (occurrence.value->'time'->>'endsAt')::timestamptz\n AND (occurrence.value->'time'->>'startsAt')::timestamptz >= $3)))\n OR ((occurrence.value->'time'->>'kind') = 'allDay'\n AND (occurrence.value->'time'->>'startDate')::date < $6\n AND (occurrence.value->'time'->>'endDate')::date > $5)\n )\n AND ($7::text IS NULL OR (shared_by, source_id, occurrence.value->>'occurrenceKey') > ($7,$8,$9))\n ORDER BY shared_by, source_id, occurrence.value->>'occurrenceKey'\n LIMIT $10\n ",
"describe": {
"columns": [
{
@@ -75,5 +75,5 @@
null
]
},
- "hash": "893970f8005d7fbaaa3da2a1a5c8507f2a43d141c568d9c70b9a954c86285b6c"
+ "hash": "fedcb133dd9ba625014a0aee5129c3e3cfd470cc4f0c008cb1a670e6333535b7"
}
diff --git a/apps/web/src/features/calendar-team/components/team-event-details.tsx b/apps/web/src/features/calendar-team/components/team-event-details.tsx
index 6b58aebec0..0532dda8e7 100644
--- a/apps/web/src/features/calendar-team/components/team-event-details.tsx
+++ b/apps/web/src/features/calendar-team/components/team-event-details.tsx
@@ -1,6 +1,9 @@
import { createMemo, For, Show } from 'solid-js';
import type { CalendarEvent, CalendarTimeFormat } from '../../calendar/types';
-import { parseLocalDate } from '../../calendar/utils/calendar-date';
+import {
+ isTimedPointEvent,
+ parseLocalDate,
+} from '../../calendar/utils/calendar-date';
import { sanitizeCalendarDescription } from '../../calendar/utils/calendar-description';
import { safeConferenceUrl } from '../../calendar/utils/conference-link';
@@ -39,7 +42,9 @@ export function TeamEventDetails(props: {
hour12: props.timeFormat === '12-hour',
}),
});
- return `${format.format(start)} – ${format.format(end)}${event.allDay ? ' · All day' : ''}`;
+ return isTimedPointEvent(event)
+ ? `${format.format(start)} · No duration`
+ : `${format.format(start)} – ${format.format(end)}${event.allDay ? ' · All day' : ''}`;
};
return (
<section
diff --git a/apps/web/src/features/calendar-team/queries/map.test.ts b/apps/web/src/features/calendar-team/queries/map.test.ts
index 330d092e52..512579d839 100644
--- a/apps/web/src/features/calendar-team/queries/map.test.ts
+++ b/apps/web/src/features/calendar-team/queries/map.test.ts
@@ -1,5 +1,6 @@
import type { TeamCalendarItem } from '@service-storage/generated/schemas/teamCalendarItem';
import { describe, expect, it } from 'vitest';
+import { mapCalendarEventToFullCalendar } from '../../calendar/types';
import { canEditCalendarEventTime } from '../../calendar/utils/event-interaction';
import { mergeCalendarOverlays } from '../core/merge';
import { mapTeamCalendarItem } from './map';
@@ -18,6 +19,35 @@ const busy = {
} satisfies TeamCalendarItem;
describe('team calendar grid projection', () => {
+ it('retains the exact nonbusy instant of a detailed shared point', () => {
+ const point = mapTeamCalendarItem(
+ {
+ ...busy,
+ kind: 'details',
+ contributesToAvailability: false,
+ time: { ...busy.time, endsAt: busy.time.startsAt },
+ details: {
+ title: 'Point event',
+ description: null,
+ location: null,
+ conferenceUrl: null,
+ organizerEmail: null,
+ organizerName: null,
+ attendees: [],
+ calendarName: 'Shared calendar',
+ },
+ },
+ 'Alice'
+ );
+ const rendered = mapCalendarEventToFullCalendar(point);
+
+ expect(point.start).toBe(point.end);
+ expect(point.teamProjection?.contributesToAvailability).toBe(false);
+ expect(point.title).toBe('Alice: Point event');
+ expect(rendered.end).toBe('2026-10-07T12:00:00.001Z');
+ expect(rendered.startEditable).toBe(false);
+ expect(rendered.durationEditable).toBe(false);
+ });
it('keeps redacted blocks separate from canonical event identities and provider actions', () => {
const event = mapTeamCalendarItem(busy, 'Alice');
expect(event.id).toBe(JSON.stringify(['team-calendar', 'alice', 'opaque']));
diff --git a/apps/web/src/features/calendar/availability/availability.test.ts b/apps/web/src/features/calendar/availability/availability.test.ts
index eef720c04c..c44b73ec6e 100644
--- a/apps/web/src/features/calendar/availability/availability.test.ts
+++ b/apps/web/src/features/calendar/availability/availability.test.ts
@@ -119,6 +119,21 @@ describe('busyIntervalsFromOccurrences', () => {
]);
});
+ it('does not let an imported point remove any free time', () => {
+ const busyIntervals = busyIntervalsFromOccurrences([
+ timedItem({ start, end: start }),
+ ]);
+ expect(busyIntervals).toEqual([]);
+ const settings = {
+ rangeKey: 'today' as const,
+ settings: SETTINGS,
+ now: MONDAY_10AM,
+ };
+ expect(computeAvailability({ ...settings, busyIntervals })).toEqual(
+ computeAvailability({ ...settings, busyIntervals: [] })
+ );
+ });
+
it('ignores events that do not block time', () => {
const items = [
timedItem({ start, end, isCancelled: true }),
diff --git a/apps/web/src/features/calendar/components/EventContent.tsx b/apps/web/src/features/calendar/components/EventContent.tsx
index aab49a0397..836d2c1ed7 100644
--- a/apps/web/src/features/calendar/components/EventContent.tsx
+++ b/apps/web/src/features/calendar/components/EventContent.tsx
@@ -52,7 +52,7 @@ export function EventContent(props: EventContentProps) {
return (
!props.event.allDay &&
- duration > 0 &&
+ duration >= 0 &&
duration <= SINGLE_LINE_EVENT_DURATION_MS
);
};
diff --git a/apps/web/src/features/calendar/components/EventDetails.tsx b/apps/web/src/features/calendar/components/EventDetails.tsx
index 3542cc0f34..c1a8f858fd 100644
--- a/apps/web/src/features/calendar/components/EventDetails.tsx
+++ b/apps/web/src/features/calendar/components/EventDetails.tsx
@@ -42,7 +42,11 @@ import {
} from 'solid-js';
import { Dynamic } from 'solid-js/web';
import type { CalendarEvent, CalendarTimeFormat } from '../types';
-import { isSameLocalDate, parseLocalDate } from '../utils/calendar-date';
+import {
+ isSameLocalDate,
+ isTimedPointEvent,
+ parseLocalDate,
+} from '../utils/calendar-date';
import {
parseMacroAppLink,
sanitizeCalendarDescription,
@@ -328,6 +332,10 @@ function formatEventSchedule(
: `${formatShortDate.format(start)}–${formatShortDate.format(inclusiveEnd)} · All day`;
}
+ if (isTimedPointEvent(event)) {
+ return `${formatDate.format(start)} · ${formatCalendarTime(start, timeFormat)} · No duration`;
+ }
+
return isSameLocalDate(start, end)
? `${formatDate.format(start)} · ${formatCalendarTime(start, timeFormat)}–${formatCalendarTime(end, timeFormat)}`
: `${formatDate.format(start)}, ${formatCalendarTime(start, timeFormat)}–${formatDate.format(end)}, ${formatCalendarTime(end, timeFormat)}`;
diff --git a/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.test.ts b/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.test.ts
index 9db7192256..5add295116 100644
--- a/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.test.ts
+++ b/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.test.ts
@@ -67,6 +67,23 @@ function controllerFor(
});
}
+it('never uses an imported point baseline to create a new zero-duration event', () => {
+ const controller = controllerFor({
+ title: 'New point',
+ allDay: false,
+ start: '2026-10-10T12:00',
+ end: '2026-10-10T12:00',
+ importedPointTime: {
+ kind: 'timed',
+ startsAt: '2026-10-10T12:00:00Z',
+ endsAt: '2026-10-10T12:00:00Z',
+ timeZone: 'UTC',
+ },
+ });
+ expect(controller.canSave()).toBe(false);
+ expect(controller.submitValues()).toBeUndefined();
+});
+
describe('calendar account selection', () => {
it('waits for the primary account instead of silently using another inbox', () => {
const [primary, setPrimary] = createSignal<string>();
diff --git a/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.ts b/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.ts
index fa4418acf1..6e173c89be 100644
--- a/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.ts
+++ b/apps/web/src/features/calendar/components/composer/create-calendar-event-form-controller.ts
@@ -157,6 +157,7 @@ export function createCalendarEventFormController(
initialValues: options.initialValue,
state,
recurrenceTimeZone: options.recurrenceTimeZone,
+ isEdit: options.isEdit,
});
const isOutOfOffice = () => state().eventType === 'out_of_office';
diff --git a/apps/web/src/features/calendar/components/composer/event-form-model.ts b/apps/web/src/features/calendar/components/composer/event-form-model.ts
index 46df4f665b..f527c0d67d 100644
--- a/apps/web/src/features/calendar/components/composer/event-form-model.ts
+++ b/apps/web/src/features/calendar/components/composer/event-form-model.ts
@@ -21,7 +21,7 @@ import {
} from 'date-fns';
import { type Accessor, batch, createMemo, createSignal } from 'solid-js';
import type { CalendarEvent } from '../../types';
-import { parseLocalDate } from '../../utils/calendar-date';
+import { isTimedPointEvent, parseLocalDate } from '../../utils/calendar-date';
import {
calendarMacroCallUrl,
removeCalendarMacroCall,
@@ -80,6 +80,8 @@ export interface EventEditorInitialValues {
start: string;
/** Inclusive end shown to the user; all-day submissions add the exclusive day. */
end: string;
+ /** Exact provider instant, preserved only for an unchanged imported point. */
+ importedPointTime?: Extract<EventTime, { kind: 'timed' }>;
recurrenceLines: string[];
calendarId?: string;
guests: string;
@@ -264,6 +266,14 @@ export function calendarEventToEditorInitialValues(
allDay: false,
start: format(new Date(event.start), DATETIME_VALUE),
end: format(new Date(event.end), DATETIME_VALUE),
+ importedPointTime: isTimedPointEvent(event)
+ ? {
+ kind: 'timed',
+ startsAt: event.start,
+ endsAt: event.end,
+ timeZone: event.timeZone ?? null,
+ }
+ : undefined,
recurrenceLines: [...event.recurrenceLines],
calendarId: event.calendarId ?? event.calendar.id,
guests,
@@ -419,6 +429,7 @@ export interface CreateEventEditorStateOptions {
initialValues: EventEditorInitialValues;
state: Accessor<EventEditorInitialValues>;
recurrenceTimeZone?: string;
+ isEdit?: boolean;
}
function recurrenceConfigFor(
@@ -540,6 +551,17 @@ export function createEventEditorState(options: CreateEventEditorStateOptions) {
options.recurrenceTimeZone
);
};
+ const unchangedImportedPoint = () => {
+ const initial = initialValues();
+ const current = options.state();
+ return options.isEdit === true &&
+ initial.importedPointTime !== undefined &&
+ !current.allDay &&
+ current.start === initial.start &&
+ current.end === initial.end
+ ? initial.importedPointTime
+ : undefined;
+ };
const dateRangeError = createMemo(() => {
const current = options.state();
if (!current.start || !current.end) return undefined;
@@ -553,9 +575,13 @@ export function createEventEditorState(options: CreateEventEditorStateOptions) {
if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
return undefined;
}
- return end <= start ? 'End time must be after the start time.' : undefined;
+ return end <= start && !unchangedImportedPoint()
+ ? 'End time must be after the start time.'
+ : undefined;
});
- const eventTime = createMemo(() => buildEventTime(options.state()));
+ const eventTime = createMemo(
+ () => buildEventTime(options.state()) ?? unchangedImportedPoint()
+ );
const canSave = () =>
options.state().title.trim() !== '' &&
eventTime() !== undefined &&
diff --git a/apps/web/src/features/calendar/hooks/use-event-editor.test.ts b/apps/web/src/features/calendar/hooks/use-event-editor.test.ts
index d378192373..c5e61fda44 100644
--- a/apps/web/src/features/calendar/hooks/use-event-editor.test.ts
+++ b/apps/web/src/features/calendar/hooks/use-event-editor.test.ts
@@ -99,7 +99,10 @@ beforeEach(() => {
});
describe('editing event times', () => {
- function editorFor(overrides: Partial<CalendarEvent> = {}) {
+ function editorFor(
+ overrides: Partial<CalendarEvent> = {},
+ macroCallsEnabled = false
+ ) {
return createRoot((dispose) => {
const event: CalendarEvent = {
...savedEvent,
@@ -115,7 +118,7 @@ describe('editing event times', () => {
const editor = useEventEditor({
event: () => event,
onSaved,
- macroCallsEnabled: () => false,
+ macroCallsEnabled: () => macroCallsEnabled,
});
const form = createCalendarEventFormController({
initialValue: calendarEventToEditorInitialValues(event),
@@ -127,7 +130,127 @@ describe('editing event times', () => {
});
}
+ it('syncs an existing point call title without writing a zero-duration schedule', async () => {
+ const { editor, form, dispose } = editorFor(
+ {
+ start: savedEvent.start,
+ end: savedEvent.start,
+ location: savedEvent.location,
+ },
+ true
+ );
+ try {
+ form.setField('title', 'Updated point call');
+ await editor.save(form.submitValues()!);
+ expect(mocks.updateEvent.mock.lastCall?.[0].patch).toEqual({
+ title: 'Updated point call',
+ });
+ expect(mocks.updateMeeting).toHaveBeenCalledWith({
+ meetingId: 'meeting-1',
+ title: 'Updated point call',
+ });
+ expect(editor.saveError()).toBeUndefined();
+ expect(mocks.alert).not.toHaveBeenCalled();
+ } finally {
+ dispose();
+ }
+ });
+
+ it('syncs a positive schedule when an imported point gains duration', async () => {
+ const { editor, form, dispose } = editorFor(
+ {
+ start: savedEvent.start,
+ end: savedEvent.start,
+ location: savedEvent.location,
+ },
+ true
+ );
+ try {
+ form.setField('end', form.state().end.replace('14:00', '15:00'));
+ const submitted = form.submitValues()!;
+ expect(submitted.time.kind).toBe('timed');
+ await editor.save(submitted);
+ expect(mocks.updateMeeting).toHaveBeenCalledWith({
+ meetingId: 'meeting-1',
+ title: 'Planning',
+ scheduledStart: '2026-09-22T14:00:00.000Z',
+ scheduledEnd: '2026-09-22T15:00:00.000Z',
+ });
+ } finally {
+ dispose();
+ }
+ });
+
+ it('rejects adding a point call before any calendar or meeting mutation', async () => {
+ const { editor, form, onSaved, dispose } = editorFor(
+ {
+ start: savedEvent.start,
+ end: savedEvent.start,
+ },
+ true
+ );
+ try {
+ form.setField('conference', 'macro');
+ form.setField('title', 'A new point call');
+ await editor.save(form.submitValues()!);
+ expect(editor.saveError()).toBe(
+ 'Give this event a duration before adding a Macro call.'
+ );
+ expect(editor.pending()).toBe(false);
+ expect(mocks.updateEvent).not.toHaveBeenCalled();
+ expect(mocks.createMeeting).not.toHaveBeenCalled();
+ expect(mocks.updateMeeting).not.toHaveBeenCalled();
+ expect(onSaved).not.toHaveBeenCalled();
+ } finally {
+ dispose();
+ }
+ });
+
describe.each(['all', 'this_event'] as const)('%s scope', (scope) => {
+ it('edits imported point metadata without sending a time patch', async () => {
+ const { editor, form, dispose } = editorFor({
+ start: '2026-09-22T10:00:37-04:00',
+ end: '2026-09-22T10:00:37-04:00',
+ });
+ try {
+ form.setField('title', 'Updated point title');
+ expect(form.canSave()).toBe(true);
+ expect(form.dateRangeError()).toBeUndefined();
+ const submitted = form.submitValues();
+ expect(submitted?.time).toMatchObject({
+ startsAt: '2026-09-22T10:00:37-04:00',
+ endsAt: '2026-09-22T10:00:37-04:00',
+ });
+ await editor.save(submitted!, scope);
+ expect(mocks.updateEvent).toHaveBeenCalledOnce();
+ expect(mocks.updateEvent.mock.lastCall?.[0].patch).toEqual({
+ title: 'Updated point title',
+ });
+ } finally {
+ dispose();
+ }
+ });
+
+ it('requires positive duration when changing an imported point time', () => {
+ const { form, dispose } = editorFor({
+ start: '2026-09-22T14:00:00Z',
+ end: '2026-09-22T14:00:00Z',
+ });
+ try {
+ form.setField('start', '2026-09-23T14:00');
+ form.setField('end', '2026-09-23T14:00');
+ expect(form.canSave()).toBe(false);
+ expect(form.submitValues()).toBeUndefined();
+ expect(form.dateRangeError()).toBe(
+ 'End time must be after the start time.'
+ );
+ form.setField('end', '2026-09-23T14:30');
+ expect(form.canSave()).toBe(true);
+ } finally {
+ dispose();
+ }
+ });
+
it.each([
'RRULE:FREQ=WEEKLY;WKST=SU;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR',
'RRULE:BYDAY=FR,TH,WE,TU,MO;FREQ=WEEKLY',
diff --git a/apps/web/src/features/calendar/hooks/use-event-editor.ts b/apps/web/src/features/calendar/hooks/use-event-editor.ts
index b155e65f21..397f15221a 100644
--- a/apps/web/src/features/calendar/hooks/use-event-editor.ts
+++ b/apps/web/src/features/calendar/hooks/use-event-editor.ts
@@ -25,6 +25,7 @@ import {
DEFAULT_CALENDAR_SOURCE,
reminderCalendarIdOf,
} from '../types';
+import { isTimedPointEvent } from '../utils/calendar-date';
import {
calendarDisplayLabel,
spansMultipleInboxes,
@@ -59,7 +60,9 @@ function hasTimeChanged(
) {
// Compare at the editor's precision, which omits seconds. An unchanged
// occurrence must not replace the series start or its provider time zone.
- const initial = buildEventTime(calendarEventToEditorInitialValues(event));
+ const initialValues = calendarEventToEditorInitialValues(event);
+ const initial =
+ buildEventTime(initialValues) ?? initialValues.importedPointTime;
return match([initial, time])
.with(
[{ kind: 'timed' }, { kind: 'timed' }],
@@ -184,11 +187,14 @@ export function useEventEditor(props: UseEventEditorProps) {
) => {
const meeting = await fetchMeeting(shareToken);
if (!props.macroCallsEnabled()) return;
+ const event = props.event();
+ const preservesPoint =
+ event && isTimedPointEvent(event) && !hasTimeChanged(event, values.time);
await updateMeeting.mutateAsync({
meetingId: meeting.id,
...(values.time.kind === 'allDay' ? { clearSchedule: true } : {}),
title: values.title,
- ...meetingSchedule(values),
+ ...(preservesPoint ? {} : meetingSchedule(values)),
});
};
@@ -213,6 +219,17 @@ export function useEventEditor(props: UseEventEditorProps) {
(!event.isReadOnly &&
editsPrimaryCopy(event) &&
viewerCanEditGuests(event));
+ if (
+ needsCall() &&
+ canManageCall &&
+ !existingMeetingUrl &&
+ values.time.kind === 'timed' &&
+ Date.parse(values.time.endsAt) <= Date.parse(values.time.startsAt)
+ ) {
+ setSaveError('Give this event a duration before adding a Macro call.');
+ setPending(false);
+ return;
+ }
// Older events can carry both a generated Macro link and provider
// conferencing. Use the saved provider state when clearing either choice.
const conference =
diff --git a/apps/web/src/features/calendar/types.test.ts b/apps/web/src/features/calendar/types.test.ts
index 44b71dca32..da3e185f7c 100644
--- a/apps/web/src/features/calendar/types.test.ts
+++ b/apps/web/src/features/calendar/types.test.ts
@@ -8,6 +8,7 @@ import {
mapCalendarEventToFullCalendar,
mapCalendarOccurrence,
} from './types';
+import { canEditCalendarEventTime } from './utils/event-interaction';
const PRIMARY: CalendarSource = {
id: 'primary',
@@ -259,6 +260,29 @@ describe('isCalendarEventVisible', () => {
});
describe('mapCalendarEventToFullCalendar', () => {
+ it('preserves an imported point while giving the grid a noneditable display footprint', () => {
+ const source = item([copy('primary')]);
+ const instant = '2026-09-10T13:00:00Z';
+ source.occurrence.time = {
+ kind: 'timed',
+ startsAt: instant,
+ endsAt: '2026-09-10T09:00:00-04:00',
+ timeZone: 'America/New_York',
+ };
+ const point = mapCalendarOccurrence(source, { sourceById });
+ const rendered = mapCalendarEventToFullCalendar(point);
+
+ expect(point.start).toBe(instant);
+ expect(point.end).toBe(source.occurrence.time.endsAt);
+ expect(point.isReadOnly).toBe(false);
+ expect(canEditCalendarEventTime(point)).toBe(false);
+ expect(rendered.start).toBe(instant);
+ expect(rendered.end).toBe('2026-09-10T13:00:00.001Z');
+ expect(rendered.allDay).toBe(false);
+ expect(rendered.startEditable).toBe(false);
+ expect(rendered.durationEditable).toBe(false);
+ });
+
it('keeps the occurrence identity and displayed title on the rendered event', () => {
const rendered = mapCalendarEventToFullCalendar(
mapCalendarOccurrence(item([copy('primary'), sharedCopy]), {
diff --git a/apps/web/src/features/calendar/types.ts b/apps/web/src/features/calendar/types.ts
index 78e746e6b8..3964491c00 100644
--- a/apps/web/src/features/calendar/types.ts
+++ b/apps/web/src/features/calendar/types.ts
@@ -4,7 +4,10 @@ import type { CalendarEventSourceContent } from '@service-storage/generated/sche
import type { CalendarOccurrenceItem } from '@service-storage/generated/schemas/calendarOccurrenceItem';
import type { EventReminders } from '@service-storage/generated/schemas/eventReminders';
import type { EventType } from '@service-storage/generated/schemas/eventType';
-import { multiDayTimedDisplayRange } from './utils/calendar-date';
+import {
+ isTimedPointEvent,
+ multiDayTimedDisplayRange,
+} from './utils/calendar-date';
import { canEditCalendarEventTime } from './utils/event-interaction';
/** Supported FullCalendar period views. */
@@ -282,12 +285,18 @@ export function mapCalendarEventToFullCalendar(
// ranges. Keep projected timed events fixed so their timestamps are not
// accidentally replaced with date-only API values.
const interactionEditable = timeEditable && allDayRange === undefined;
+ // FullCalendar replaces an equal end with its default one-hour duration.
+ // Give an instant a minimal rendering footprint without changing the model.
+ // Point events cannot be dragged/resized, so this display end is never saved.
+ const displayEnd = isTimedPointEvent(event)
+ ? new Date(Date.parse(event.start) + 1).toISOString()
+ : event.end;
return {
id: event.id,
title: event.title,
start: allDayRange?.start ?? event.start,
- end: allDayRange?.end ?? event.end,
+ end: allDayRange?.end ?? displayEnd,
allDay: isRenderedAllDay,
display: 'auto',
startEditable: interactionEditable,
diff --git a/apps/web/src/features/calendar/utils/calendar-date.ts b/apps/web/src/features/calendar/utils/calendar-date.ts
index 18d011070b..af8c975309 100644
--- a/apps/web/src/features/calendar/utils/calendar-date.ts
+++ b/apps/web/src/features/calendar/utils/calendar-date.ts
@@ -39,6 +39,17 @@ export function isSameLocalDate(first: Date, second: Date) {
);
}
+/** An imported timed instant has no duration; all-day dates remain intervals. */
+export function isTimedPointEvent(event: {
+ allDay: boolean;
+ start: string;
+ end: string;
+}): boolean {
+ if (event.allDay) return false;
+ const start = Date.parse(event.start);
+ return Number.isFinite(start) && start === Date.parse(event.end);
+}
+
/**
* Projects a timed span that occupies multiple local dates into date-only
* bounds suitable for FullCalendar's all-day row.
diff --git a/apps/web/src/features/calendar/utils/event-interaction.ts b/apps/web/src/features/calendar/utils/event-interaction.ts
index f617acdc62..c79ef66bf1 100644
--- a/apps/web/src/features/calendar/utils/event-interaction.ts
+++ b/apps/web/src/features/calendar/utils/event-interaction.ts
@@ -1,7 +1,7 @@
import type { EventApi } from '@fullcalendar/core';
import type { EventTime } from '@service-calendar/generated/schemas/eventTime';
import type { CalendarEvent } from '../types';
-import { formatLocalDate } from './calendar-date';
+import { formatLocalDate, isTimedPointEvent } from './calendar-date';
interface FullCalendarEventRange {
allDay: boolean;
@@ -37,6 +37,7 @@ export function canEditCalendarEventTime(event: CalendarEvent) {
!event.teamProjection &&
!event.isReadOnly &&
!event.isCancelled &&
+ !isTimedPointEvent(event) &&
event.recurrenceLines.length === 0 &&
event.recurrenceId === undefined
);
diff --git a/apps/web/src/features/meetings/core/next-meeting-badge.test.ts b/apps/web/src/features/meetings/core/next-meeting-badge.test.ts
index 0771ee8fe1..7d4a04d8e4 100644
--- a/apps/web/src/features/meetings/core/next-meeting-badge.test.ts
+++ b/apps/web/src/features/meetings/core/next-meeting-badge.test.ts
@@ -58,6 +58,16 @@ describe('nextMeetingBadge', () => {
).toEqual({ kind: 'soon', label: '12m', minutes: 12 });
});
+ it('counts down to a point without showing it as ongoing', () => {
+ const point = event('2026-10-07T15:12:00Z', '2026-10-07T15:12:00Z');
+ expect(nextMeetingBadge([point], NOW)).toEqual({
+ kind: 'soon',
+ label: '12m',
+ minutes: 12,
+ });
+ expect(nextMeetingBadge([point], new Date(point.start))).toBeUndefined();
+ });
+
it('rounds a partial minute up so the badge never reads 0m', () => {
expect(
nextMeetingBadge(
diff --git a/apps/web/src/features/meetings/core/next-meeting-badge.ts b/apps/web/src/features/meetings/core/next-meeting-badge.ts
index 4093bee4d4..e2c47483ca 100644
--- a/apps/web/src/features/meetings/core/next-meeting-badge.ts
+++ b/apps/web/src/features/meetings/core/next-meeting-badge.ts
@@ -22,7 +22,7 @@ export function nextMeetingBadge(
if (event.allDay) continue;
const start = Date.parse(event.start);
const end = Date.parse(event.end);
- if (!Number.isFinite(start) || !Number.isFinite(end) || end <= start) {
+ if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) {
continue;
}
if (start <= nowMs && nowMs < end) return { kind: 'now', label: 'Now' };
diff --git a/apps/web/src/features/meetings/core/upcoming-calendar-events.test.ts b/apps/web/src/features/meetings/core/upcoming-calendar-events.test.ts
index 7046fc48c4..16e90012ba 100644
--- a/apps/web/src/features/meetings/core/upcoming-calendar-events.test.ts
+++ b/apps/web/src/features/meetings/core/upcoming-calendar-events.test.ts
@@ -42,6 +42,26 @@ describe('upcoming calendar calls', () => {
).toEqual([]);
});
+ it('keeps a future timed point without treating it as an ongoing meeting', () => {
+ const point = { ...call(13), end: call(13).start };
+ expect(
+ selectUpcomingCalendarEvents([point], new Date('2026-09-23T12:00:00Z'))
+ ).toEqual([point]);
+ expect(
+ selectUpcomingCalendarEvents([point], new Date(point.start))
+ ).toEqual([]);
+ expect(isCalendarEventOngoing(point, new Date(point.start))).toBe(false);
+ const emptyAllDay = {
+ ...point,
+ allDay: true,
+ start: '2026-09-23',
+ end: '2026-09-23',
+ };
+ expect(
+ selectUpcomingCalendarEvents([emptyAllDay], new Date(2026, 8, 22))
+ ).toEqual([]);
+ });
+
it('deduplicates overlapping windows without merging recurring calls sharing a URL', () => {
const first = call(13);
expect(
diff --git a/apps/web/src/features/meetings/core/upcoming-calendar-events.ts b/apps/web/src/features/meetings/core/upcoming-calendar-events.ts
index 156c4f9752..41ed4d2265 100644
--- a/apps/web/src/features/meetings/core/upcoming-calendar-events.ts
+++ b/apps/web/src/features/meetings/core/upcoming-calendar-events.ts
@@ -35,7 +35,12 @@ export function selectUpcomingCalendarEvents(
for (const event of events) {
const start = timestamp(event.start, event.allDay);
const end = timestamp(event.end, event.allDay);
- if (!Number.isFinite(start) || end <= start || !(end > now.getTime())) {
+ if (
+ !Number.isFinite(start) ||
+ end < start ||
+ (event.allDay && end === start) ||
+ !(end > now.getTime())
+ ) {
continue;
}
occurrences.set(
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.browser.e2e.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.browser.e2e.ts
new file mode 100644
index 0000000000..33ef067615
--- /dev/null
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.browser.e2e.ts
@@ -0,0 +1,18 @@
+import { expect, test } from '@playwright/test';
+
+test('point events survive the real worker cache without acquiring a duration', async ({
+ page,
+}) => {
+ await page.goto('calendar-points.html');
+ const result = page.locator('#result');
+ await expect(result).toHaveAttribute('data-status', 'passed', {
+ timeout: 60_000,
+ });
+ expect(JSON.parse((await result.textContent())!)).toEqual({
+ pointVisible: true,
+ exactTimePreserved: true,
+ exclusiveEnd: true,
+ emptyRange: true,
+ durationReplacement: true,
+ });
+});
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.html b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.html
new file mode 100644
index 0000000000..90b2795acc
--- /dev/null
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html lang="en">
+ <head><meta charset="utf-8" /><link rel="icon" href="data:," /><title>Calendar point cache regression</title></head>
+ <body>
+ <pre id="result" data-status="loading"></pre>
+ <script type="module" src="./calendar-points.ts"></script>
+ </body>
+</html>
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.ts
new file mode 100644
index 0000000000..0011b3f34c
--- /dev/null
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/calendar-points.ts
@@ -0,0 +1,109 @@
+// Real production worker/WASM/OPFS with synthetic calendar records only.
+import { createWorkerCacheHost } from '../../host/worker-host';
+
+const result = document.querySelector<HTMLPreElement>('#result')!;
+const host = createWorkerCacheHost({
+ scope: `calendar-points-${crypto.randomUUID()}`,
+});
+const instant = '2026-10-08T12:00:00Z';
+const pointMs = Date.parse(instant);
+const occurrenceKey = 'GraphqlCalendarOccurrence:point';
+const query = `query CalendarPoints($input: CalendarRangeInput!) {
+ user { id calendarOccurrences(input: $input) { nodes {
+ __typename id eventId linkId isCancelled
+ time { __typename ... on GraphqlTimedEventTime { startsAt endsAt timeZone } }
+ } } }
+}`;
+const variables = {
+ input: { start: '2026-10-08T00:00:00Z', end: '2026-10-09T00:00:00Z' },
+};
+
+async function write(endsAt: string) {
+ await host.writeQuery({
+ query,
+ variables,
+ data: {
+ user: {
+ id: 'fixture-viewer',
+ calendarOccurrences: {
+ nodes: [
+ {
+ __typename: 'GraphqlCalendarOccurrence',
+ id: 'point',
+ eventId: 'point-event',
+ linkId: 'fixture-link',
+ isCancelled: false,
+ time: {
+ __typename: 'GraphqlTimedEventTime',
+ startsAt: instant,
+ endsAt,
+ timeZone: 'UTC',
+ },
+ },
+ ],
+ },
+ },
+ },
+ });
+}
+
+async function keys(startMs: number, endMs: number) {
+ const range = await host.calendarRange({
+ startMs,
+ endMs,
+ startDay: 0,
+ endDay: 0,
+ });
+ if (range.kind !== 'range') throw new Error('Calendar cache is unavailable');
+ equal(range.gaps, []);
+ equal(range.freshness, 'fresh');
+ return range.occurrenceKeys;
+}
+
+function equal(actual: unknown, expected: unknown) {
+ if (JSON.stringify(actual) !== JSON.stringify(expected)) {
+ throw new Error(
+ `Expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`
+ );
+ }
+}
+
+try {
+ await write(instant);
+ await host.calendarCommit({
+ coverage: [{ kind: 'timed', start: pointMs - 1, end: pointMs + 3_600_000 }],
+ freshness: 'fresh',
+ });
+ equal(await keys(pointMs, pointMs + 1), [occurrenceKey]);
+ equal(await keys(pointMs - 1, pointMs), []);
+ equal(await keys(pointMs, pointMs), []);
+ const cached = await host.readQuery({ opKey: 1, query, variables });
+ if (cached.kind !== 'hit')
+ throw new Error('Point query did not survive normalization');
+ const data = cached.data as {
+ user: {
+ calendarOccurrences: {
+ nodes: Array<{ time: { startsAt: string; endsAt: string } }>;
+ };
+ };
+ };
+ equal(data.user.calendarOccurrences.nodes[0].time.startsAt, instant);
+ equal(data.user.calendarOccurrences.nodes[0].time.endsAt, instant);
+ await write('2026-10-08T13:00:00Z');
+ equal(await keys(pointMs + 1, pointMs + 2), [occurrenceKey]);
+ await write(instant);
+ equal(await keys(pointMs + 1, pointMs + 2), []);
+ equal(await keys(pointMs, pointMs + 1), [occurrenceKey]);
+ result.textContent = JSON.stringify({
+ pointVisible: true,
+ exactTimePreserved: true,
+ exclusiveEnd: true,
+ emptyRange: true,
+ durationReplacement: true,
+ });
+ result.dataset.status = 'passed';
+} catch (error) {
+ result.textContent = String(error);
+ result.dataset.status = 'failed';
+}
+window.addEventListener('pagehide', () => host.dispose(), { once: true });
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts
index f3b9d74b58..b4b51903ed 100644
--- a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts
@@ -7,6 +7,7 @@ const webDirectory = fileURLToPath(new URL('../../../../../', import.meta.url));
export default defineConfig({
testDir: directory,
testMatch: [
+ 'calendar-points.browser.e2e.ts',
'coordinator.browser.e2e.ts',
'cache-wasm-packaging.browser.e2e.ts',
'notification-projection.browser.e2e.ts',
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.production.config.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.production.config.ts
index 6381d38d2d..ba06b23ea3 100644
--- a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.production.config.ts
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.production.config.ts
@@ -7,6 +7,7 @@ const webDirectory = fileURLToPath(new URL('../../../../../', import.meta.url));
export default defineConfig({
testDir: directory,
testMatch: [
+ 'calendar-points.browser.e2e.ts',
'coordinator.browser.e2e.ts',
'cache-startup.browser.e2e.ts',
'cache-artifact-compatibility.browser.e2e.ts',
diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/vite.config.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/vite.config.ts
index 693e278eb0..cf9d118223 100644
--- a/apps/web/src/lib/graphql-cache/worker/browser-test/vite.config.ts
+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/vite.config.ts
@@ -38,6 +38,7 @@ export default defineConfig(({ command }) => ({
rollupOptions: {
input: Object.fromEntries(
[
+ 'calendar-points.html',
'index.html',
'host.html',
'cutover.html',
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 57a1f22a33..817538f214 100644
--- a/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx
+++ b/apps/web/src/lib/queries/calendar/tests/mutations.test.tsx
@@ -206,6 +206,50 @@ afterEach(() => {
testQueryClient.clear();
});
+it('answers and deletes an imported point without rewriting its time', async () => {
+ const point = standaloneItem();
+ const instant = {
+ kind: 'timed' as const,
+ startsAt: '2026-08-06T14:00:00Z',
+ endsAt: '2026-08-06T14:00:00Z',
+ timeZone: null,
+ };
+ point.event.time = instant;
+ point.occurrence.time = instant;
+ for (const range of [viewportA, viewportB]) {
+ testQueryClient.setQueryData(
+ calendarKeys.occurrences('user', range).queryKey,
+ {
+ items: [point],
+ syncStatus: 'ready',
+ }
+ );
+ }
+ rsvpCalendarEventMock.mockResolvedValue(ok({ id: 'event-1' }));
+ deleteCalendarEventMock.mockResolvedValue(ok({}));
+ const actions = renderHook(() => ({
+ rsvp: useRsvpCalendarEventMutation(),
+ remove: useDeleteCalendarEventMutation(),
+ }));
+
+ await actions.rsvp.mutateAsync({ eventId: 'event-1', response: 'accepted' });
+ expect(rsvpCalendarEventMock).toHaveBeenCalledWith('event-1', {
+ response: 'accepted',
+ });
+ for (const range of [viewportA, viewportB]) {
+ expect(viewportData(range)?.items[0]?.occurrence.time).toEqual(instant);
+ }
+ await actions.remove.mutateAsync({ eventId: 'event-1' });
+ expect(deleteCalendarEventMock).toHaveBeenCalledWith('event-1', {
+ calendarId: undefined,
+ scope: undefined,
+ recurrenceId: undefined,
+ });
+ for (const range of [viewportA, viewportB]) {
+ expect(viewportData(range)?.items).toEqual([]);
+ }
+});
+
describe('useRsvpCalendarEventMutation', () => {
it('optimistically updates the self attendee across every cached viewport', async () => {
rsvpCalendarEventMock.mockResolvedValue(ok({ id: 'event-1' }));
diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/eventTimeOneOf.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/eventTimeOneOf.ts
index 946c33eab3..2fddc2ff3e 100644
--- a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/eventTimeOneOf.ts
+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/eventTimeOneOf.ts
@@ -11,7 +11,7 @@ import type { EventTimeOneOfTimeZone } from './eventTimeOneOfTimeZone';
* An event with absolute instants.
*/
export type EventTimeOneOf = {
- /** Exclusive end instant. */
+ /** Exclusive end instant; equal to the start for an imported point event. */
endsAt: string;
kind: EventTimeOneOfKind;
/** Inclusive start instant. */
diff --git a/apps/web/src/lib/service-clients/service-calendar/openapi.json b/apps/web/src/lib/service-clients/service-calendar/openapi.json
index 6acb6ba900..7337bf77ce 100644
--- a/apps/web/src/lib/service-clients/service-calendar/openapi.json
+++ b/apps/web/src/lib/service-clients/service-calendar/openapi.json
@@ -1040,7 +1040,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/eventTimeOneOf.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/eventTimeOneOf.ts
index 8058d16278..b53988c72b 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/eventTimeOneOf.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/eventTimeOneOf.ts
@@ -11,7 +11,7 @@ import type { EventTimeOneOfTimeZone } from './eventTimeOneOfTimeZone';
* An event with absolute instants.
*/
export type EventTimeOneOf = {
- /** Exclusive end instant. */
+ /** Exclusive end instant; equal to the start for an imported point event. */
endsAt: string;
kind: EventTimeOneOfKind;
/** Inclusive start instant. */
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 e36b5e2de5..cab48eb8bc 100644
--- a/apps/web/src/lib/service-clients/service-email/openapi.json
+++ b/apps/web/src/lib/service-clients/service-email/openapi.json
@@ -4747,7 +4747,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/eventTimeOneOf.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/eventTimeOneOf.ts
index ab7d93436b..436b806edb 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/eventTimeOneOf.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/eventTimeOneOf.ts
@@ -11,7 +11,7 @@ import type { EventTimeOneOfTimeZone } from './eventTimeOneOfTimeZone';
* An event with absolute instants.
*/
export type EventTimeOneOf = {
- /** Exclusive end instant. */
+ /** Exclusive end instant; equal to the start for an imported point event. */
endsAt: string;
kind: EventTimeOneOfKind;
/** Inclusive start instant. */
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index bd475e553f..b59f298ac2 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -1188,7 +1188,9 @@ export const listOccurrencesResponse = zod
.object({
endsAt: zod.iso
.datetime({})
- .describe('Exclusive end instant.'),
+ .describe(
+ 'Exclusive end instant; equal to the start for an imported point event.'
+ ),
kind: zod.enum(['timed']),
startsAt: zod.iso
.datetime({})
@@ -1249,7 +1251,9 @@ export const listOccurrencesResponse = zod
.object({
endsAt: zod.iso
.datetime({})
- .describe('Exclusive end instant.'),
+ .describe(
+ 'Exclusive end instant; equal to the start for an imported point event.'
+ ),
kind: zod.enum(['timed']),
startsAt: zod.iso
.datetime({})
@@ -1369,7 +1373,9 @@ export const mentionPreviewsResponse = zod
.object({
endsAt: zod.iso
.datetime({})
- .describe('Exclusive end instant.'),
+ .describe(
+ 'Exclusive end instant; equal to the start for an imported point event.'
+ ),
kind: zod.enum(['timed']),
startsAt: zod.iso
.datetime({})
@@ -1561,7 +1567,9 @@ export const listTeamCalendarResponse = zod
.object({
endsAt: zod.iso
.datetime({})
- .describe('Exclusive end instant.'),
+ .describe(
+ 'Exclusive end instant; equal to the start for an imported point event.'
+ ),
kind: zod.enum(['timed']),
startsAt: zod.iso
.datetime({})
@@ -1665,7 +1673,9 @@ export const listTeamOutOfOfficeResponse = zod
.object({
endsAt: zod.iso
.datetime({})
- .describe('Exclusive end instant.'),
+ .describe(
+ 'Exclusive end instant; equal to the start for an imported point event.'
+ ),
kind: zod.enum(['timed']),
startsAt: zod.iso
.datetime({})
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index a3a16aa98c..adfa74dc69 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -26212,7 +26212,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",
diff --git a/apps/web/tests/calendar-team/README.md b/apps/web/tests/calendar-team/README.md
index 2dae7d63ce..9e10e62085 100644
--- a/apps/web/tests/calendar-team/README.md
+++ b/apps/web/tests/calendar-team/README.md
@@ -4,6 +4,10 @@ This harness loads the complete bundled app and intercepts auth, team, and calen
It uses a live clock and checks that loading placeholders disappear and event chips are opaque and in the viewport before capture. It exercises sharing and availability settings, read-only event details, revocation, membership loss, a viewer without any connected Google account, and automatic data/popover expiry while refresh requests hang. The expiry check waits up to 65 seconds with the browser clock running normally.
+Imported own and shared point events must render compactly with a single time,
+without drag/resize. Editing the own point's title must omit time from its request.
+Adding a Macro call to a point must show a duration error before any mutation.
+
From `apps/web`, with Chromium installed:
```sh
diff --git a/apps/web/tests/calendar-team/browser.ts b/apps/web/tests/calendar-team/browser.ts
index aded92e1e3..2a039a2fef 100644
--- a/apps/web/tests/calendar-team/browser.ts
+++ b/apps/web/tests/calendar-team/browser.ts
@@ -73,6 +73,35 @@ const time = (hour: number) => ({
endsAt: `${fixtureDate}T${hour + 1}:00:00Z`,
timeZone: 'UTC',
});
+const pointTime = (hour: number) => ({
+ ...time(hour),
+ endsAt: time(hour).startsAt,
+});
+const ownPoint = {
+ event: {
+ id: '00000000-0000-0000-0000-000000009001',
+ ownerId: USER_ID,
+ icalUid: 'synthetic-point',
+ calendarId: 'primary',
+ title: 'Imported point',
+ time: pointTime(11),
+ status: 'confirmed',
+ eventType: 'default',
+ transparency: 'opaque',
+ visibility: 'default',
+ isReadOnly: false,
+ attendees: [],
+ recurrenceLines: [],
+ sources: [],
+ },
+ occurrence: {
+ eventId: '00000000-0000-0000-0000-000000009001',
+ occurrenceKey: pointTime(11).startsAt,
+ recurrenceId: null,
+ isCancelled: false,
+ time: pointTime(11),
+ },
+};
const items = [
{
id: 'opaque-details',
@@ -106,6 +135,23 @@ const items = [
time: time(12),
contributesToAvailability: true,
},
+ {
+ id: 'opaque-point',
+ ownerId: ALICE,
+ kind: 'details',
+ time: pointTime(13),
+ contributesToAvailability: false,
+ details: {
+ title: 'Shared point',
+ description: null,
+ location: null,
+ conferenceUrl: null,
+ organizerEmail: null,
+ organizerName: null,
+ attendees: [],
+ calendarName: 'Alice primary',
+ },
+ },
{
id: 'opaque-followed',
ownerId: BOB,
@@ -216,9 +262,18 @@ await page.route('**/*', async (route) => {
}
if (path === '/dss/calendar-events/team-out-of-office')
return respond({ items: [], hasMore: false });
+ if (
+ path === `/calendar/events/${ownPoint.event.id}` &&
+ request.method() === 'PATCH'
+ ) {
+ const body = request.postDataJSON();
+ mutations.push({ eventPatch: body });
+ if (body.title) ownPoint.event.title = body.title;
+ return respond(ownPoint.event);
+ }
if (path === '/dss/calendar-events')
return respond({
- items: [],
+ items: connected ? [ownPoint] : [],
hasMore: false,
nextCursor: null,
syncStatus: 'ready',
@@ -289,6 +344,98 @@ try {
path: '/tmp/calendar-team-grid.png',
fullPage: true,
});
+ const activeCalendar = page
+ .getByRole('region', { name: 'Calendar periods' })
+ .locator('.pager-page[aria-hidden="false"]');
+ const pointChip = activeCalendar
+ .getByText('Imported point', { exact: true })
+ .locator(
+ 'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " fc-event ")][1]'
+ );
+ await expect(pointChip).toBeInViewport();
+ const pointBounds = await pointChip.boundingBox();
+ assert.ok(
+ pointBounds && pointBounds.height > 0 && pointBounds.height < 30,
+ 'Point must have a compact footprint, not an invented hour'
+ );
+ await expect(pointChip).not.toHaveClass(
+ /fc-event-draggable|fc-event-resizable/
+ );
+ await expect(pointChip).toContainText('11:00');
+ await expect(pointChip).not.toContainText('12:00');
+ // Upcoming uses the exact point instant, and never treats it as ongoing.
+ if (Date.now() < Date.parse(ownPoint.event.time.startsAt)) {
+ await expect(
+ page.getByRole('button', { name: 'Open Imported point', exact: true })
+ ).toBeVisible();
+ }
+ await pointChip.click();
+ await expect(page.getByText(/No duration/).first()).toBeVisible();
+ await page.getByRole('button', { name: 'Edit event', exact: true }).click();
+ await page
+ .getByRole('textbox', { name: 'Title', exact: true })
+ .fill('Imported point updated');
+ await page.getByText('Add meeting link', { exact: true }).click();
+ await page.getByRole('option', { name: 'Macro call', exact: true }).click();
+ await page.getByRole('button', { name: 'Save', exact: true }).click();
+ await expect(page.getByRole('alert')).toContainText(
+ 'Give this event a duration before adding a Macro call.'
+ );
+ assert.deepEqual(
+ mutations,
+ [],
+ 'Rejected point call must not save calendar changes'
+ );
+ await page.getByText('Macro call', { exact: true }).click();
+ await page
+ .getByRole('option', { name: 'No meeting link', exact: true })
+ .click();
+ await page.getByRole('button', { name: 'Save', exact: true }).click();
+ await expect
+ .poll(() =>
+ mutations.some(
+ (entry) =>
+ typeof entry === 'object' && entry !== null && 'eventPatch' in entry
+ )
+ )
+ .toBe(true);
+ const savedPoint = mutations.find(
+ (entry): entry is { eventPatch: Record<string, unknown> } =>
+ typeof entry === 'object' && entry !== null && 'eventPatch' in entry
+ );
+ assert.equal(savedPoint?.eventPatch.title, 'Imported point updated');
+ assert.equal('time' in (savedPoint?.eventPatch ?? {}), false);
+ await expect(
+ page.getByRole('textbox', { name: 'Title', exact: true })
+ ).toHaveCount(0);
+ await page.keyboard.press('Escape');
+ const sharedPointChip = activeCalendar
+ .getByText('Alice Fixture: Shared point', { exact: true })
+ .locator(
+ 'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " fc-event ")][1]'
+ );
+ await expect(sharedPointChip).toBeInViewport();
+ const sharedPointBounds = await sharedPointChip.boundingBox();
+ assert.ok(
+ sharedPointBounds &&
+ sharedPointBounds.height > 0 &&
+ sharedPointBounds.height < 30
+ );
+ await expect(sharedPointChip).not.toHaveClass(
+ /fc-event-draggable|fc-event-resizable/
+ );
+ await sharedPointChip.click();
+ await expect(
+ page.locator('section[aria-label="Shared event details"]')
+ ).toContainText('No duration');
+ await expect(
+ page.locator('section[aria-label="Shared event details"]')
+ ).toContainText('Does not count toward their busy time');
+ await page.screenshot({
+ path: '/tmp/calendar-team-points.png',
+ fullPage: true,
+ });
+ await page.keyboard.press('Escape');
await page.getByText('Team planning', { exact: false }).first().click();
const detail = page.locator('section[aria-label="Shared event details"]');
await expect(detail).toContainText('Shared in Macro · Read only');
@@ -441,7 +588,7 @@ try {
assert.deepEqual(errors, []);
assert.deepEqual(requestFailures, []);
console.log(
- 'PASS: full-app team settings, sanitized blocks, read-only details, revoked-data removal, membership loss, viewer without Google, and expiry during hung refresh'
+ 'PASS: imported own/shared points and metadata-only edit, full-app team settings, sanitized blocks, read-only details, revoked-data removal, membership loss, viewer without Google, and expiry during hung refresh'
);
} catch (error) {
console.error(error);
diff --git a/crates/calendar_events/src/domain/models.rs b/crates/calendar_events/src/domain/models.rs
index f820142a1e..2738be76d3 100644
--- a/crates/calendar_events/src/domain/models.rs
+++ b/crates/calendar_events/src/domain/models.rs
@@ -135,7 +135,7 @@ pub enum EventTime {
Timed {
/// Inclusive start instant.
starts_at: DateTime<Utc>,
- /// Exclusive end instant.
+ /// Exclusive end instant; equal to the start for an imported point event.
ends_at: DateTime<Utc>,
/// Original IANA time-zone identifier, when supplied.
time_zone: Option<String>,
@@ -151,8 +151,21 @@ pub enum EventTime {
}
impl EventTime {
- /// Validate the exclusive end is later than the start.
+ /// Validate a stored event, including a timed point with no occupied duration.
pub fn is_valid(&self) -> bool {
+ match self {
+ Self::Timed {
+ starts_at, ends_at, ..
+ } => ends_at >= starts_at,
+ Self::AllDay {
+ start_date,
+ end_date,
+ } => end_date > start_date,
+ }
+ }
+
+ /// Whether the event occupies a positive duration. User time writes require this.
+ pub fn has_positive_duration(&self) -> bool {
match self {
Self::Timed {
starts_at, ends_at, ..
@@ -172,12 +185,16 @@ impl EventTime {
}
}
- /// Return whether this span overlaps an occurrence query range.
+ /// Query membership: spans overlap the range and points use [start, end).
pub fn overlaps(&self, range: &OccurrenceRange) -> bool {
match self {
Self::Timed {
starts_at, ends_at, ..
- } => starts_at < &range.ends_at && ends_at > &range.starts_at,
+ } => {
+ starts_at < &range.ends_at
+ && (ends_at > &range.starts_at
+ || (ends_at == starts_at && starts_at >= &range.starts_at))
+ }
Self::AllDay {
start_date,
end_date,
diff --git a/crates/calendar_events/src/domain/models/test.rs b/crates/calendar_events/src/domain/models/test.rs
index 1a85316245..298a5bda09 100644
--- a/crates/calendar_events/src/domain/models/test.rs
+++ b/crates/calendar_events/src/domain/models/test.rs
@@ -1,6 +1,38 @@
use super::*;
use chrono::TimeZone;
+#[test]
+fn timed_points_are_valid_and_use_start_inclusive_end_exclusive_membership() {
+ let start = Utc.with_ymd_and_hms(2026, 10, 8, 9, 0, 0).unwrap();
+ let window = range(start, start + chrono::Duration::hours(1));
+ for (offset, included) in [(-1, false), (0, true), (30, true), (60, false)] {
+ let point = start + chrono::Duration::minutes(offset);
+ let time = EventTime::Timed {
+ starts_at: point,
+ ends_at: point,
+ time_zone: None,
+ };
+ assert!(time.is_valid());
+ assert!(!time.has_positive_duration());
+ assert_eq!(time.overlaps(&window), included);
+ }
+ assert!(
+ !EventTime::Timed {
+ starts_at: start,
+ ends_at: start - chrono::Duration::seconds(1),
+ time_zone: None
+ }
+ .is_valid()
+ );
+ assert!(
+ !EventTime::AllDay {
+ start_date: start.date_naive(),
+ end_date: start.date_naive()
+ }
+ .is_valid()
+ );
+}
+
fn range(starts_at: DateTime<Utc>, ends_at: DateTime<Utc>) -> OccurrenceRange {
OccurrenceRange {
starts_at,
diff --git a/crates/calendar_events/src/domain/mutations.rs b/crates/calendar_events/src/domain/mutations.rs
index 2b7297ba8a..b89201b7c7 100644
--- a/crates/calendar_events/src/domain/mutations.rs
+++ b/crates/calendar_events/src/domain/mutations.rs
@@ -632,7 +632,7 @@ where
}
fn validate_time(time: &EventTime) -> Result<(), CalendarMutationError> {
- if !time.is_valid() {
+ if !time.has_positive_duration() {
return Err(CalendarMutationError::InvalidInput(
"event end must be after its start".to_string(),
));
diff --git a/crates/calendar_events/src/domain/mutations/test.rs b/crates/calendar_events/src/domain/mutations/test.rs
index 72c5e9204d..a60b3a3e05 100644
--- a/crates/calendar_events/src/domain/mutations/test.rs
+++ b/crates/calendar_events/src/domain/mutations/test.rs
@@ -433,6 +433,7 @@ struct FakeProvider {
rsvp_self_emails: Arc<Mutex<Vec<Vec<String>>>>,
echo_attendees: Vec<CalendarAttendee>,
echo_overrides: Vec<CalendarEventOverride>,
+ echo_time: Option<EventTime>,
created_drafts: Arc<Mutex<Vec<CalendarEventDraft>>>,
updated_patches: Arc<Mutex<Vec<CalendarEventPatch>>>,
}
@@ -445,6 +446,7 @@ impl FakeProvider {
rsvp_self_emails: Arc::new(Mutex::new(Vec::new())),
echo_attendees: Vec::new(),
echo_overrides: Vec::new(),
+ echo_time: None,
created_drafts: Arc::new(Mutex::new(Vec::new())),
updated_patches: Arc::new(Mutex::new(Vec::new())),
}
@@ -454,6 +456,12 @@ impl FakeProvider {
let mut upsert = echo_upsert(owner_id);
upsert.event.attendees = self.echo_attendees.clone();
upsert.overrides = self.echo_overrides.clone();
+ if let Some(time) = &self.echo_time {
+ upsert.event.time = time.clone();
+ for occurrence in &mut upsert.occurrences {
+ occurrence.time = time.clone();
+ }
+ }
upsert
}
@@ -1264,6 +1272,33 @@ async fn create_rejects_invalid_input_before_reaching_the_provider() {
Err(CalendarMutationError::InvalidInput(_))
));
+ let point = EventTime::Timed {
+ starts_at,
+ ends_at: starts_at,
+ time_zone: None,
+ };
+ let mut point_draft = draft();
+ point_draft.time = point.clone();
+ assert!(matches!(
+ svc.create_event("macro|user", None, None, point_draft)
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+ assert!(matches!(
+ svc.update_event(
+ "macro|user",
+ Uuid::now_v7(),
+ None,
+ CalendarEventPatch {
+ time: Some(point),
+ ..Default::default()
+ },
+ CalendarUpdateScope::All
+ )
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+
let mut bad_email = draft();
bad_email.attendees[0].email = "not-an-email".to_string();
assert!(matches!(
@@ -1408,6 +1443,51 @@ async fn create_out_of_office_rejects_all_day_spans_and_attendees() {
));
}
+#[tokio::test]
+async fn imported_point_accepts_metadata_and_rsvp_provider_echoes() {
+ let mut provider = FakeProvider::new(FakeProviderBehavior::Echo);
+ let starts_at = Utc.with_ymd_and_hms(2026, 8, 6, 14, 0, 0).unwrap();
+ let point = EventTime::Timed {
+ starts_at,
+ ends_at: starts_at,
+ time_zone: Some("UTC".to_owned()),
+ };
+ provider.echo_time = Some(point.clone());
+ let repo = FakeRepo {
+ mutation_target: Some(mutation_target(false)),
+ ..FakeRepo::default()
+ };
+ let upserts = repo.upserts.clone();
+ let service = service(repo, provider, FakeTokens::ok());
+ service
+ .update_event(
+ "macro|user",
+ Uuid::now_v7(),
+ None,
+ CalendarEventPatch {
+ title: Some("Renamed point".to_owned()),
+ ..CalendarEventPatch::default()
+ },
+ CalendarUpdateScope::All,
+ )
+ .await
+ .unwrap();
+ service
+ .respond_to_event(
+ "macro|user",
+ Uuid::now_v7(),
+ None,
+ AttendeeResponseStatus::Accepted,
+ CalendarRsvpScope::All,
+ None,
+ )
+ .await
+ .unwrap();
+ let writes = upserts.lock().unwrap();
+ assert_eq!(writes.len(), 2);
+ assert!(writes.iter().all(|upsert| upsert.event.time == point));
+}
+
#[tokio::test]
async fn update_validates_lookup_policy_and_addresses_the_series_master() {
let empty_patch = service(
diff --git a/crates/calendar_events/src/domain/service/test.rs b/crates/calendar_events/src/domain/service/test.rs
index 0473a7d744..1ef1229cc3 100644
--- a/crates/calendar_events/src/domain/service/test.rs
+++ b/crates/calendar_events/src/domain/service/test.rs
@@ -16,7 +16,7 @@ use crate::domain::{
GoogleCalendarProvider, GoogleEventSyncContext, GoogleProviderError,
},
};
-use chrono::{TimeZone, Utc};
+use chrono::{Duration, TimeZone, Utc};
use macro_event_broker::NoopMacroEventBroker;
use std::sync::{Arc, Mutex};
@@ -354,7 +354,7 @@ fn accepts_valid_event() {
}
#[test]
-fn rejects_invalid_occurrence_time() {
+fn accepts_point_occurrence_but_rejects_reversed_time() {
let mut upsert = valid_upsert();
let starts_at = Utc.with_ymd_and_hms(2026, 7, 24, 14, 0, 0).unwrap();
upsert.occurrences[0].time = EventTime::Timed {
@@ -363,6 +363,10 @@ fn rejects_invalid_occurrence_time() {
time_zone: None,
};
+ assert!(validate_upsert(&upsert).is_ok());
+ if let EventTime::Timed { ends_at, .. } = &mut upsert.occurrences[0].time {
+ *ends_at -= Duration::seconds(1);
+ }
assert!(validate_upsert(&upsert).is_err());
}
@@ -1608,7 +1612,7 @@ impl GoogleCalendarProvider for InvalidNormalizedGoogleProvider {
let start = Utc.with_ymd_and_hms(2026, 7, 24, 14, 0, 0).unwrap();
valid.occurrences[0].time = EventTime::Timed {
starts_at: start,
- ends_at: start,
+ ends_at: start - Duration::seconds(1),
time_zone: None,
};
upserts.push(valid);
diff --git a/crates/calendar_events/src/domain/team/models.rs b/crates/calendar_events/src/domain/team/models.rs
index 33d2208dc9..eaa6aa0aa0 100644
--- a/crates/calendar_events/src/domain/team/models.rs
+++ b/crates/calendar_events/src/domain/team/models.rs
@@ -88,6 +88,13 @@ pub struct TeamSourceOccurrence {
}
impl TeamSourceOccurrence {
+ /// The effective interval from this source's exact occurrence or exception.
+ pub fn time(&self) -> &EventTime {
+ self.exception()
+ .map(|exception| &exception.time)
+ .unwrap_or(&self.occurrence.time)
+ }
+
/// Visibility used by a team view. An instance can restrict disclosure,
/// but cannot unhide content from a private series snapshot.
pub fn visibility(&self) -> EventVisibility {
@@ -109,7 +116,9 @@ impl TeamSourceOccurrence {
.unwrap_or(self.event.transparency)
}
- /// Whether this source occurrence blocks its source calendar at all.
+ /// Whether this source occurrence is eligible to contribute busy time.
+ /// Keep points eligible here so conflicting positive copies are detected;
+ /// projection and interval merging separately exclude their empty duration.
pub fn is_busy(&self) -> bool {
!self.occurrence.is_cancelled
&& self.event.status != EventStatus::Cancelled
@@ -135,7 +144,8 @@ impl TeamSourceOccurrence {
.unwrap_or(&self.event.attendees)
}
- /// Whether the occurrence represents this person's busy time.
+ /// Whether this person's calendar/attendance makes the occurrence eligible
+ /// for availability, before checking its duration or reconciling copies.
pub fn is_personally_busy(&self) -> bool {
if !self.is_busy() {
return false;
diff --git a/crates/calendar_events/src/domain/team/service.rs b/crates/calendar_events/src/domain/team/service.rs
index 3a2bb8c9ea..4f0a58647b 100644
--- a/crates/calendar_events/src/domain/team/service.rs
+++ b/crates/calendar_events/src/domain/team/service.rs
@@ -319,7 +319,7 @@ fn project(
},
}
} else {
- if !source.is_busy() {
+ if !source.is_busy() || !source.time().has_positive_duration() {
return None;
}
TeamCalendarContent::Busy
@@ -334,8 +334,9 @@ fn project(
Some(TeamCalendarItem {
id: Uuid::new_v5(&Uuid::NAMESPACE_OID, &identity).to_string(),
owner_id: source.shared_by.clone(),
- time: source.occurrence.time.clone(),
- contributes_to_availability: source.is_personally_busy(),
+ time: source.time().clone(),
+ contributes_to_availability: source.is_personally_busy()
+ && source.time().has_positive_duration(),
content,
})
}
diff --git a/crates/calendar_events/src/domain/team/service/test.rs b/crates/calendar_events/src/domain/team/service/test.rs
index 016b0a1df9..202ff06541 100644
--- a/crates/calendar_events/src/domain/team/service/test.rs
+++ b/crates/calendar_events/src/domain/team/service/test.rs
@@ -92,6 +92,26 @@ fn subscribed_busy_block_is_shared_without_claiming_personal_busyness() {
assert!(project(&row, TeamCalendarSharing::BusyOnly, &[]).is_none());
}
+#[test]
+fn details_can_show_a_point_without_inventing_masked_busy_time() {
+ let mut row = source();
+ if let EventTime::Timed {
+ starts_at, ends_at, ..
+ } = &mut row.occurrence.time
+ {
+ *ends_at = *starts_at;
+ }
+ let detailed = project(&row, TeamCalendarSharing::All, &[]).unwrap();
+ assert!(matches!(
+ detailed.content,
+ TeamCalendarContent::Details { .. }
+ ));
+ assert!(!detailed.contributes_to_availability);
+ assert!(project(&row, TeamCalendarSharing::BusyOnly, &[]).is_none());
+ row.event.visibility = EventVisibility::Private;
+ assert!(project(&row, TeamCalendarSharing::All, &[]).is_none());
+}
+
#[test]
fn detailed_attendee_flags_are_viewer_relative() {
let row = source();
diff --git a/crates/calendar_events/src/domain/team_availability.rs b/crates/calendar_events/src/domain/team_availability.rs
index 5e2449315c..0c0efb34d8 100644
--- a/crates/calendar_events/src/domain/team_availability.rs
+++ b/crates/calendar_events/src/domain/team_availability.rs
@@ -148,10 +148,7 @@ pub fn calculate(range: OccurrenceRange, sources: TeamAvailabilitySources) -> Te
{
continue;
}
- let time = source
- .exception()
- .map(|exception| &exception.time)
- .unwrap_or(&source.occurrence.time);
+ let time = source.time();
let interval = match interval(time, source.calendar_time_zone.as_deref()) {
Ok(interval) => interval,
Err(reason) => {
@@ -159,7 +156,10 @@ pub fn calculate(range: OccurrenceRange, sources: TeamAvailabilitySources) -> Te
continue;
}
};
- if interval.end <= range.starts_at || interval.start >= range.ends_at {
+ if interval.start >= range.ends_at
+ || (interval.end <= range.starts_at
+ && !(interval.start == interval.end && interval.start == range.starts_at))
+ {
continue;
}
member
@@ -263,6 +263,9 @@ fn interval(
time: &EventTime,
calendar_zone: Option<&str>,
) -> Result<AvailabilityInterval, AvailabilityUnknownReason> {
+ if !time.is_valid() {
+ return Err(AvailabilityUnknownReason::InvalidInterval);
+ }
let (start, end) = match time {
EventTime::Timed {
starts_at, ends_at, ..
@@ -281,7 +284,7 @@ fn interval(
)
}
};
- if end <= start {
+ if end < start || (end == start && matches!(time, EventTime::AllDay { .. })) {
return Err(AvailabilityUnknownReason::InvalidInterval);
}
Ok(AvailabilityInterval { start, end })
diff --git a/crates/calendar_events/src/domain/team_availability/test.rs b/crates/calendar_events/src/domain/team_availability/test.rs
index ff73235661..9d61bce044 100644
--- a/crates/calendar_events/src/domain/team_availability/test.rs
+++ b/crates/calendar_events/src/domain/team_availability/test.rs
@@ -134,6 +134,78 @@ fn inputs(
}
}
+#[test]
+fn skipped_all_day_date_is_unknown_instead_of_becoming_a_timed_point() {
+ let mut row = source("a", "skipped-day", all_day("2011-12-30", "2011-12-31"));
+ row.calendar_time_zone = Some("Pacific/Apia".to_owned());
+ let result = calculate(
+ range("2011-12-29T00:00:00Z", "2012-01-01T00:00:00Z"),
+ inputs(vec![member("a")], vec![row]),
+ );
+ assert!(!result.complete);
+ assert!(result.free_windows.is_none());
+ assert_eq!(
+ result.members[0].unknown_reasons,
+ vec![AvailabilityUnknownReason::InvalidInterval]
+ );
+}
+
+#[test]
+fn points_add_no_busy_duration_but_cannot_erase_a_conflicting_positive_copy() {
+ let point = source(
+ "a",
+ "same-identity",
+ timed("2026-10-07T09:00:00Z", "2026-10-07T09:00:00Z"),
+ );
+ let only_points = calculate(
+ window(),
+ inputs(vec![member("a")], vec![point.clone(), point.clone()]),
+ );
+ assert!(only_points.complete);
+ assert!(only_points.members[0].busy.is_empty());
+ assert_eq!(
+ only_points.free_windows.unwrap(),
+ vec![span("2026-10-07T09:00:00Z", "2026-10-07T17:00:00Z")]
+ );
+
+ let positive = source(
+ "a",
+ "same-identity",
+ timed("2026-10-07T09:00:00Z", "2026-10-07T10:00:00Z"),
+ );
+ for copies in [vec![point.clone(), positive.clone()], vec![positive, point]] {
+ let conflict = calculate(window(), inputs(vec![member("a")], copies));
+ assert!(!conflict.complete);
+ assert!(conflict.free_windows.is_none());
+ assert_eq!(
+ conflict.members[0].busy,
+ vec![span("2026-10-07T09:00:00Z", "2026-10-07T10:00:00Z")]
+ );
+ assert_eq!(
+ conflict.members[0].unknown_reasons,
+ vec![AvailabilityUnknownReason::ConflictingCopies]
+ );
+ }
+}
+
+#[test]
+fn point_series_master_does_not_hide_a_positive_occurrence() {
+ let mut row = source(
+ "a",
+ "series",
+ timed("2026-10-07T10:00:00Z", "2026-10-07T11:00:00Z"),
+ );
+ row.event.time = timed("2026-10-07T09:00:00Z", "2026-10-07T09:00:00Z");
+ row.event.recurrence_lines = vec!["RRULE:FREQ=DAILY".into()];
+ row.occurrence.recurrence_id = Some("2026-10-07T09:00:00Z".into());
+ let result = calculate(window(), inputs(vec![member("a")], vec![row]));
+ assert!(result.complete);
+ assert_eq!(
+ result.members[0].busy,
+ vec![span("2026-10-07T10:00:00Z", "2026-10-07T11:00:00Z")]
+ );
+}
+
#[test]
fn merges_busy_copies_and_clips_common_free_to_requested_range() {
let first = source(
diff --git a/crates/calendar_events/src/outbound/google.rs b/crates/calendar_events/src/outbound/google.rs
index 618b4150b4..595726812b 100644
--- a/crates/calendar_events/src/outbound/google.rs
+++ b/crates/calendar_events/src/outbound/google.rs
@@ -26,6 +26,10 @@ use crate::domain::{
};
const GOOGLE_CALENDAR_API: &str = "https://www.googleapis.com/calendar/v3";
+// Events.list excludes the lower end bound and ignores fractional seconds.
+// A full second of padding admits points at the requested inclusive start;
+// normalization still filters occurrences against the exact requested range.
+const LIST_LOWER_BOUND_PADDING: chrono::Duration = chrono::Duration::seconds(1);
/// Consulted before every Google Calendar HTTP request so deployments can
/// enforce the per-user API quota. Denials surface as transient provider
@@ -126,7 +130,10 @@ impl<G: GoogleRequestGate> GoogleCalendarClient<G> {
("maxResults", "2500".to_string()),
("singleEvents", single_events.to_string()),
("showDeleted", "false".to_string()),
- ("timeMin", range.starts_at.to_rfc3339()),
+ (
+ "timeMin",
+ (range.starts_at - LIST_LOWER_BOUND_PADDING).to_rfc3339(),
+ ),
("timeMax", range.ends_at.to_rfc3339()),
("timeZone", "UTC".to_string()),
]);
@@ -179,7 +186,10 @@ impl<G: GoogleRequestGate> GoogleCalendarClient<G> {
// past only: a timeMax would be encoded into the token and
// silently hide events created beyond it once the maintained
// window extends.
- request = request.query(&[("timeMin", window.starts_at.to_rfc3339())]);
+ request = request.query(&[(
+ "timeMin",
+ (window.starts_at - LIST_LOWER_BOUND_PADDING).to_rfc3339(),
+ )]);
}
if let Some(token) = &page_token {
request = request.query(&[("pageToken", token)]);
diff --git a/crates/calendar_events/src/outbound/google/test.rs b/crates/calendar_events/src/outbound/google/test.rs
index 301ad3685d..8054e38219 100644
--- a/crates/calendar_events/src/outbound/google/test.rs
+++ b/crates/calendar_events/src/outbound/google/test.rs
@@ -1,5 +1,7 @@
use super::*;
+mod points;
+
#[test]
fn calendar_access_role_is_reflected_on_mapped_events() {
let master: GoogleEvent = serde_json::from_value(serde_json::json!({
@@ -211,7 +213,11 @@ fn malformed_recurring_instance_does_not_overstate_snapshot_coverage() {
);
let mut invalid_interval = malformed_instance.clone();
- invalid_interval.end = invalid_interval.start.clone();
+ invalid_interval.end = Some(GoogleEventDateTime {
+ date_time: Some("2026-07-24T13:00:00Z".to_owned()),
+ date: None,
+ time_zone: None,
+ });
assert!(map_upsert(&target, master.clone(), Vec::new(), vec![invalid_interval]).is_err());
let mut missing_identity = malformed_instance.clone();
diff --git a/crates/calendar_events/src/outbound/google/test/points.rs b/crates/calendar_events/src/outbound/google/test/points.rs
new file mode 100644
index 0000000000..cb2d9fa609
--- /dev/null
+++ b/crates/calendar_events/src/outbound/google/test/points.rs
@@ -0,0 +1,368 @@
+use super::*;
+
+fn instant(value: &str) -> DateTime<Utc> {
+ DateTime::parse_from_rfc3339(value)
+ .unwrap()
+ .with_timezone(&Utc)
+}
+
+fn target() -> GoogleCalendarTarget {
+ GoogleCalendarTarget {
+ observed_access_role: Some("owner".to_owned()),
+ owner_id: "macro|[email protected]".to_owned(),
+ email_link_id: Uuid::now_v7(),
+ account_id: Uuid::now_v7(),
+ calendar_id: Uuid::now_v7(),
+ provider_calendar_id: "primary".to_owned(),
+ is_read_only: false,
+ range: OccurrenceRange {
+ starts_at: instant("2026-07-01T00:00:00Z"),
+ ends_at: instant("2026-08-01T00:00:00Z"),
+ start_date: NaiveDate::from_ymd_opt(2026, 7, 1).unwrap(),
+ end_date: NaiveDate::from_ymd_opt(2026, 8, 1).unwrap(),
+ },
+ }
+}
+
+fn timed_event(id: &str, start: &str, end: &str) -> GoogleEvent {
+ serde_json::from_value(serde_json::json!({
+ "id": id,
+ "iCalUID": format!("{id}@example.test"),
+ "status": "confirmed",
+ "eventType": "default",
+ "summary": "Imported calendar event",
+ "start": {"dateTime": start, "timeZone": "UTC"},
+ "end": {"dateTime": end, "timeZone": "UTC"},
+ "updated": "2026-07-01T01:00:00Z"
+ }))
+ .unwrap()
+}
+
+fn instance(master: &GoogleEvent, original: &str, start: &str, end: &str) -> GoogleEvent {
+ let mut event = timed_event("instance", start, end);
+ event.ical_uid = master.ical_uid.clone();
+ event.recurring_event_id = Some(master.id.clone());
+ event.original_start_time = Some(GoogleEventDateTime {
+ date: None,
+ date_time: Some(original.to_owned()),
+ time_zone: Some("UTC".to_owned()),
+ });
+ event
+}
+
+#[test]
+fn point_snapshot_preserves_source_and_exact_window_membership() {
+ let target = target();
+ let events = [
+ ("before", "2026-06-30T23:59:59.500Z"),
+ ("left", "2026-07-01T00:00:00Z"),
+ ("inside", "2026-07-24T14:00:00Z"),
+ ("right", "2026-08-01T00:00:00Z"),
+ ]
+ .map(|(id, at)| timed_event(id, at, at));
+ let snapshot = map_snapshot(&target, events.to_vec(), events.to_vec()).unwrap();
+ assert_eq!(snapshot.upserts.len(), events.len());
+ assert_eq!(snapshot.observed_provider_event_ids.len(), events.len());
+ for upsert in snapshot.upserts {
+ let CalendarEventSource::Google(source) = &upsert.source;
+ assert_eq!(source.account_id, target.account_id);
+ assert_eq!(source.calendar_id, target.calendar_id);
+ assert_eq!(source.observed_access_role.as_deref(), Some("owner"));
+ assert!(upsert.event.time.is_valid());
+ assert!(!upsert.event.time.has_positive_duration());
+ let expected_count = usize::from(matches!(
+ source.provider_event_id.as_str(),
+ "left" | "inside"
+ ));
+ assert_eq!(upsert.occurrences.len(), expected_count);
+ if let Some(occurrence) = upsert.occurrences.first() {
+ assert_eq!(occurrence.time, upsert.event.time);
+ assert_eq!(
+ occurrence.occurrence_key,
+ upsert.event.time.occurrence_key()
+ );
+ }
+ }
+}
+
+#[test]
+fn point_series_master_retains_positive_moved_exception_and_point_instance() {
+ let target = target();
+ let mut master = timed_event("master", "2026-07-24T14:00:00Z", "2026-07-24T14:00:00Z");
+ master.recurrence = vec!["RRULE:FREQ=DAILY;COUNT=2".to_owned()];
+ let point = instance(
+ &master,
+ "2026-07-24T14:00:00Z",
+ "2026-07-24T14:00:00Z",
+ "2026-07-24T14:00:00Z",
+ );
+ let positive = instance(
+ &master,
+ "2026-07-25T14:00:00Z",
+ "2026-07-25T15:00:00Z",
+ "2026-07-25T16:00:00Z",
+ );
+ let upsert = map_upsert(
+ &target,
+ master,
+ vec![positive.clone()],
+ vec![point, positive],
+ )
+ .unwrap();
+ assert!(!upsert.event.time.has_positive_duration());
+ assert_eq!(upsert.overrides.len(), 1);
+ assert!(upsert.overrides[0].time.has_positive_duration());
+ assert_eq!(upsert.occurrences.len(), 2);
+ assert!(!upsert.occurrences[0].time.has_positive_duration());
+ assert!(upsert.occurrences[1].time.has_positive_duration());
+ assert_eq!(
+ upsert.occurrences[1].recurrence_id,
+ Some("2026-07-25T14:00:00+00:00".to_owned())
+ );
+ assert_eq!(
+ upsert.occurrences[1].occurrence_key,
+ upsert.overrides[0].recurrence_id
+ );
+}
+
+#[test]
+fn moved_exception_can_change_between_duration_and_point_without_changing_identity() {
+ let target = target();
+ let mut master = timed_event("master", "2026-07-24T14:00:00Z", "2026-07-24T15:00:00Z");
+ master.recurrence = vec!["RRULE:FREQ=DAILY".to_owned()];
+ for end in [
+ "2026-07-25T16:00:00Z",
+ "2026-07-25T15:00:00Z",
+ "2026-07-25T17:00:00Z",
+ ] {
+ let exception = instance(&master, "2026-07-25T14:00:00Z", "2026-07-25T15:00:00Z", end);
+ let upsert = map_upsert(
+ &target,
+ master.clone(),
+ vec![exception.clone()],
+ vec![exception],
+ )
+ .unwrap();
+ assert_eq!(upsert.occurrences.len(), 1);
+ assert_eq!(upsert.overrides.len(), 1);
+ assert_eq!(
+ upsert.occurrences[0].occurrence_key,
+ "2026-07-25T14:00:00+00:00"
+ );
+ assert_eq!(
+ upsert.overrides[0].recurrence_id,
+ upsert.occurrences[0].occurrence_key
+ );
+ assert_eq!(upsert.overrides[0].time, upsert.occurrences[0].time);
+ assert!(
+ matches!(&upsert.occurrences[0].time, EventTime::Timed { ends_at, .. } if *ends_at == instant(end))
+ );
+ }
+}
+
+#[tokio::test]
+async fn a_duration_becoming_a_point_is_an_upsert_with_the_same_provider_identity() {
+ let target = target();
+ let client = GoogleCalendarClient::new(Client::new());
+ let mut event = timed_event("same-event", "2026-07-24T14:00:00Z", "2026-07-24T15:00:00Z");
+ let before = client
+ .apply_change_feed("unused", &target, vec![event.clone()])
+ .await
+ .unwrap();
+ event.end = event.start.clone();
+ event.updated = Some("2026-07-24T13:00:00Z".to_owned());
+ let after = client
+ .apply_change_feed("unused", &target, vec![event])
+ .await
+ .unwrap();
+ assert_eq!(before.upserts.len(), 1);
+ assert_eq!(after.upserts.len(), 1);
+ assert!(after.cancelled.is_empty());
+ assert!(after.upserted_singles.contains("same-event"));
+ let before = &before.upserts[0];
+ let after = &after.upserts[0];
+ let CalendarEventSource::Google(before_source) = &before.source;
+ let CalendarEventSource::Google(after_source) = &after.source;
+ assert_eq!(
+ before_source.provider_event_id,
+ after_source.provider_event_id
+ );
+ assert_eq!(before_source.calendar_id, after_source.calendar_id);
+ assert_eq!(before.event.ical_uid, after.event.ical_uid);
+ assert!(before.event.time.has_positive_duration());
+ assert!(!after.event.time.has_positive_duration());
+ assert_eq!(after.occurrences.len(), 1);
+ assert_eq!(after.occurrences[0].time, after.event.time);
+ assert_eq!(
+ after.occurrences[0].occurrence_key,
+ before.occurrences[0].occurrence_key
+ );
+ assert_eq!(
+ after_source.raw_payload["start"]["dateTime"],
+ after_source.raw_payload["end"]["dateTime"]
+ );
+ assert!(after.event.updated_at > before.event.updated_at);
+}
+
+#[tokio::test]
+async fn reversed_timed_and_nonpositive_all_day_events_still_reject_whole_batches() {
+ let target = target();
+ let client = GoogleCalendarClient::new(Client::new());
+ let valid = timed_event(
+ "valid-point",
+ "2026-07-24T14:00:00Z",
+ "2026-07-24T14:00:00Z",
+ );
+ let reversed = timed_event("reversed", "2026-07-24T14:00:00Z", "2026-07-24T13:00:00Z");
+ let all_day = |end: &str| {
+ serde_json::from_value::<GoogleEvent>(serde_json::json!({
+ "id": "invalid-all-day", "iCalUID": "[email protected]",
+ "start": {"date": "2026-07-24"}, "end": {"date": end}
+ }))
+ .unwrap()
+ };
+ for invalid in [reversed, all_day("2026-07-24"), all_day("2026-07-23")] {
+ assert!(google_time(&invalid).is_err());
+ assert!(
+ map_snapshot(
+ &target,
+ vec![valid.clone(), invalid.clone()],
+ vec![valid.clone()]
+ )
+ .is_err()
+ );
+ let result = client
+ .apply_change_feed("unused", &target, vec![valid.clone(), invalid])
+ .await;
+ assert!(matches!(result, Err(error) if error.kind() == GoogleProviderErrorKind::Transient));
+ }
+}
+
+#[test]
+fn a_point_orphan_at_the_left_edge_is_missing_coverage_but_outside_is_not() {
+ let target = target();
+ let master = timed_event(
+ "missing-master",
+ "2026-07-01T00:00:00Z",
+ "2026-07-01T01:00:00Z",
+ );
+ for (at, in_window) in [
+ ("2026-06-30T23:59:59Z", false),
+ ("2026-07-01T00:00:00Z", true),
+ ("2026-08-01T00:00:00Z", false),
+ ] {
+ let orphan = instance(&master, "2026-07-01T00:00:00Z", at, at);
+ assert_eq!(
+ map_snapshot(&target, vec![orphan], Vec::new()).is_err(),
+ in_window
+ );
+ }
+}
+
+#[cfg(feature = "inbound")]
+#[tokio::test]
+async fn list_queries_admit_left_edge_points_and_incremental_tokens_keep_their_query_contract() {
+ use axum::{
+ Json, Router,
+ extract::{Query, State},
+ routing::get,
+ };
+ use std::{
+ collections::HashMap,
+ sync::{Arc, Mutex},
+ };
+
+ #[derive(Clone, Default)]
+ struct Remote {
+ requests: Arc<Mutex<Vec<HashMap<String, String>>>>,
+ }
+ async fn list(
+ State(remote): State<Remote>,
+ Query(query): Query<HashMap<String, String>>,
+ ) -> Json<serde_json::Value> {
+ remote.requests.lock().unwrap().push(query.clone());
+ let lower = query.get("timeMin").map(|value| instant(value));
+ let upper = query.get("timeMax").map(|value| instant(value));
+ let events: Vec<_> = [
+ ("padding-only", "2026-06-30T23:59:59.500Z"),
+ ("left", "2026-07-01T00:00:00Z"),
+ ("inside", "2026-07-24T14:00:00Z"),
+ ("right", "2026-08-01T00:00:00Z"),
+ ]
+ .into_iter()
+ .filter(|(_, at)| {
+ let at = instant(at);
+ lower.is_none_or(|lower| at > lower) && upper.is_none_or(|upper| at < upper)
+ })
+ .map(|(id, at)| timed_event(id, at, at))
+ .collect();
+ Json(serde_json::json!({"items": events, "nextSyncToken": "next-token"}))
+ }
+ let remote = Remote::default();
+ let app = Router::new()
+ .route("/calendars/primary/events", get(list))
+ .with_state(remote.clone());
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let endpoint = format!("http://{}", listener.local_addr().unwrap());
+ let task = tokio::spawn(async move {
+ axum::serve(listener, app).await.unwrap();
+ });
+ let client = GoogleCalendarClient {
+ client: Client::new(),
+ gate: UnmeteredGate,
+ api_base: endpoint,
+ };
+ let target = target();
+ let batch = client
+ .sync_events(
+ "test-token",
+ GoogleEventSyncContext {
+ target: target.clone(),
+ sync_token: None,
+ plan: GoogleSyncPlan::FullSnapshot,
+ },
+ )
+ .await
+ .unwrap();
+ assert_eq!(batch.next_sync_token, "next-token");
+ assert_eq!(batch.materialized_range, Some(target.range.clone()));
+ assert_eq!(
+ batch
+ .upserts
+ .iter()
+ .map(|upsert| upsert.occurrences.len())
+ .sum::<usize>(),
+ 2
+ );
+ assert!(batch.upserts.iter().any(|upsert| {
+ upsert.occurrences.first().is_some_and(|occurrence| {
+ occurrence.time.occurrence_key() == "2026-07-01T00:00:00+00:00"
+ })
+ }));
+ client
+ .event_changes(
+ "test-token",
+ target.email_link_id,
+ "primary",
+ Some("next-token"),
+ &target.range,
+ )
+ .await
+ .unwrap();
+ let requests = remote.requests.lock().unwrap();
+ assert_eq!(requests.len(), 4);
+ for query in &requests[..3] {
+ assert_eq!(query["timeMin"], "2026-06-30T23:59:59+00:00");
+ assert!(!query.contains_key("syncToken"));
+ }
+ assert!(
+ !requests[0].contains_key("timeMax"),
+ "the initial token must cover future additions"
+ );
+ assert_eq!(requests[1]["timeMax"], "2026-08-01T00:00:00+00:00");
+ assert_eq!(requests[2]["timeMax"], requests[1]["timeMax"]);
+ assert_eq!(requests[3]["syncToken"], "next-token");
+ assert!(!requests[3].contains_key("timeMin"));
+ assert!(!requests[3].contains_key("timeMax"));
+ task.abort();
+}
diff --git a/crates/calendar_events/src/outbound/pg.rs b/crates/calendar_events/src/outbound/pg.rs
index 8bdf0451d9..392a33f676 100644
--- a/crates/calendar_events/src/outbound/pg.rs
+++ b/crates/calendar_events/src/outbound/pg.rs
@@ -1016,6 +1016,8 @@ impl CalendarRepository for PgCalendarRepository {
)
AND (
occurrence.timed_span && tstzrange($2, $3, '[)')
+ OR (occurrence.starts_at = occurrence.ends_at
+ AND occurrence.starts_at >= $2 AND occurrence.starts_at < $3)
OR occurrence.day_span && daterange($4, $5, '[)')
)
AND (
diff --git a/crates/calendar_events/src/outbound/pg/test.rs b/crates/calendar_events/src/outbound/pg/test.rs
index e200937b0c..7cf1002544 100644
--- a/crates/calendar_events/src/outbound/pg/test.rs
+++ b/crates/calendar_events/src/outbound/pg/test.rs
@@ -1,4 +1,5 @@
use super::*;
+mod point_events;
mod snapshot_coverage;
mod team_sharing;
mod team_sync_coverage;
diff --git a/crates/calendar_events/src/outbound/pg/test/point_events.rs b/crates/calendar_events/src/outbound/pg/test/point_events.rs
new file mode 100644
index 0000000000..8e5a25c305
--- /dev/null
+++ b/crates/calendar_events/src/outbound/pg/test/point_events.rs
@@ -0,0 +1,144 @@
+use super::*;
+use crate::domain::team::CalendarTeamRepository;
+use crate::outbound::pg_team::PgCalendarTeamRepository;
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn point_event_keeps_its_start_based_reminder_identity(pool: PgPool) {
+ let owner = "macro|[email protected]";
+ let link = insert_link(&pool, owner).await;
+ let repo = PgCalendarRepository::new(pool.clone());
+ let provider = provider_ids(&repo, link).await;
+ let starts_at = (Utc::now() + Duration::hours(2)).trunc_subsecs(0);
+ let mut event = reminder_upsert(
+ owner,
+ link,
+ provider,
+ "point-reminder",
+ starts_at,
+ popup_reminders(&[10]),
+ );
+ let point = EventTime::Timed {
+ starts_at,
+ ends_at: starts_at,
+ time_zone: Some("UTC".to_owned()),
+ };
+ event.event.time = point.clone();
+ event.occurrences[0].time = point;
+ let id = repo.upsert_event_fixture(event).await.unwrap();
+ assert_eq!(
+ scheduled_firings(&pool, id).await,
+ vec![(
+ starts_at.to_rfc3339(),
+ 10,
+ starts_at - Duration::minutes(10)
+ )]
+ );
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn point_storage_and_own_and_team_queries_preserve_half_open_membership(pool: PgPool) {
+ let owner = "macro|[email protected]";
+ let viewer = "macro|[email protected]";
+ insert_team(&pool, viewer, &[viewer, owner]).await;
+ let link = insert_link(&pool, owner).await;
+ let repo = PgCalendarRepository::new(pool.clone());
+ let provider = provider_ids(&repo, link).await;
+ let mut upsert = timed_upsert(owner, link, provider, "points", "Point series", 1);
+ let starts_at = Utc.with_ymd_and_hms(2026, 7, 24, 9, 0, 0).unwrap();
+ let ends_at = starts_at + Duration::hours(1);
+ let point = |instant| EventTime::Timed {
+ starts_at: instant,
+ ends_at: instant,
+ time_zone: None,
+ };
+ upsert.event.time = point(starts_at);
+ // Use OOO to prove the compatibility endpoint does not turn a point into
+ // an absence while ordinary browsing retains the real event identity.
+ upsert.event.event_type = EventType::OutOfOffice;
+ upsert.occurrences = [
+ starts_at - Duration::minutes(1),
+ starts_at,
+ starts_at + Duration::minutes(30),
+ ends_at,
+ ]
+ .into_iter()
+ .map(|instant| CalendarOccurrence {
+ event_id: upsert.event.id,
+ occurrence_key: instant.to_rfc3339(),
+ recurrence_id: Some(instant.to_rfc3339()),
+ time: point(instant),
+ is_cancelled: false,
+ })
+ .collect();
+ upsert.overrides = vec![CalendarEventOverride {
+ recurrence_id: starts_at.to_rfc3339(),
+ original_time: EventStart::Timed(starts_at),
+ time: point(starts_at),
+ title: Some("Point exception".to_owned()),
+ description: None,
+ location: None,
+ status: None,
+ attendees: None,
+ visibility: None,
+ transparency: None,
+ sequence: None,
+ source_updated_at: None,
+ }];
+ let event_id = upsert.event.id;
+ repo.upsert_event_fixture(upsert).await.unwrap();
+ enable_team_details(&repo, &[owner]).await;
+ let range = OccurrenceRange {
+ starts_at,
+ ends_at,
+ start_date: starts_at.date_naive(),
+ end_date: starts_at.date_naive().succ_opt().unwrap(),
+ };
+ let own = repo
+ .list_occurrences(owner, range.clone(), None, 100)
+ .await
+ .unwrap();
+ assert_eq!(own.len(), 2);
+ assert!(own.iter().all(|row| row.event.id == event_id));
+ assert_eq!(own[0].occurrence.time, point(starts_at));
+ assert_eq!(
+ own[1].occurrence.time,
+ point(starts_at + Duration::minutes(30))
+ );
+ let shared = PgCalendarTeamRepository::new(pool.clone())
+ .sources(viewer, range.clone(), &[owner.to_owned()], None, 100)
+ .await
+ .unwrap();
+ assert_eq!(shared.len(), 2);
+ assert_eq!(shared[0].time(), &point(starts_at));
+ assert_eq!(shared[1].time(), &point(starts_at + Duration::minutes(30)));
+ assert!(
+ repo.list_team_out_of_office(viewer, range, 100)
+ .await
+ .unwrap()
+ .is_empty()
+ );
+
+ // The migration relaxes equality only: all three physical time shapes
+ // still reject reversed timed intervals and nonpositive all-day spans.
+ for (start, end, date) in [
+ (
+ Some(starts_at),
+ Some(starts_at - Duration::seconds(1)),
+ None,
+ ),
+ (None, None, Some(starts_at.date_naive())),
+ ] {
+ assert!(sqlx::query!(
+ "UPDATE calendar_events SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE id=$1",
+ event_id, start, end, date
+ ).execute(&pool).await.is_err());
+ assert!(sqlx::query!(
+ "UPDATE calendar_event_overrides SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE event_id=$1",
+ event_id, start, end, date
+ ).execute(&pool).await.is_err());
+ assert!(sqlx::query!(
+ "UPDATE calendar_event_occurrences SET starts_at=$2,ends_at=$3,start_date=$4,end_date=$4 WHERE event_id=$1",
+ event_id, start, end, date
+ ).execute(&pool).await.is_err());
+ }
+}
diff --git a/crates/calendar_events/src/outbound/pg/test/team_sync_coverage.rs b/crates/calendar_events/src/outbound/pg/test/team_sync_coverage.rs
index b194305e60..a3cdf043f6 100644
--- a/crates/calendar_events/src/outbound/pg/test/team_sync_coverage.rs
+++ b/crates/calendar_events/src/outbound/pg/test/team_sync_coverage.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::domain::team::{CalendarTeamRepository, TeamCalendarCoverage};
+use crate::domain::{team::TeamAvailabilitySources, team_availability::calculate};
use crate::outbound::pg_team::PgCalendarTeamRepository;
struct SyncFixture {
@@ -205,6 +206,144 @@ impl SyncFixture {
}
}
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn positive_to_point_sync_replaces_busy_without_changing_identity_or_source_grant(
+ pool: PgPool,
+) {
+ let fixture = SyncFixture::new(pool.clone(), "point-update").await;
+ let original = fixture.events[0].clone();
+ let before = fixture
+ .team
+ .sources(
+ &fixture.viewer,
+ july_2026_range(),
+ std::slice::from_ref(&fixture.owner),
+ None,
+ 100,
+ )
+ .await
+ .unwrap();
+ let source_id = before
+ .iter()
+ .find(|row| row.event.ical_uid == "a")
+ .unwrap()
+ .source_id;
+ let event_id = before
+ .iter()
+ .find(|row| row.event.ical_uid == "a")
+ .unwrap()
+ .event
+ .id;
+
+ for (sequence, make_point) in [(2, true), (3, false)] {
+ let lease = fixture.begin_poll().await;
+ let mut changed = original.clone();
+ changed.event.sequence = sequence;
+ changed.event.updated_at += Duration::minutes(i64::from(sequence));
+ if make_point {
+ let EventTime::Timed {
+ starts_at, ends_at, ..
+ } = &mut changed.event.time
+ else {
+ panic!("timed fixture");
+ };
+ *ends_at = *starts_at;
+ for occurrence in &mut changed.occurrences {
+ let EventTime::Timed {
+ starts_at, ends_at, ..
+ } = &mut occurrence.time
+ else {
+ panic!("timed fixture");
+ };
+ *ends_at = *starts_at;
+ }
+ }
+ fixture
+ .repo
+ .upsert_event(CalendarEventWrite::GoogleBackfill {
+ key: fixture.key,
+ lease_token: lease,
+ upsert: changed,
+ })
+ .await
+ .unwrap();
+ fixture.assert_coverage(false, 0).await;
+ fixture
+ .repo
+ .commit_google_calendar_sync(
+ fixture.key,
+ lease,
+ fixture.account,
+ fixture.token_only(),
+ 1,
+ )
+ .await
+ .unwrap();
+ fixture
+ .repo
+ .complete_google_backfill(fixture.key, lease)
+ .await
+ .unwrap();
+ fixture.assert_coverage(true, 2).await;
+ let sources = fixture
+ .team
+ .sources(
+ &fixture.viewer,
+ july_2026_range(),
+ std::slice::from_ref(&fixture.owner),
+ None,
+ 100,
+ )
+ .await
+ .unwrap();
+ let replaced = sources
+ .iter()
+ .find(|row| row.event.ical_uid == "a")
+ .unwrap();
+ assert_eq!(replaced.source_id, source_id);
+ assert_eq!(replaced.event.id, event_id);
+ assert_eq!(
+ replaced.occurrence.occurrence_key,
+ original.occurrences[0].occurrence_key
+ );
+ assert_eq!(replaced.time().has_positive_duration(), !make_point);
+ let role = sqlx::query_scalar!(
+ "SELECT provider_access_role FROM calendar_event_sources WHERE id=$1",
+ source_id
+ )
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ assert_eq!(role.as_deref(), Some("owner"));
+ let members = fixture
+ .team
+ .members(&fixture.viewer, false, &july_2026_range())
+ .await
+ .unwrap();
+ let result = calculate(
+ july_2026_range(),
+ TeamAvailabilitySources {
+ members,
+ sources,
+ complete: true,
+ unknown_user_ids: vec![],
+ },
+ );
+ assert!(result.complete);
+ assert_eq!(result.members[0].busy.len(), 1);
+ let expected_hour = if make_point { 10 } else { 9 };
+ assert_eq!(
+ result.members[0].busy[0].start,
+ Utc.with_ymd_and_hms(2026, 7, 24, expected_hour, 0, 0)
+ .unwrap()
+ );
+ assert_eq!(
+ result.members[0].busy[0].end,
+ Utc.with_ymd_and_hms(2026, 7, 24, 11, 0, 0).unwrap()
+ );
+ }
+}
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn team_coverage_quiet_poll_stays_ready_but_partial_event_swap_withdraws_it(pool: PgPool) {
let fixture = SyncFixture::new(pool, "swap").await;
diff --git a/crates/calendar_events/src/outbound/pg_team.rs b/crates/calendar_events/src/outbound/pg_team.rs
index 7abf256155..363f2370f3 100644
--- a/crates/calendar_events/src/outbound/pg_team.rs
+++ b/crates/calendar_events/src/outbound/pg_team.rs
@@ -193,7 +193,9 @@ impl CalendarTeamRepository for PgCalendarTeamRepository {
AND (
((occurrence.value->'time'->>'kind') = 'timed'
AND (occurrence.value->'time'->>'startsAt')::timestamptz < $4
- AND (occurrence.value->'time'->>'endsAt')::timestamptz > $3)
+ AND ((occurrence.value->'time'->>'endsAt')::timestamptz > $3
+ OR ((occurrence.value->'time'->>'startsAt')::timestamptz = (occurrence.value->'time'->>'endsAt')::timestamptz
+ AND (occurrence.value->'time'->>'startsAt')::timestamptz >= $3)))
OR ((occurrence.value->'time'->>'kind') = 'allDay'
AND (occurrence.value->'time'->>'startDate')::date < $6
AND (occurrence.value->'time'->>'endDate')::date > $5)
diff --git a/crates/calendar_events/src/outbound/pg_team/ooo.rs b/crates/calendar_events/src/outbound/pg_team/ooo.rs
index fa74014b27..9a10f5b13f 100644
--- a/crates/calendar_events/src/outbound/pg_team/ooo.rs
+++ b/crates/calendar_events/src/outbound/pg_team/ooo.rs
@@ -48,6 +48,7 @@ pub(in crate::outbound) async fn list_team_out_of_office(
AND NOT COALESCE((occurrence.value->>'isCancelled')::boolean,false)
AND (
(occurrence.value->'time'->>'kind'='timed'
+ AND (occurrence.value->'time'->>'endsAt')::timestamptz>(occurrence.value->'time'->>'startsAt')::timestamptz
AND (occurrence.value->'time'->>'startsAt')::timestamptz<$3
AND (occurrence.value->'time'->>'endsAt')::timestamptz>$2)
OR (occurrence.value->'time'->>'kind'='allDay'
diff --git a/crates/calendar_scheduling/src/domain/availability.rs b/crates/calendar_scheduling/src/domain/availability.rs
index f6cf8a1260..9081d8271c 100644
--- a/crates/calendar_scheduling/src/domain/availability.rs
+++ b/crates/calendar_scheduling/src/domain/availability.rs
@@ -193,6 +193,9 @@ pub fn slots_for_date(
now: DateTime<Utc>,
busy: &[BusyRange],
) -> Result<Vec<Slot>, Error> {
+ if busy.iter().any(|interval| interval.end < interval.start) {
+ return Err(Error::CalendarUnavailable);
+ }
if !event.enabled {
return Ok(vec![]);
}
@@ -224,7 +227,10 @@ pub fn slots_for_date(
.iter()
.filter(|host| {
!busy.iter().any(|b| {
- &b.host == *host && b.start < occupied_end && b.end > occupied_start
+ &b.host == *host
+ && b.start < b.end
+ && b.start < occupied_end
+ && b.end > occupied_start
})
})
.cloned()
diff --git a/crates/calendar_scheduling/src/domain/availability/test.rs b/crates/calendar_scheduling/src/domain/availability/test.rs
index 734404822c..366412000d 100644
--- a/crates/calendar_scheduling/src/domain/availability/test.rs
+++ b/crates/calendar_scheduling/src/domain/availability/test.rs
@@ -42,6 +42,31 @@ fn event() -> EventType {
}
}
use uuid::Uuid;
+
+#[test]
+fn point_inside_a_slot_does_not_block_it_and_reversed_busy_is_unavailable() {
+ let day = NaiveDate::from_ymd_opt(2026, 9, 21).unwrap();
+ let now = Utc.with_ymd_and_hms(2026, 9, 20, 0, 0, 0).unwrap();
+ let point = Utc.with_ymd_and_hms(2026, 9, 21, 13, 15, 0).unwrap();
+ let mut busy = BusyRange {
+ host: "a".into(),
+ start: point,
+ end: point,
+ };
+ let slots = slots_for_date(&event(), &schedule(), day, now, &[busy.clone()]).unwrap();
+ assert_eq!(
+ slots.len(),
+ slots_for_date(&event(), &schedule(), day, now, &[])
+ .unwrap()
+ .len()
+ );
+ assert_eq!(slots[0].hosts, vec!["a", "b"]);
+ busy.end -= Duration::seconds(1);
+ assert!(matches!(
+ slots_for_date(&event(), &schedule(), day, now, &[busy]),
+ Err(Error::CalendarUnavailable)
+ ));
+}
#[test]
fn collective_intersects_and_round_robin_unions_host_availability() {
let day = NaiveDate::from_ymd_opt(2026, 9, 21).unwrap();
diff --git a/crates/calendar_scheduling/src/domain/service.rs b/crates/calendar_scheduling/src/domain/service.rs
index 5cb0cd6481..aff7be2603 100644
--- a/crates/calendar_scheduling/src/domain/service.rs
+++ b/crates/calendar_scheduling/src/domain/service.rs
@@ -642,7 +642,7 @@ impl<R: Repository, C: Calendars, D: Directory> Service<R, C, D> {
{
return Err(Error::Conflict);
}
- if self
+ let busy = self
.calendars
.busy(
&record.booking.hosts,
@@ -650,9 +650,13 @@ impl<R: Repository, C: Calendars, D: Directory> Service<R, C, D> {
record.busy_end,
None,
)
- .await?
+ .await?;
+ if busy.iter().any(|interval| interval.end < interval.start) {
+ return Err(Error::CalendarUnavailable);
+ }
+ if busy
.iter()
- .any(|b| b.start < record.busy_end && b.end > record.busy_start)
+ .any(|b| b.start < b.end && b.start < record.busy_end && b.end > record.busy_start)
{
return Err(Error::Conflict);
}
diff --git a/crates/calendar_scheduling/src/domain/service/test.rs b/crates/calendar_scheduling/src/domain/service/test.rs
index 1660512b32..7e3d441754 100644
--- a/crates/calendar_scheduling/src/domain/service/test.rs
+++ b/crates/calendar_scheduling/src/domain/service/test.rs
@@ -203,6 +203,7 @@ struct Calendar {
lose_move_response: AtomicBool,
lose_cancel_response: AtomicBool,
events: Mutex<HashMap<Uuid, Uuid>>,
+ busy: Mutex<Vec<BusyRange>>,
}
impl Calendars for Arc<Calendar> {
async fn creation_calendar(&self, host: &str) -> Result<Uuid, Error> {
@@ -215,7 +216,7 @@ impl Calendars for Arc<Calendar> {
_: DateTime<Utc>,
_: Option<Uuid>,
) -> Result<Vec<BusyRange>, Error> {
- Ok(vec![])
+ Ok(self.busy.lock().unwrap().clone())
}
async fn create(&self, record: &BookingRecord, _: &EventType) -> Result<(Uuid, String), Error> {
let id = *self
@@ -449,6 +450,42 @@ async fn concurrent_round_robin_bookings_use_distinct_hosts_and_calendars() {
));
assert_eq!(cal.creates.load(Ordering::SeqCst), 2);
}
+#[tokio::test]
+async fn pending_approval_ignores_points_but_rejects_reversed_calendar_facts() {
+ let calendars = Arc::new(Calendar::default());
+ let service = TestService::new(Arc::new(Memory::default()), calendars.clone(), Members);
+ let profile = service.save("admin", None, profile(None)).await.unwrap();
+ let mut record = service
+ .book(profile.id, profile.event_types[0].id, request())
+ .await
+ .unwrap();
+ record.booking.status = BookingStatus::Pending;
+ record.calendar_event_id = None;
+ let id = record.booking.id;
+ let point = record.booking.starts_at + Duration::minutes(5);
+ let host = record.booking.hosts[0].clone();
+ service
+ .repository
+ .bookings
+ .lock()
+ .unwrap()
+ .insert(id, record);
+ *calendars.busy.lock().unwrap() = vec![BusyRange {
+ host,
+ start: point,
+ end: point - Duration::seconds(1),
+ }];
+ assert!(matches!(
+ service.approve("admin", id).await,
+ Err(Error::CalendarUnavailable)
+ ));
+ calendars.busy.lock().unwrap()[0].end = point;
+ assert_eq!(
+ service.approve("admin", id).await.unwrap().status,
+ BookingStatus::Confirmed
+ );
+}
+
#[tokio::test]
async fn pending_booking_can_be_approved_after_link_is_removed() {
let service = TestService::new(
diff --git a/crates/calendar_scheduling/src/outbound/macro_services.rs b/crates/calendar_scheduling/src/outbound/macro_services.rs
index 4ebc8c6e30..29db8e2e37 100644
--- a/crates/calendar_scheduling/src/outbound/macro_services.rs
+++ b/crates/calendar_scheduling/src/outbound/macro_services.rs
@@ -113,6 +113,12 @@ impl<O: CalendarOccurrenceService, M: CalendarCreationRecoveryService> Calendars
{
continue;
}
+ if !occurrence.time.is_valid() {
+ return Err(Error::CalendarUnavailable);
+ }
+ if !occurrence.time.has_positive_duration() {
+ continue;
+ }
let (start, end) = match occurrence.time {
EventTime::Timed {
starts_at, ends_at, ..
diff --git a/crates/client/README.md b/crates/client/README.md
index 78b3ab479b..b4a59bdf3c 100644
--- a/crates/client/README.md
+++ b/crates/client/README.md
@@ -122,6 +122,12 @@ first-error propagation retain their existing semantics.
## Projection refreshes
+Calendar range projections retain imported timed points with equal start and end.
+Points belong to a viewport when its start is at or before the point and its end
+is after it; empty viewports still return no occurrences. Projection version 2
+rebuilds derived calendar rows once on open, preserving normalized records,
+coverage, watermarks, and queued mutations. All-day spans remain positive.
+
Hydration folds authoritative index mutations in order and writes only final
states that differ from stored state. An updated normalized record does not force
unchanged index facts to be deleted and reinserted. Pending optimistic projections
diff --git a/crates/client/cache-core/src/calendar.rs b/crates/client/cache-core/src/calendar.rs
index 74a8bb457c..7ef3930a66 100644
--- a/crates/client/cache-core/src/calendar.rs
+++ b/crates/client/cache-core/src/calendar.rs
@@ -35,7 +35,7 @@ const ALL_DAY_TYPENAME: &str = "GraphqlAllDayEventTime";
/// Revision of the derived range rows. Storage adapters rebuild existing rows
/// from normalized records when this changes; records and coverage stay valid.
-pub const CALENDAR_PROJECTION_VERSION: u32 = 1;
+pub const CALENDAR_PROJECTION_VERSION: u32 = 2;
/// Maximum number of keys, spans, and links accepted by one commit.
pub const MAX_CALENDAR_COMMIT_ITEMS: usize = 20_000;
@@ -81,7 +81,7 @@ impl CalendarSpanKind {
}
}
-/// Half-open `[start, end)` span of one kind.
+/// Half-open `[start, end)` span, or a timed point when both bounds are equal.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CalendarSpan {
@@ -94,9 +94,23 @@ pub struct CalendarSpan {
}
impl CalendarSpan {
- /// Whether two spans of the same kind share any point.
+ /// Whether spans intersect, including a timed point within a positive span.
pub fn overlaps(&self, other: &CalendarSpan) -> bool {
- self.kind == other.kind && self.start < other.end && self.end > other.start
+ if self.kind != other.kind || self.end < self.start || other.end < other.start {
+ return false;
+ }
+ if self.kind == CalendarSpanKind::Timed {
+ if self.start == self.end {
+ return other.start <= self.start && self.start < other.end;
+ }
+ if other.start == other.end {
+ return self.start <= other.start && other.start < self.end;
+ }
+ }
+ self.start < self.end
+ && other.start < other.end
+ && self.start < other.end
+ && self.end > other.start
}
}
@@ -163,10 +177,14 @@ fn project_time(time: &BTreeMap<String, CacheValue>) -> Option<CalendarSpan> {
_ => None,
};
let timed = || {
- Some(CalendarSpan {
+ let start = chrono::DateTime::parse_from_rfc3339(text("startsAt")?).ok()?;
+ let end = chrono::DateTime::parse_from_rfc3339(text("endsAt")?).ok()?;
+ // Validate before millisecond projection so a reversed sub-millisecond
+ // interval cannot round into an apparently valid point.
+ (end >= start).then_some(CalendarSpan {
kind: CalendarSpanKind::Timed,
- start: parse_instant_ms(text("startsAt")?)?,
- end: parse_instant_ms(text("endsAt")?)?,
+ start: start.timestamp_millis(),
+ end: end.timestamp_millis(),
})
};
let all_day = || {
@@ -182,7 +200,8 @@ fn project_time(time: &BTreeMap<String, CacheValue>) -> Option<CalendarSpan> {
Some(_) => return None,
None => timed().or_else(all_day)?,
};
- (span.end > span.start).then_some(span)
+ (span.end > span.start || (span.kind == CalendarSpanKind::Timed && span.end == span.start))
+ .then_some(span)
}
fn string_field<'a>(record: &'a Record, field: &str) -> Option<&'a str> {
@@ -192,12 +211,6 @@ fn string_field<'a>(record: &'a Record, field: &str) -> Option<&'a str> {
}
}
-fn parse_instant_ms(value: &str) -> Option<i64> {
- chrono::DateTime::parse_from_rfc3339(value)
- .ok()
- .map(|instant| instant.timestamp_millis())
-}
-
fn parse_epoch_day(value: &str) -> Option<i64> {
let epoch = NaiveDate::from_ymd_opt(1970, 1, 1)?;
NaiveDate::parse_from_str(value, "%Y-%m-%d")
@@ -278,7 +291,10 @@ impl CalendarRangeRequest {
self.event_key
.as_ref()
.is_none_or(|event_key| *event_key == row.event_key)
- && self.spans().iter().any(|span| span.overlaps(&row.span))
+ && self
+ .spans()
+ .iter()
+ .any(|span| span.start < span.end && span.overlaps(&row.span))
}
/// Rejects inverted spans and foreign event keys. An empty span is valid
diff --git a/crates/client/cache-core/src/calendar/test.rs b/crates/client/cache-core/src/calendar/test.rs
index 4c49e564b8..0cf0ff7741 100644
--- a/crates/client/cache-core/src/calendar/test.rs
+++ b/crates/client/cache-core/src/calendar/test.rs
@@ -161,7 +161,13 @@ fn hidden_or_incomplete_occurrences_do_not_project() {
("time", CacheValue::Null),
(
"time",
- timed("2026-10-06T13:00:00Z", "2026-10-06T13:00:00Z"),
+ timed("2026-10-06T13:00:00Z", "2026-10-06T12:00:00Z"),
+ ),
+ ("time", all_day("2026-10-06", "2026-10-06")),
+ ("time", all_day("2026-10-07", "2026-10-06")),
+ (
+ "time",
+ timed("2026-10-06T13:00:00.0009Z", "2026-10-06T13:00:00.0001Z"),
),
("time", timed("not a date", "2026-10-06T13:00:00Z")),
(
@@ -179,6 +185,39 @@ fn hidden_or_incomplete_occurrences_do_not_project() {
}
}
+#[test]
+fn timed_points_project_and_use_left_inclusive_right_exclusive_membership() {
+ let occurrence_key = key("GraphqlCalendarOccurrence:e1:point");
+ let projected = project_calendar_range(
+ &occurrence_key,
+ &occurrence(timed("2026-10-06T08:00:00-04:00", "2026-10-06T12:00:00Z")),
+ )
+ .unwrap();
+ assert_eq!(
+ projected.span,
+ timed_span(1_791_288_000_000, 1_791_288_000_000)
+ );
+ assert!(!projected.is_long());
+
+ let viewport = timed_span(10, 20);
+ for (at, expected) in [(9, false), (10, true), (15, true), (20, false)] {
+ let point = timed_span(at, at);
+ assert_eq!(point.overlaps(&viewport), expected);
+ assert_eq!(viewport.overlaps(&point), expected);
+ assert_eq!(
+ request(10, 20).includes(&row("point", "e1", point)),
+ expected
+ );
+ }
+ assert!(!request(15, 15).includes(&row("point", "e1", timed_span(15, 15))));
+ assert!(!request(15, 15).includes(&row("duration", "e1", timed_span(10, 20))));
+ assert!(!span(CalendarSpanKind::AllDay, 15, 15).overlaps(&span(
+ CalendarSpanKind::AllDay,
+ 10,
+ 20
+ )));
+}
+
#[test]
fn merges_spans_per_kind_including_adjacent_spans() {
let merged = merge_spans([
diff --git a/crates/client/cache-turso/src/storage/calendar.rs b/crates/client/cache-turso/src/storage/calendar.rs
index ef024a0b98..c2a565d4fc 100644
--- a/crates/client/cache-turso/src/storage/calendar.rs
+++ b/crates/client/cache-turso/src/storage/calendar.rs
@@ -29,7 +29,7 @@ const RANGE_UPSERT: &str = "INSERT INTO calendar_ranges (record_key, event_key,
const RANGE_DELETE: &str = "DELETE FROM calendar_ranges WHERE record_key = ?1";
// A short row ends at most one short span after it starts, so its start is
// bounded on both sides and the scan stays on the (kind, long, start) prefix.
-const RANGE_SHORT: &str = "SELECT record_key, event_key, link_id, kind, start, end FROM calendar_ranges INDEXED BY calendar_ranges_scan_idx WHERE kind = ?1 AND long = 0 AND start >= ?2 AND start < ?3 AND end > ?4";
+const RANGE_SHORT: &str = "SELECT record_key, event_key, link_id, kind, start, end FROM calendar_ranges INDEXED BY calendar_ranges_scan_idx WHERE kind = ?1 AND long = 0 AND start >= ?2 AND start < ?3 AND (end > ?4 OR (kind = 0 AND start = end AND start >= ?4))";
const RANGE_LONG: &str = "SELECT record_key, event_key, link_id, kind, start, end FROM calendar_ranges INDEXED BY calendar_ranges_scan_idx WHERE kind = ?1 AND long = 1 AND start < ?2 AND end > ?3";
const RANGE_BY_EVENT: &str = "SELECT record_key, event_key, link_id, kind, start, end FROM calendar_ranges INDEXED BY calendar_ranges_event_idx WHERE event_key = ?1";
const RANGE_KEYS_BY_EVENT: &str = "SELECT record_key FROM calendar_ranges INDEXED BY calendar_ranges_event_idx WHERE event_key = ?1";
diff --git a/crates/client/cache-turso/src/storage/calendar/test.rs b/crates/client/cache-turso/src/storage/calendar/test.rs
index b5bc20af91..81677651a7 100644
--- a/crates/client/cache-turso/src/storage/calendar/test.rs
+++ b/crates/client/cache-turso/src/storage/calendar/test.rs
@@ -434,28 +434,52 @@ fn reopen_rebuilds_range_rows_after_a_projection_change() {
block_on(async {
let database = TursoMemoryDatabase::new("calendar-projection.db");
let mut storage = database.open("scope").unwrap();
- let entries = (0..300)
+ let mut entries = (0..300)
.map(|index| {
let start = MONDAY_MS + index * HOUR_MS;
timed(&format!("e{index:03}"), "l1", start, start + HOUR_MS)
})
.collect::<Vec<_>>();
+ let point = timed("legacy-point", "l1", MONDAY_MS, MONDAY_MS);
+ entries.push(point.clone());
storage.put_batch(entries).await.unwrap();
+ storage
+ .calendar_commit(&CalendarCommit {
+ coverage: week_coverage(),
+ watermark: Some(CalendarWatermarkUpdate::Merge {
+ links: vec![link("l1", 4)],
+ }),
+ freshness: Some(CalendarFreshness::Fresh),
+ ..CalendarCommit::default()
+ })
+ .await
+ .unwrap();
raw_execute(&storage, "DELETE FROM calendar_ranges");
raw_execute(
&storage,
- "UPDATE meta SET value = '0' WHERE key = 'calendar_projection_version'",
+ "UPDATE meta SET value = '1' WHERE key = 'calendar_projection_version'",
);
storage.try_close().unwrap();
let storage = database.open("scope").unwrap();
- assert_eq!(row_count(&storage), 300);
+ assert_eq!(row_count(&storage), 301);
+ let snapshot = storage.query_calendar_ranges(&week()).await.unwrap();
+ assert!(
+ snapshot
+ .rows
+ .iter()
+ .any(|row| row.record_key == point.0 && row.span.start == row.span.end)
+ );
+ assert_eq!(snapshot.coverage, week_coverage());
+ assert_eq!(snapshot.sync.watermark, Some(vec![link("l1", 4)]));
+ assert_eq!(snapshot.sync.freshness, CalendarFreshness::Fresh);
+ assert!(storage.get_batch(&[point.0]).await.unwrap()[0].is_some());
storage.try_close().unwrap();
// A normal reopen neither scans nor decodes occurrence records.
driver::arm_reset_failure(SEARCH_REBUILD_RECORDS);
let storage = database.open("scope").unwrap();
- assert_eq!(row_count(&storage), 300);
+ assert_eq!(row_count(&storage), 301);
storage.try_close().unwrap();
});
}
diff --git a/crates/client/cache-turso/tests/shared_conformance.rs b/crates/client/cache-turso/tests/shared_conformance.rs
index 008ff794e4..02b6e4d669 100644
--- a/crates/client/cache-turso/tests/shared_conformance.rs
+++ b/crates/client/cache-turso/tests/shared_conformance.rs
@@ -1,5 +1,8 @@
#![cfg(not(target_arch = "wasm32"))]
+#[path = "shared_conformance/calendar_points.rs"]
+mod calendar_points;
+
use cache_core::calendar::{
CalendarCommit, CalendarFreshness, CalendarLinkWatermark, CalendarRangeRequest,
CalendarRangeStorage, CalendarReplacedEvent, CalendarSpan, CalendarSpanKind, CalendarSyncState,
@@ -48,7 +51,10 @@ impl BackendFactory for TursoFactory {
type Backend = TursoStorage;
fn create() -> (Self, Self::Backend) {
- let database = TursoMemoryDatabase::new("shared-conformance.db");
+ // Turso tracks open databases by path, even with separate MemoryIO
+ // instances. Concurrent contracts must own distinct physical names.
+ let database =
+ TursoMemoryDatabase::new(format!("shared-conformance-{}.db", uuid::Uuid::now_v7()));
let storage = database.open("shared-conformance").unwrap();
(Self { database }, storage)
}
diff --git a/crates/client/cache-turso/tests/shared_conformance/calendar_points.rs b/crates/client/cache-turso/tests/shared_conformance/calendar_points.rs
new file mode 100644
index 0000000000..23fda10dfe
--- /dev/null
+++ b/crates/client/cache-turso/tests/shared_conformance/calendar_points.rs
@@ -0,0 +1,184 @@
+use super::*;
+
+const START_MS: i64 = 1_791_158_400_000;
+
+fn timed_record(start: i64, end: i64) -> Record {
+ let instant = |millis| {
+ chrono::DateTime::from_timestamp_millis(millis)
+ .unwrap()
+ .to_rfc3339()
+ };
+ occurrence(
+ "points",
+ "point-link",
+ &[
+ ("__typename", "GraphqlTimedEventTime"),
+ ("startsAt", &instant(start)),
+ ("endsAt", &instant(end)),
+ ],
+ )
+}
+
+fn point_range() -> CalendarRangeRequest {
+ CalendarRangeRequest {
+ start_ms: START_MS,
+ end_ms: START_MS + 1_000,
+ start_day: 20_731,
+ end_day: 20_732,
+ event_key: None,
+ }
+}
+
+async fn point_contract<F: BackendFactory>() {
+ let (mut factory, mut storage) = F::create();
+ let point_key = |name: &str| key(&format!("GraphqlCalendarOccurrence:points:{name}"));
+ let entries = [
+ ("before", START_MS - 1, START_MS - 1),
+ ("left", START_MS, START_MS),
+ ("inside", START_MS + 500, START_MS + 500),
+ ("right", START_MS + 1_000, START_MS + 1_000),
+ ("duration", START_MS + 100, START_MS + 200),
+ ("reversed", START_MS + 200, START_MS + 100),
+ ]
+ .into_iter()
+ .map(|(name, start, end)| (point_key(name), timed_record(start, end)))
+ .chain([
+ (
+ point_key("all-day-zero"),
+ occurrence(
+ "points",
+ "point-link",
+ &[
+ ("__typename", "GraphqlAllDayEventTime"),
+ ("startDate", "2026-10-05"),
+ ("endDate", "2026-10-05"),
+ ],
+ ),
+ ),
+ (
+ point_key("all-day-reversed"),
+ occurrence(
+ "points",
+ "point-link",
+ &[
+ ("__typename", "GraphqlAllDayEventTime"),
+ ("startDate", "2026-10-06"),
+ ("endDate", "2026-10-05"),
+ ],
+ ),
+ ),
+ ])
+ .collect();
+ storage.put_batch(entries).await.unwrap();
+ storage
+ .calendar_commit(&CalendarCommit {
+ coverage: point_range().spans().to_vec(),
+ freshness: Some(CalendarFreshness::Fresh),
+ ..CalendarCommit::default()
+ })
+ .await
+ .unwrap();
+ let mut storage = factory.reopen(storage);
+ for event_key in [None, Some(key("GraphqlCalendarEvent:points"))] {
+ let mut request = point_range();
+ request.event_key = event_key;
+ let snapshot = storage.query_calendar_ranges(&request).await.unwrap();
+ let mut keys = snapshot
+ .rows
+ .iter()
+ .map(|row| row.record_key.clone())
+ .collect::<Vec<_>>();
+ keys.sort();
+ assert_eq!(
+ keys,
+ [
+ point_key("duration"),
+ point_key("inside"),
+ point_key("left")
+ ]
+ );
+ assert_eq!(snapshot.coverage, point_range().spans());
+ assert_eq!(snapshot.sync.freshness, CalendarFreshness::Fresh);
+ for row in snapshot
+ .rows
+ .iter()
+ .filter(|row| row.record_key != point_key("duration"))
+ {
+ assert_eq!(row.span.start, row.span.end);
+ }
+ request.start_ms += 100;
+ request.end_ms = request.start_ms;
+ request.end_day = request.start_day;
+ assert!(
+ storage
+ .query_calendar_ranges(&request)
+ .await
+ .unwrap()
+ .rows
+ .is_empty(),
+ "empty viewports read sync state only"
+ );
+ }
+
+ let mut middle = point_range();
+ middle.start_ms += 150;
+ middle.end_ms = START_MS + 190;
+ middle.end_day = middle.start_day;
+ assert_eq!(
+ storage
+ .query_calendar_ranges(&middle)
+ .await
+ .unwrap()
+ .rows
+ .len(),
+ 1
+ );
+ storage
+ .put_batch(vec![(
+ point_key("duration"),
+ timed_record(START_MS + 100, START_MS + 100),
+ )])
+ .await
+ .unwrap();
+ assert!(
+ storage
+ .query_calendar_ranges(&middle)
+ .await
+ .unwrap()
+ .rows
+ .is_empty(),
+ "a positive-to-point replacement removes the old occupied duration"
+ );
+ let at_point = CalendarRangeRequest {
+ start_ms: START_MS + 100,
+ end_ms: START_MS + 101,
+ ..middle.clone()
+ };
+ let snapshot = storage.query_calendar_ranges(&at_point).await.unwrap();
+ assert_eq!(snapshot.rows.len(), 1);
+ assert_eq!(snapshot.rows[0].record_key, point_key("duration"));
+ assert_eq!(snapshot.rows[0].span.start, snapshot.rows[0].span.end);
+ storage
+ .put_batch(vec![(
+ point_key("duration"),
+ timed_record(START_MS + 100, START_MS + 300),
+ )])
+ .await
+ .unwrap();
+ let storage = factory.reopen(storage);
+ let snapshot = storage.query_calendar_ranges(&middle).await.unwrap();
+ assert_eq!(snapshot.rows.len(), 1);
+ assert_eq!(snapshot.rows[0].record_key, point_key("duration"));
+ assert_eq!(snapshot.rows[0].span.end, START_MS + 300);
+ factory.finish(storage);
+}
+
+#[test]
+fn in_memory_points_follow_the_calendar_storage_contract() {
+ block_on(point_contract::<InMemoryFactory>());
+}
+
+#[test]
+fn turso_points_follow_the_calendar_storage_contract() {
+ block_on(point_contract::<TursoFactory>());
+}
diff --git a/crates/macro_db_client/migrations/20261008012008_calendar_allow_google_point_events.sql b/crates/macro_db_client/migrations/20261008012008_calendar_allow_google_point_events.sql
new file mode 100644
index 0000000000..6d36b4a0a5
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261008012008_calendar_allow_google_point_events.sql
@@ -0,0 +1,63 @@
+-- Google can return timed point events with equal start/end instants.
+-- Relax only timed event shapes; all-day spans and booking durations stay positive.
+-- Defer scans to a later migration so these write locks cover only replacement.
+
+ALTER TABLE calendar_events
+ DROP CONSTRAINT calendar_events_time_shape,
+ ADD CONSTRAINT calendar_events_time_shape CHECK (
+ (
+ starts_at IS NOT NULL
+ AND ends_at IS NOT NULL
+ AND start_date IS NULL
+ AND end_date IS NULL
+ AND ends_at >= starts_at
+ )
+ OR
+ (
+ starts_at IS NULL
+ AND ends_at IS NULL
+ AND start_date IS NOT NULL
+ AND end_date IS NOT NULL
+ AND end_date > start_date
+ )
+ ) NOT VALID;
+
+ALTER TABLE calendar_event_overrides
+ DROP CONSTRAINT calendar_event_overrides_time_shape,
+ ADD CONSTRAINT calendar_event_overrides_time_shape CHECK (
+ (
+ starts_at IS NOT NULL
+ AND ends_at IS NOT NULL
+ AND start_date IS NULL
+ AND end_date IS NULL
+ AND ends_at >= starts_at
+ )
+ OR
+ (
+ starts_at IS NULL
+ AND ends_at IS NULL
+ AND start_date IS NOT NULL
+ AND end_date IS NOT NULL
+ AND end_date > start_date
+ )
+ ) NOT VALID;
+
+ALTER TABLE calendar_event_occurrences
+ DROP CONSTRAINT calendar_event_occurrences_time_shape,
+ ADD CONSTRAINT calendar_event_occurrences_time_shape CHECK (
+ (
+ starts_at IS NOT NULL
+ AND ends_at IS NOT NULL
+ AND start_date IS NULL
+ AND end_date IS NULL
+ AND ends_at >= starts_at
+ )
+ OR
+ (
+ starts_at IS NULL
+ AND ends_at IS NULL
+ AND start_date IS NOT NULL
+ AND end_date IS NOT NULL
+ AND end_date > start_date
+ )
+ ) NOT VALID;
diff --git a/crates/macro_db_client/migrations/20261008021238_validate_calendar_point_event_constraints.sql b/crates/macro_db_client/migrations/20261008021238_validate_calendar_point_event_constraints.sql
new file mode 100644
index 0000000000..7978d1e7c5
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261008021238_validate_calendar_point_event_constraints.sql
@@ -0,0 +1,4 @@
+-- Scan only after the replacement migration commits and releases its write locks.
+ALTER TABLE calendar_events VALIDATE CONSTRAINT calendar_events_time_shape;
+ALTER TABLE calendar_event_overrides VALIDATE CONSTRAINT calendar_event_overrides_time_shape;
+ALTER TABLE calendar_event_occurrences VALIDATE CONSTRAINT calendar_event_occurrences_time_shape;
diff --git a/crates/macro_db_client/migrations/20261008021304_index_calendar_point_occurrences.sql b/crates/macro_db_client/migrations/20261008021304_index_calendar_point_occurrences.sql
new file mode 100644
index 0000000000..f5f296ec32
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261008021304_index_calendar_point_occurrences.sql
@@ -0,0 +1,5 @@
+-- no-transaction
+-- Point spans stay empty for busy-time queries; this index supports browsing them.
+CREATE INDEX CONCURRENTLY IF NOT EXISTS calendar_event_occurrences_points_idx
+ ON calendar_event_occurrences (owner_id, starts_at, event_id, occurrence_key)
+ WHERE NOT is_cancelled AND starts_at = ends_at;
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index f1faa87d6a..dc9ae596ad 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1223,6 +1223,16 @@ Confirm mixed event shapes, stable positions, clean handoff, and an uncovered Re
Reduced-motion mode disables pulses and transitions. The page stays busy until the
handoff starts. Hidden pages do not animate. Resize to confirm skeleton alignment.
+Imported timed events with identical start and end are points: they show a compact
+chip with one time and `No duration` in details, and do not block availability.
+Future points also appear in Upcoming events, without becoming ongoing meetings.
+Grid dragging and resizing are disabled for points. An owned point's metadata,
+RSVP, and deletion still work; metadata saves preserve its exact provider time.
+Creating an event or changing its time requires positive duration. Shared points
+remain read-only and appear only when their details are shared.
+An existing Macro call can keep its schedule during point metadata edits; adding
+a new Macro call requires giving the event a duration first.
+
Calendar reads come from the local GraphQL cache when both `enable-graphql-soup`
and `enable-graphql-calendar` are on (PostHog in production, on by default in dev
for the calendar flag; set `VITE_ENABLE_GRAPHQL_CALENDAR=false` to test the REST
diff --git a/docs/calendar-team-sharing.md b/docs/calendar-team-sharing.md
index 0ae3f302dc..ca8aa667fe 100644
--- a/docs/calendar-team-sharing.md
+++ b/docs/calendar-team-sharing.md
@@ -119,10 +119,20 @@ block time. All-day intervals use each source calendar's IANA timezone, includin
23/25-hour days and transitions that skip midnight; there is no UTC or requester
timezone fallback for a missing source timezone.
+Google timed events whose start equals their end are preserved as point events.
+They appear in direct calendar reads and permitted detail-sharing views when
+their instant is at or after the query start and before its end. They occupy no
+busy time and produce no busy-only or private masked block. The grid displays a
+point marker without inventing a duration; creating or changing an event's time
+still requires a positive duration.
+
Copies are correlated by the sharing person, event UID, and original recurrence
identity. Equal intervals collapse. Disagreeing copies contribute their known
busy intervals conservatively and make free time unknown. Moving one occurrence
does not make it a different original recurrence instance.
+A point copy disagreeing with a positive-duration copy remains a conflict. A
+point recurring master does not erase its positive-duration exceptions, and a
+provider update from a duration to a point removes the previous busy interval.
`GetTeamAvailability` always includes the requester. With `userIds` omitted it
includes the current team; a supplied list narrows to those teammates plus the
@@ -277,10 +287,11 @@ Release checks:
cached details; a remaining independent entitlement is preserved.
- [ ] Real Google fixtures confirm role-downgrade/redaction and recurrence payload
behavior. Synthetic normalization tests alone do not establish provider behavior.
-- [ ] Real Google fixtures establish point-event and `endTimeUnspecified` payload
- behavior. Existing storage rejects equal start/end times; unsupported payloads
- must leave coverage unknown, never imply free time. Supporting point events
- requires coordinated storage, query, and normalization changes.
+- [ ] Timed point events reconcile successfully, appear at query boundaries, and
+ never create busy duration. Read-only DEV provider checks confirmed three
+ equal-endpoint timed events with `endTimeUnspecified` absent. Fixtures for
+ explicit `endTimeUnspecified` payloads remain required; unsupported payloads
+ must leave coverage unknown, never imply free time.
- [ ] Relevant Rust tests, SQLx preparation, generated API/tool/SDK artifacts,
TypeScript checking, `just check`, and browser verification pass.
diff --git a/packages/sdk/generated/calendar/types.gen.ts b/packages/sdk/generated/calendar/types.gen.ts
index 388c08b221..7a46cb419d 100644
--- a/packages/sdk/generated/calendar/types.gen.ts
+++ b/packages/sdk/generated/calendar/types.gen.ts
@@ -437,7 +437,7 @@ export type EventStatus = 'confirmed' | 'tentative' | 'cancelled';
*/
export type EventTime = {
/**
- * Exclusive end instant.
+ * Exclusive end instant; equal to the start for an imported point event.
*/
endsAt: string;
kind: 'timed';
diff --git a/packages/sdk/generated/email/types.gen.ts b/packages/sdk/generated/email/types.gen.ts
index 4ea40975fd..bba12ebc4b 100644
--- a/packages/sdk/generated/email/types.gen.ts
+++ b/packages/sdk/generated/email/types.gen.ts
@@ -986,7 +986,7 @@ export type EventStatus = 'confirmed' | 'tentative' | 'cancelled';
*/
export type EventTime = {
/**
- * Exclusive end instant.
+ * Exclusive end instant; equal to the start for an imported point event.
*/
endsAt: string;
kind: 'timed';
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index 7aef8a5dbb..3837e93f55 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -5992,7 +5992,7 @@ export type EventStatus = 'confirmed' | 'tentative' | 'cancelled';
*/
export type EventTime = {
/**
- * Exclusive end instant.
+ * Exclusive end instant; equal to the start for an imported point event.
*/
endsAt: string;
kind: 'timed';
diff --git a/packages/sdk/specs/calendar.json b/packages/sdk/specs/calendar.json
index 6acb6ba900..7337bf77ce 100644
--- a/packages/sdk/specs/calendar.json
+++ b/packages/sdk/specs/calendar.json
@@ -1040,7 +1040,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",
diff --git a/packages/sdk/specs/email.json b/packages/sdk/specs/email.json
index e36b5e2de5..cab48eb8bc 100644
--- a/packages/sdk/specs/email.json
+++ b/packages/sdk/specs/email.json
@@ -4747,7 +4747,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index a3a16aa98c..adfa74dc69 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -26212,7 +26212,7 @@
"endsAt": {
"type": "string",
"format": "date-time",
- "description": "Exclusive end instant."
+ "description": "Exclusive end instant; equal to the start for an imported point event."
},
"kind": {
"type": "string",