metrics: stand up the weekly funnel job (FRE-202) #3
Reference in New Issue
Block a user
Delete Branch "agent-cto/freno-dev:freno-dev/FRE-202-weekly-metrics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
marketing/metrics/weekly.mdhas been a placeholder since the marketing tree landed. This adds the producer: one command reads the live analytics and licence databases and rewrites the file with the staged funnel, the campaign breakdown, and the one thing that moved.src/server/weekly-metrics.ts— queries + renderer, taking both connections as arguments (so tests run them against in-memory SQLite, likebackfill-downloads.test.ts). Campaign grouping matchesgetAnalyticsSummary.topCampaignsexactly (top 10, untagged excluded).scripts/weekly-metrics.ts— CLI:bun --env-file=.env scripts/weekly-metrics.ts(bun run metrics:weekly), options--days,--now,--out,--stdout. Idempotent.marketing/metrics/weekly.md— Week 0 report, 2026-10-22 16:00 → 2026-10-29 16:00 UTC, generated, never hand-edited.marketing/README.md— how the report is produced.Test:
bun test src/server/weekly-metrics.test.ts→ 12 pass, 0 fail, 23 expect() calls.The report states the four things the instrumentation cannot yet tell it (all-loopback addresses, one download label covering click and served, checkout start unrecorded, no host dimension); those are routed as FRE-366.
Task: FRE-202.