diff --git a/apps/insights-edge/src/report.mjs b/apps/insights-edge/src/report.mjs index 0246b740..4965c679 100644 --- a/apps/insights-edge/src/report.mjs +++ b/apps/insights-edge/src/report.mjs @@ -1,6 +1,8 @@ // Weekly funnel report: every site in the SITES KV, last 7 full UTC days // against the 7 before, emailed through Scribase Mail (Rally Send protocol). -// Runs from the Worker cron (Mondays 07:00 UTC) and from POST /api/report. +// Runs from the Worker cron (Mondays 07:00 UTC -- wrangler.jsonc's "triggers.crons", +// fixed 2026-10-26 to "0 7 * * MON" after it silently fired every Sunday for weeks; +// see the comment there) and from POST /api/report. import { siteStats } from "./store.mjs"; diff --git a/apps/insights-edge/wrangler.jsonc b/apps/insights-edge/wrangler.jsonc index 375e8a42..bbc18580 100644 --- a/apps/insights-edge/wrangler.jsonc +++ b/apps/insights-edge/wrangler.jsonc @@ -21,7 +21,13 @@ // `//.json`. Create once with `wrangler r2 bucket create railyard-insights-replay`. "r2_buckets": [{ "binding": "REPLAY", "bucket_name": "railyard-insights-replay" }], // Weekly funnel report, Mondays 07:00 UTC, through Scribase Mail. - "triggers": { "crons": ["0 7 * * 1"] }, + // NB (found 2026-10-26): Cloudflare Cron Triggers number weekdays 1=Sunday..7=Saturday + // (Quartz-style), NOT the POSIX 0=Sunday..6=Saturday most cron docs assume. "0 7 * * 1" + // therefore actually fired every SUNDAY 07:00 UTC in production for weeks (confirmed via + // the real delivered digest emails: 2026-10-11, -18, -25 all landed Sunday 07:00-07:01 + // UTC, not Monday). Using the three-letter abbreviation instead, as Cloudflare's own docs + // recommend, to avoid this ambiguity ever recurring. + "triggers": { "crons": ["0 7 * * MON"] }, // Namespace RAILYARD_SITES, created 2026-09-30 (`wrangler kv namespace create RAILYARD_SITES`). "kv_namespaces": [{ "binding": "SITES", "id": "323121abfdc64ff6ab90927620d3dbb2" }], "vars": {