Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(alerts): let a shared configuration recur on a calendar unit (#109533)

Jimmy Zhua96ef22ee9d6
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 9d9d61b84d0d..c85590e313ba 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -606,6 +606,9 @@ SPECTACULAR_SETTINGS = {
"TicketPriorityEnum": "products.conversations.backend.models.constants.Priority",
# ExperimentMetricsRecalculation and ExperimentTimeseriesRecalculation both define this Status.
"MetricsRecalculationStatusEnum": "products.experiments.backend.models.experiment.ExperimentMetricsRecalculation.Status",
+ # tasks' SpaceGoalPeriod measures a goal over day/week/month and alerts_platform's
+ # recurrence unit repeats on one, so the pairs match and neither name fits both.
+ "CalendarUnitEnum": "products.alerts_platform.backend.facade.enums.PlatformAlertConfigurationRecurrenceUnit.choices",
# Matches tasks' LoopVisibility (personal/team).
"MCPAgentGrantScopeEnum": "products.mcp_store.backend.models.AGENT_GRANT_SCOPE_CHOICES",
# Matches Subscription frequency (daily/weekly/monthly).
diff --git a/products/alerts_platform/backend/facade/contracts.py b/products/alerts_platform/backend/facade/contracts.py
index f08ca840318f..e296160842bb 100644
--- a/products/alerts_platform/backend/facade/contracts.py
+++ b/products/alerts_platform/backend/facade/contracts.py
@@ -139,6 +139,8 @@ class PlatformAlertUpsert:
schedule_restriction: dict[str, Any] | None
next_check_at: datetime | None
snooze_until: datetime | None
+ recurrence_unit: str | None = None
+ anchor_time: str | None = None
class SkipReason(StrEnum):
@@ -362,6 +364,8 @@ class PlatformAlertConfigurationView:
threshold_operator: str
window_minutes: int
check_interval_minutes: int
+ recurrence_unit: str | None
+ anchor_time: str | None
evaluation_periods: int
datapoints_to_alarm: int
cooldown_minutes: int
diff --git a/products/alerts_platform/backend/facade/enums.py b/products/alerts_platform/backend/facade/enums.py
index c3a604d0947f..238871970cf5 100644
--- a/products/alerts_platform/backend/facade/enums.py
+++ b/products/alerts_platform/backend/facade/enums.py
@@ -22,3 +22,11 @@ class PlatformAlertState(LabeledStrEnum):
ERRORED = "errored", "Errored"
SNOOZED = "snoozed", "Snoozed"
BROKEN = "broken", "Broken"
+
+
+class PlatformAlertConfigurationRecurrenceUnit(LabeledStrEnum):
+ """The calendar unit a configuration recurs on, when it does not recur on a minute interval."""
+
+ DAY = "day", "Day"
+ WEEK = "week", "Week"
+ MONTH = "month", "Month"
diff --git a/products/alerts_platform/backend/facade/scheduling.py b/products/alerts_platform/backend/facade/scheduling.py
index 6666f30710a5..fae8709dbdfa 100644
--- a/products/alerts_platform/backend/facade/scheduling.py
+++ b/products/alerts_platform/backend/facade/scheduling.py
@@ -16,7 +16,7 @@ from collections.abc import Callable
from datetime import UTC, date, datetime, time, timedelta
from enum import StrEnum
from math import ceil
-from typing import Any, cast
+from typing import Any, Final, cast
from uuid import UUID
import pytz
@@ -369,6 +369,64 @@ def next_calendar_check_time(
raise ValueError(f"Unhandled alert calculation interval: {unreachable!r}")
+# A configuration stores the unit the recurrence repeats on. `CalendarInterval` names six
+# cadences, three of which this column must never hold, because minutes already express them.
+# The two vocabularies stay separate so a row cannot say "hourly" and carry a minute interval
+# that disagrees with it.
+_CALENDAR_UNITS: Final[dict[str, CalendarInterval]] = {
+ "day": CalendarInterval.DAILY,
+ "week": CalendarInterval.WEEKLY,
+ "month": CalendarInterval.MONTHLY,
+}
+
+
+def to_recurrence_interval(recurrence_unit: str) -> CalendarInterval:
+ """The calendar interval a stored recurrence unit means."""
+ try:
+ return _CALENDAR_UNITS[recurrence_unit]
+ except KeyError:
+ raise ValueError(f"Unhandled recurrence unit: {recurrence_unit!r}") from None
+
+
+def advance_schedule(
+ *,
+ current_next_check_at: datetime | None,
+ check_interval_minutes: int,
+ recurrence_unit: str | None,
+ anchor_time: str | None,
+ tz_name: str,
+ now: datetime,
+ configuration_id: UUID | str,
+ shard_offset_seconds: int = 0,
+) -> datetime:
+ """When a configuration is next due, by whichever recurrence it carries.
+
+ A calendar unit cannot be reached by adding minutes: a month is not a fixed number of them,
+ and a daylight saving change moves the boundary a local instant sits on.
+
+ `shard_offset_seconds` applies to the minute recurrence only. A calendar recurrence lands on
+ the instant its anchor names, so every configuration that shares an anchor and a timezone is
+ due in the same minute slot. Spreading those would move a time the user chose. A calendar
+ unit without an anchor has no chosen time, so `next_calendar_check_time` spreads it after the
+ interval boundary by `configuration_id`, as it does for an insight alert.
+ """
+ if recurrence_unit is None:
+ return advance_next_check_at(
+ current_next_check_at,
+ check_interval_minutes,
+ now,
+ shard_offset_seconds=shard_offset_seconds,
+ )
+ return next_calendar_check_time(
+ to_recurrence_interval(recurrence_unit),
+ now=now,
+ tz_name=tz_name,
+ next_check_at=current_next_check_at,
+ alert_id=configuration_id,
+ schedule_start_time=anchor_time,
+ )
+
+
# --- Quiet hours (blocked local time windows) ---
MAX_BLOCKED_WINDOWS = 5
diff --git a/products/alerts_platform/backend/logic/platform_lifecycle.py b/products/alerts_platform/backend/logic/platform_lifecycle.py
index 0d19aa980294..1081ad55f549 100644
--- a/products/alerts_platform/backend/logic/platform_lifecycle.py
+++ b/products/alerts_platform/backend/logic/platform_lifecycle.py
@@ -10,13 +10,20 @@ from datetime import datetime
from django.db import transaction
from django.db.models import Exists, OuterRef, Q
+from posthog.models import Team
+
from products.alerts_platform.backend.facade.contracts import (
PlatformAlertCheckInput,
PlatformAlertOutcome,
PlatformAlertUpsert,
)
from products.alerts_platform.backend.facade.platform_metrics import increment_history_rows_dropped, safe_record
-from products.alerts_platform.backend.facade.scheduling import advance_next_check_at, compute_shard_offset_seconds
+from products.alerts_platform.backend.facade.scheduling import (
+ advance_schedule,
+ compute_shard_offset_seconds,
+ to_recurrence_interval,
+ validate_and_normalize_schedule_start_time,
+)
from products.alerts_platform.backend.logic.platform_alert_events import PlatformAlertEventRow, insert_events
from products.alerts_platform.backend.models import PlatformAlert, PlatformAlertConfiguration
@@ -223,6 +230,9 @@ def record_outcomes(team_id: int, outcomes: Sequence[PlatformAlertOutcome], now:
if not configurations:
return 0
alerts = _alerts_for_write(team_id, configurations)
+ # One read for the batch. Every configuration in it belongs to this team, and a
+ # calendar recurrence resolves its anchor against the team's zone.
+ team_timezone = Team.objects.filter(id=team_id).values_list("timezone", flat=True).first() or "UTC"
rows: list[PlatformAlertEventRow] = []
for configuration in configurations:
@@ -241,10 +251,14 @@ def record_outcomes(team_id: int, outcomes: Sequence[PlatformAlertOutcome], now:
configuration.consecutive_failures = outcome.consecutive_failures
if outcome.disable:
configuration.enabled = False
- configuration.next_check_at = advance_next_check_at(
- configuration.next_check_at,
- configuration.check_interval_minutes,
- now,
+ configuration.next_check_at = advance_schedule(
+ current_next_check_at=configuration.next_check_at,
+ check_interval_minutes=configuration.check_interval_minutes,
+ recurrence_unit=configuration.recurrence_unit,
+ anchor_time=configuration.anchor_time,
+ tz_name=team_timezone,
+ now=now,
+ configuration_id=configuration.id,
shard_offset_seconds=compute_shard_offset_seconds(
configuration.id, configuration.check_interval_minutes
),
@@ -266,7 +280,14 @@ def upsert_configuration(upsert: PlatformAlertUpsert) -> bool:
"""Copies one source configuration in. Returns True when it created a row.
Keyed on the row it came from, so a second run updates rather than duplicates.
+
+ The recurrence is checked here rather than where the schedule advances, because an
+ unparseable unit or anchor raised there would fail a whole batch of unrelated checks.
"""
+ if upsert.recurrence_unit is not None:
+ to_recurrence_interval(upsert.recurrence_unit)
+ anchor_time = validate_and_normalize_schedule_start_time(upsert.anchor_time)
+
with transaction.atomic():
configuration, created = PlatformAlertConfiguration.objects.unscoped().update_or_create(
legacy_configuration_id=upsert.legacy_configuration_id,
@@ -280,6 +301,8 @@ def upsert_configuration(upsert: PlatformAlertUpsert) -> bool:
"threshold_operator": upsert.threshold_operator,
"window_minutes": upsert.window_minutes,
"check_interval_minutes": upsert.check_interval_minutes,
+ "recurrence_unit": upsert.recurrence_unit,
+ "anchor_time": anchor_time,
"evaluation_periods": upsert.evaluation_periods,
"datapoints_to_alarm": upsert.datapoints_to_alarm,
"cooldown_minutes": upsert.cooldown_minutes,
diff --git a/products/alerts_platform/backend/logic/platform_reads.py b/products/alerts_platform/backend/logic/platform_reads.py
index 994aaddaf0ab..623bb56e4b53 100644
--- a/products/alerts_platform/backend/logic/platform_reads.py
+++ b/products/alerts_platform/backend/logic/platform_reads.py
@@ -40,6 +40,8 @@ def _configuration_view(configuration: PlatformAlertConfiguration) -> PlatformAl
threshold_operator=configuration.threshold_operator,
window_minutes=configuration.window_minutes,
check_interval_minutes=configuration.check_interval_minutes,
+ recurrence_unit=configuration.recurrence_unit,
+ anchor_time=configuration.anchor_time,
evaluation_periods=configuration.evaluation_periods,
datapoints_to_alarm=configuration.datapoints_to_alarm,
cooldown_minutes=configuration.cooldown_minutes,
diff --git a/products/alerts_platform/backend/migrations/0003_recurrence.py b/products/alerts_platform/backend/migrations/0003_recurrence.py
new file mode 100644
index 000000000000..2e796bcce447
--- /dev/null
+++ b/products/alerts_platform/backend/migrations/0003_recurrence.py
@@ -0,0 +1,27 @@
+# Generated by Django 5.2.17 on 2026-09-30 21:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("alerts_platform", "0002_platform_alert_list_index"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="platformalertconfiguration",
+ name="anchor_time",
+ field=models.CharField(blank=True, max_length=5, null=True),
+ ),
+ migrations.AddField(
+ model_name="platformalertconfiguration",
+ name="recurrence_unit",
+ field=models.CharField(
+ blank=True,
+ choices=[("day", "Day"), ("week", "Week"), ("month", "Month")],
+ max_length=8,
+ null=True,
+ ),
+ ),
+ ]
diff --git a/products/alerts_platform/backend/migrations/max_migration.txt b/products/alerts_platform/backend/migrations/max_migration.txt
index 8daaff59ef9a..e732f6f57e43 100644
--- a/products/alerts_platform/backend/migrations/max_migration.txt
+++ b/products/alerts_platform/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0002_platform_alert_list_index
+0003_recurrence
diff --git a/products/alerts_platform/backend/models/platform_alert.py b/products/alerts_platform/backend/models/platform_alert.py
index f43c7a53c75a..2adc7f4cb99b 100644
--- a/products/alerts_platform/backend/models/platform_alert.py
+++ b/products/alerts_platform/backend/models/platform_alert.py
@@ -13,7 +13,11 @@ from django.db import models
from posthog.models.scoping.root_mixin import TeamScopedRootMixin
from posthog.models.utils import UUIDModel
-from products.alerts_platform.backend.facade.enums import PlatformAlertConfigurationSourceKind, PlatformAlertState
+from products.alerts_platform.backend.facade.enums import (
+ PlatformAlertConfigurationRecurrenceUnit,
+ PlatformAlertConfigurationSourceKind,
+ PlatformAlertState,
+)
class PlatformAlertConfiguration(TeamScopedRootMixin, UUIDModel):
@@ -27,6 +31,7 @@ class PlatformAlertConfiguration(TeamScopedRootMixin, UUIDModel):
# import this module. The attribute stays so `PlatformAlertConfiguration.SourceKind` reads
# the way every other model in the repo does.
SourceKind = PlatformAlertConfigurationSourceKind
+ RecurrenceUnit = PlatformAlertConfigurationRecurrenceUnit
# No database constraint: creating one takes a lock on `posthog_team` that queues behind
# live writes. Django still cascades in Python, which is the only path that deletes a team.
@@ -47,7 +52,14 @@ class PlatformAlertConfiguration(TeamScopedRootMixin, UUIDModel):
threshold_operator = models.CharField(max_length=16)
window_minutes = models.PositiveIntegerField()
+
check_interval_minutes = models.PositiveIntegerField()
+
+ # Null means the recurrence is `check_interval_minutes`. Minutes cannot express a month, and
+ # DST moves the local instant a day or a week lands on, so the two take different paths.
+ recurrence_unit = models.CharField(max_length=8, choices=RecurrenceUnit.choices, null=True, blank=True)
+ # Local wall time, HH:MM, that a calendar recurrence lands on in the team's timezone.
+ anchor_time = models.CharField(max_length=5, null=True, blank=True)
evaluation_periods = models.PositiveIntegerField(default=1, db_default=1)
datapoints_to_alarm = models.PositiveIntegerField(default=1, db_default=1)
cooldown_minutes = models.PositiveIntegerField(default=0, db_default=0)
diff --git a/products/alerts_platform/backend/presentation/views/platform_alert.py b/products/alerts_platform/backend/presentation/views/platform_alert.py
index bc49df268a69..a4a236cf74d2 100644
--- a/products/alerts_platform/backend/presentation/views/platform_alert.py
+++ b/products/alerts_platform/backend/presentation/views/platform_alert.py
@@ -15,7 +15,11 @@ from posthog.scopes import APIScopeObject, scopes_not_covered
from products.access_control.backend.facade.user_access_control import UserAccessControl
from products.alerts_platform.backend.facade import api as platform_api
-from products.alerts_platform.backend.facade.enums import PlatformAlertConfigurationSourceKind, PlatformAlertState
+from products.alerts_platform.backend.facade.enums import (
+ PlatformAlertConfigurationRecurrenceUnit,
+ PlatformAlertConfigurationSourceKind,
+ PlatformAlertState,
+)
from products.alerts_platform.backend.presentation.views.schedule_restriction import ScheduleRestrictionField
@@ -68,7 +72,22 @@ class PlatformAlertConfigurationSerializer(serializers.Serializer):
window_minutes = serializers.IntegerField(
read_only=True, help_text="Length of the evaluated time window, in minutes."
)
- check_interval_minutes = serializers.IntegerField(read_only=True, help_text="Minutes between scheduled checks.")
+ check_interval_minutes = serializers.IntegerField(
+ read_only=True,
+ help_text="Minutes between scheduled checks. Applies when recurrence_unit is null.",
+ )
+ recurrence_unit = serializers.ChoiceField(
+ choices=PlatformAlertConfigurationRecurrenceUnit.choices,
+ read_only=True,
+ allow_null=True,
+ help_text="Calendar unit the alert recurs on. Null means it recurs on check_interval_minutes.",
+ )
+ anchor_time = serializers.CharField(
+ read_only=True,
+ allow_null=True,
+ help_text="Local time (HH:MM in the project timezone) a calendar recurrence lands on. "
+ "Null means the default anchor for the unit.",
+ )
evaluation_periods = serializers.IntegerField(
read_only=True, help_text="Number of recent checks considered when deciding to fire."
)
diff --git a/products/alerts_platform/backend/tests/test_scheduling.py b/products/alerts_platform/backend/tests/test_scheduling.py
index 91d29f9376e4..2f4aa3147aa1 100644
--- a/products/alerts_platform/backend/tests/test_scheduling.py
+++ b/products/alerts_platform/backend/tests/test_scheduling.py
@@ -9,6 +9,8 @@ from parameterized import parameterized
from products.alerts_platform.backend.facade.scheduling import (
BlockedWindow,
CalendarInterval,
+ advance_next_check_at,
+ advance_schedule,
alert_check_offset,
is_weekend,
next_calendar_check_time,
@@ -519,3 +521,78 @@ class TestScanNextUnblockedUtc:
self, _name: str, window: tuple[str, str], candidate: datetime, expected: datetime
) -> None:
assert scan_next_unblocked_utc(candidate, "America/New_York", self._windows(window)) == expected
+
+
+class TestRecurrenceDispatch:
+ """`advance_schedule` picks the minute arithmetic or the calendar anchor by recurrence unit."""
+
+ DISPATCH_NOW = datetime(2026, 9, 30, 21, 0, tzinfo=UTC)
+
+ def test_no_unit_keeps_the_minute_arithmetic(self) -> None:
+ current = datetime(2026, 9, 30, 20, 55, tzinfo=UTC)
+ assert advance_schedule(
+ current_next_check_at=current,
+ check_interval_minutes=10,
+ recurrence_unit=None,
+ anchor_time=None,
+ tz_name="America/New_York",
+ now=self.DISPATCH_NOW,
+ configuration_id=ALERT_ID,
+ ) == advance_next_check_at(current, 10, self.DISPATCH_NOW)
+
+ @parameterized.expand(
+ [
+ ("day", datetime(2026, 10, 1, 8, 0, tzinfo=UTC)),
+ ("week", datetime(2026, 10, 5, 8, 0, tzinfo=UTC)),
+ ("month", datetime(2026, 10, 1, 8, 0, tzinfo=UTC)),
+ ]
+ )
+ def test_a_calendar_unit_lands_on_the_local_anchor(self, unit: str, expected: datetime) -> None:
+ assert (
+ advance_schedule(
+ current_next_check_at=None,
+ check_interval_minutes=10,
+ recurrence_unit=unit,
+ anchor_time="04:00",
+ tz_name="America/New_York",
+ now=self.DISPATCH_NOW,
+ configuration_id=ALERT_ID,
+ )
+ == expected
+ )
+
+ def test_a_calendar_unit_without_an_anchor_is_spread_by_the_configuration(self) -> None:
+ # 1am local on the next day in New York, then this configuration's own offset after it.
+ assert advance_schedule(
+ current_next_check_at=None,
+ check_interval_minutes=10,
+ recurrence_unit="day",
+ anchor_time=None,
+ tz_name="America/New_York",
+ now=self.DISPATCH_NOW,
+ configuration_id=ALERT_ID,
+ ) == datetime(2026, 10, 1, 5, 0, tzinfo=UTC) + alert_check_offset(CalendarInterval.DAILY, ALERT_ID)
+
+ def test_a_monthly_recurrence_lands_on_the_next_month_not_the_interval(self) -> None:
+ # The 1st of the next month at the anchor, which the weekly and minute paths both miss.
+ assert advance_schedule(
+ current_next_check_at=self.DISPATCH_NOW,
+ check_interval_minutes=10,
+ recurrence_unit="month",
+ anchor_time="04:00",
+ tz_name="UTC",
+ now=self.DISPATCH_NOW,
+ configuration_id=ALERT_ID,
+ ) == datetime(2026, 11, 1, 4, 0, tzinfo=UTC)
+
+ def test_an_unknown_unit_is_named_in_the_error(self) -> None:
+ with pytest.raises(ValueError, match="Unhandled recurrence unit: 'fortnight'"):
+ advance_schedule(
+ current_next_check_at=None,
+ check_interval_minutes=10,
+ recurrence_unit="fortnight",
+ anchor_time=None,
+ tz_name="UTC",
+ now=self.DISPATCH_NOW,
+ configuration_id=ALERT_ID,
+ )
diff --git a/products/alerts_platform/frontend/generated/api.schemas.ts b/products/alerts_platform/frontend/generated/api.schemas.ts
index 18a196f997fd..1c838aae4b0f 100644
--- a/products/alerts_platform/frontend/generated/api.schemas.ts
+++ b/products/alerts_platform/frontend/generated/api.schemas.ts
@@ -17,6 +17,19 @@ export const PlatformAlertConfigurationSourceKindEnumApi = {
Logs: 'logs',
} as const
+/**
+ * * `day` - Day
+ * * `week` - Week
+ * * `month` - Month
+ */
+export type CalendarUnitEnumApi = (typeof CalendarUnitEnumApi)[keyof typeof CalendarUnitEnumApi]
+
+export const CalendarUnitEnumApi = {
+ Day: 'day',
+ Week: 'week',
+ Month: 'month',
+} as const
+
export interface AlertScheduleRestrictionWindowApi {
/** Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)). */
start: string
@@ -101,8 +114,19 @@ export interface PlatformAlertConfigurationApi {
readonly threshold_operator: string
/** Length of the evaluated time window, in minutes. */
readonly window_minutes: number
- /** Minutes between scheduled checks. */
+ /** Minutes between scheduled checks. Applies when recurrence_unit is null. */
readonly check_interval_minutes: number
+ /** Calendar unit the alert recurs on. Null means it recurs on check_interval_minutes.
+ *
+ * * `day` - Day
+ * * `week` - Week
+ * * `month` - Month */
+ readonly recurrence_unit: CalendarUnitEnumApi | null
+ /**
+ * Local time (HH:MM in the project timezone) a calendar recurrence lands on. Null means the default anchor for the unit.
+ * @nullable
+ */
+ readonly anchor_time: string | null
/** Number of recent checks considered when deciding to fire. */
readonly evaluation_periods: number
/** Number of breaching checks within evaluation_periods required to fire. */
diff --git a/products/alerts_platform/frontend/generated/api.zod.schemas.ts b/products/alerts_platform/frontend/generated/api.zod.schemas.ts
index 7f6c23bdc13a..748f37921c15 100644
--- a/products/alerts_platform/frontend/generated/api.zod.schemas.ts
+++ b/products/alerts_platform/frontend/generated/api.zod.schemas.ts
@@ -16,6 +16,13 @@ export type PlatformAlertConfigurationSourceKindEnumApiOutput = zod.output<
typeof PlatformAlertConfigurationSourceKindEnumApi
>
+export const CalendarUnitEnumApi = zod
+ .enum(['day', 'week', 'month'])
+ .describe('\* `day` - Day\n\* `week` - Week\n\* `month` - Month')
+
+export type CalendarUnitEnumApi = zod.input<typeof CalendarUnitEnumApi>
+export type CalendarUnitEnumApiOutput = zod.output<typeof CalendarUnitEnumApi>
+
export const AlertScheduleRestrictionWindowApi = zod.object({
start: zod
.string()
@@ -109,7 +116,23 @@ export const PlatformAlertConfigurationApi = zod.object({
threshold_count: zod.number().describe('Count the evaluated value is compared against.'),
threshold_operator: zod.string().describe('Comparison operator applied between the value and threshold_count.'),
window_minutes: zod.number().describe('Length of the evaluated time window, in minutes.'),
- check_interval_minutes: zod.number().describe('Minutes between scheduled checks.'),
+ check_interval_minutes: zod
+ .number()
+ .describe('Minutes between scheduled checks. Applies when recurrence_unit is null.'),
+ recurrence_unit: zod
+ .union([
+ zod.enum(['day', 'week', 'month']).describe('\* `day` - Day\n\* `week` - Week\n\* `month` - Month'),
+ zod.null(),
+ ])
+ .describe(
+ 'Calendar unit the alert recurs on. Null means it recurs on check_interval_minutes.\n\n\* `day` - Day\n\* `week` - Week\n\* `month` - Month'
+ ),
+ anchor_time: zod
+ .string()
+ .nullable()
+ .describe(
+ 'Local time (HH:MM in the project timezone) a calendar recurrence lands on. Null means the default anchor for the unit.'
+ ),
evaluation_periods: zod.number().describe('Number of recent checks considered when deciding to fire.'),
datapoints_to_alarm: zod
.number()
@@ -213,7 +236,23 @@ export const PaginatedPlatformAlertConfigurationListApi = zod.object({
.string()
.describe('Comparison operator applied between the value and threshold_count.'),
window_minutes: zod.number().describe('Length of the evaluated time window, in minutes.'),
- check_interval_minutes: zod.number().describe('Minutes between scheduled checks.'),
+ check_interval_minutes: zod
+ .number()
+ .describe('Minutes between scheduled checks. Applies when recurrence_unit is null.'),
+ recurrence_unit: zod
+ .union([
+ zod.enum(['day', 'week', 'month']).describe('\* `day` - Day\n\* `week` - Week\n\* `month` - Month'),
+ zod.null(),
+ ])
+ .describe(
+ 'Calendar unit the alert recurs on. Null means it recurs on check_interval_minutes.\n\n\* `day` - Day\n\* `week` - Week\n\* `month` - Month'
+ ),
+ anchor_time: zod
+ .string()
+ .nullable()
+ .describe(
+ 'Local time (HH:MM in the project timezone) a calendar recurrence lands on. Null means the default anchor for the unit.'
+ ),
evaluation_periods: zod.number().describe('Number of recent checks considered when deciding to fire.'),
datapoints_to_alarm: zod
.number()
diff --git a/products/tasks/frontend/generated/api.schemas.ts b/products/tasks/frontend/generated/api.schemas.ts
index 6a5b3b6a1f70..988448bec8d2 100644
--- a/products/tasks/frontend/generated/api.schemas.ts
+++ b/products/tasks/frontend/generated/api.schemas.ts
@@ -1340,9 +1340,9 @@ export const SpaceSetupKindEnumApi = {
* * `week` - Week
* * `month` - Month
*/
-export type SpaceGoalPeriodEnumApi = (typeof SpaceGoalPeriodEnumApi)[keyof typeof SpaceGoalPeriodEnumApi]
+export type CalendarUnitEnumApi = (typeof CalendarUnitEnumApi)[keyof typeof CalendarUnitEnumApi]
-export const SpaceGoalPeriodEnumApi = {
+export const CalendarUnitEnumApi = {
Day: 'day',
Week: 'week',
Month: 'month',
@@ -1373,7 +1373,7 @@ export interface SpaceGoalWriteApi {
* * `day` - Day
* * `week` - Week
* * `month` - Month */
- period?: SpaceGoalPeriodEnumApi
+ period?: CalendarUnitEnumApi
/** Whether the target is a floor ('at_least') or a ceiling ('at_most').
*
* * `at_least` - At least
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0ea6686078da..3d9cecbbbe42 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -19187,6 +19187,20 @@ export namespace Schemas {
status: CalendarSyncTriggerResponseStatusEnum;
}
+ /**
+ * * `day` - Day
+ * * `week` - Week
+ * * `month` - Month
+ */
+ export type CalendarUnitEnum = typeof CalendarUnitEnum[keyof typeof CalendarUnitEnum];
+
+
+ export const CalendarUnitEnum = {
+ Day: 'day',
+ Week: 'week',
+ Month: 'month',
+ } as const;
+
/**
* * `needs_approval` - needs_approval
* * `disabled` - disabled
@@ -21738,20 +21752,6 @@ export namespace Schemas {
Feature: 'feature',
} as const;
- /**
- * * `day` - Day
- * * `week` - Week
- * * `month` - Month
- */
- export type SpaceGoalPeriodEnum = typeof SpaceGoalPeriodEnum[keyof typeof SpaceGoalPeriodEnum];
-
-
- export const SpaceGoalPeriodEnum = {
- Day: 'day',
- Week: 'week',
- Month: 'month',
- } as const;
-
/**
* * `at_least` - At least
* * `at_most` - At most
@@ -21778,7 +21778,7 @@ export namespace Schemas {
* * `day` - Day
* * `week` - Week
* * `month` - Month */
- period?: SpaceGoalPeriodEnum;
+ period?: CalendarUnitEnum;
/** Whether the target is a floor ('at_least') or a ceiling ('at_most').
*
* * `at_least` - At least
@@ -68118,8 +68118,19 @@ export namespace Schemas {
readonly threshold_operator: string;
/** Length of the evaluated time window, in minutes. */
readonly window_minutes: number;
- /** Minutes between scheduled checks. */
+ /** Minutes between scheduled checks. Applies when recurrence_unit is null. */
readonly check_interval_minutes: number;
+ /** Calendar unit the alert recurs on. Null means it recurs on check_interval_minutes.
+ *
+ * * `day` - Day
+ * * `week` - Week
+ * * `month` - Month */
+ readonly recurrence_unit: CalendarUnitEnum | null;
+ /**
+ * Local time (HH:MM in the project timezone) a calendar recurrence lands on. Null means the default anchor for the unit.
+ * @nullable
+ */
+ readonly anchor_time: string | null;
/** Number of recent checks considered when deciding to fire. */
readonly evaluation_periods: number;
/** Number of breaching checks within evaluation_periods required to fire. */