diff --git a/internal/domain/scheduling/schedule.go b/internal/domain/scheduling/schedule.go index 573e7ebb6..787f02245 100644 --- a/internal/domain/scheduling/schedule.go +++ b/internal/domain/scheduling/schedule.go @@ -89,10 +89,12 @@ const ( // (or after Start, if never run). The simplest recurring schedule. ScheduleInterval = "interval" - // ScheduleCron fires at the next moment matching a standard 5-field - // cron expression (or one of the @ macros) after the last successful + // ScheduleCron fires at the next moment matching a 5-field cron + // expression (or one of the @ macros) after the last successful // run, computed in the zone of that run time. Expressions are parsed - // with pocketbase tools/cron. + // with pocketbase tools/cron, which ANDs day-of-month with day-of-week + // instead of Vixie cron's OR: "0 0 1 * 1" means only Monday the 1st, + // not "the 1st or any Monday". ScheduleCron = "cron" // ScheduleOnce fires once at the configured At time. Subsequent diff --git a/internal/domain/scheduling/schedule_test.go b/internal/domain/scheduling/schedule_test.go index 3707024fc..44734b435 100644 --- a/internal/domain/scheduling/schedule_test.go +++ b/internal/domain/scheduling/schedule_test.go @@ -35,6 +35,14 @@ func TestScheduleCronNextRun(t *testing.T) { lastRun: zoned(2026, 8, 24, 12, 7, 0), want: zoned(2026, 8, 24, 12, 15, 0), }, + { + // pins the pocketbase AND semantics: Vixie cron would give the + // next Monday (2026-08-31); tools/cron gives Monday the 1st. + name: "dual-restricted day-of-month and day-of-week AND, not Vixie OR", + expr: "0 0 1 * 1", + lastRun: zoned(2026, 8, 24, 12, 15, 30), + want: zoned(2027, 2, 1, 0, 0, 0), + }, { name: "run exactly on a matching minute advances to the next one", expr: "0 * * * *",