← all branches

feat/mrr-tables

needs attentionviewing older commit
870badc · fullpre-PRreviewed 2026-08-07 23:15 UTC1H · 3M · 3L · 4I
The branch
Purpose
Clean up obsolete PostHog MRR analytics insights that used a plan-floor event (revenue.mrr_snapshot) excluded overage/subs and were superseded by a better interactive pivot
Goal
Reduce dashboard noise by removing 7 dead/superseded insights and restructuring the Revenue MRR dashboard to surface the coverage gap and subscription MRR as the primary tiles
Sub-goals
  • Remove mrr_total, mrr_by_plan, mrr_by_segment (event-based plan-floor insights with known limitations)
  • Remove mrr_by_product, mrr_by_product_summary, usage_by_product_month, active_subs_by_plan (D3 static tables superseded by pivot)
  • Reorganize dashboard layout: mrr_coverage_gap promoted to top full-width, mrr_subscription_based and churned_mrr in second row
The changes (whole branch)
What
7 PostHog insights deleted from insights.tf, Revenue MRR dashboard layout restructured in dashboards.tf from 9 to 5 codified tiles
Why
Static MRR tables replaced by interactive pivot with HogQL SQL variables (which Terraform provider cannot declare); event-based insights were stuck at ~$66k due to excluding overage/subs
Areas
infra/posthog/insights.tf+18323infra/posthog/dashboards.tf+1230
Blast
2 files, +30/−353 lines; analytics IaC only — no app code, no DB migrations, no API changes
terraform-references· All 50 dashboard tile insight references resolve to defined resources; no dangling depends_onci· No open PR; CI not triggered on pre-PR branchcoderabbit· No .coderabbit.yaml in repo

Findings · 11

correctness3

medium

.claude/rules/posthog-api-insights.md does not exist in working tree

infra/posthog/dashboards.tf:166

Referenced as maintenance SSOT for the out-of-band pivot in two places. Absent from this branch (exists in a sibling commit not yet merged here).

low

Customer names (Neto, Pilgrim's) in PostHog insight description field

infra/posthog/insights.tf:1023

Description is a PostHog API/UI attribute readable by anyone with project access. Prefer generic label; keep specifics in code comments.

low

Finance MRR figures committed to git history (accepted trade-off)

infra/posthog/insights.tf:1106

Product-level MRR breakdown (~$396k MXN total) from June 2026 finance sheet in Terraform locals. Permanent in git history. Noted as Approach A in comments.

security1

info

No credentials/secrets in surviving HogQL queries

infra/posthog/insights.tf

All supabase.public__* references use only table/column names — no connection strings, API keys, or PII selected at row level.

conventions3

high

scripts/posthog-mrr-pivot.mjs does not exist

infra/posthog/dashboards.tf:165

Comment says pivot is 'created OUT-OF-BAND by scripts/posthog-mrr-pivot.mjs'. Script does not exist anywhere in the repo. The pivot's SQL lives only in PostHog UI — no code-backed definition, silent-drift-prone.

medium

Stale comments reference mrr_por_producto / mrr_por_org as current MRR SOT

infra/posthog/insights.tf:838

Comments at lines 838, 1003, 1007 recommend 'use the D3 insights (mrr_por_producto / mrr_por_org)' but those insights were deleted in this PR. Should reference the pivot + mrr_coverage_gap.

medium

Block tombstone style vs per-insight one-liner style elsewhere

infra/posthog/insights.tf

Three D3 insights removed under one block comment; other removals use individual one-liner tombstones.

tests1

info

No .tftest.hcl; CI validates via live terraform apply

.github/workflows/pr-checks.yml

Consistent with rest of repo. Reference integrity pre-verified by cross-check.

improvement3

low

Double blank line after tombstone comment at ~line 1008

infra/posthog/insights.tf:1008

Two consecutive blank lines between tombstone comments; Terraform style uses one.

info

d3_led_cte local is not orphaned — used by mrr_coverage_gap

infra/posthog/insights.tf:1090

All 5 d3_* locals consumed by the surviving mrr_coverage_gap insight.

info

No lingering references to removed insights in alerts/outputs/variables

infra/posthog/alerts.tf

Confirmed clean across all support .tf files.

History · 3 commits

  1. 6662df4safeincremental0H · 0M · 2L2026-08-10 18:15
  2. 7bc9dd8needs attentionincremental1H · 8M · 6L2026-08-10 17:59
  3. 870badcneeds attentionfull1H · 3M · 3L2026-08-07 23:15current