feat/mrr-d3
safeviewing older commit9c481ad · incrementalpre-PRreviewed 2026-08-07 17:23 UTC0H · 0M · 1L · 2I- Purpose
- Add MRR cross-reference analytics to PostHog — measured on-platform MRR vs off-platform reference vs total company MRR (coverage gap view).
- Goal
- Four D3 insights (BAT-308–311): mrr_by_product (per-org detail), mrr_by_product_summary (rollup), usage_by_product_month (MoM temporal), mrr_coverage_gap (measured vs total, gap = residual). Product derivation from credit_transactions + subscriptions.
- Sub-goals
- D3.1 (BAT-309) mrr_by_product — per-org MRR × product detail table
- D3.2a (BAT-310) mrr_by_product_summary — rollup by product
- D3.2b (BAT-310) usage_by_product_month — MoM temporal use
- D3.3 (BAT-311) mrr_coverage_gap — measured + off-platform ref vs company total
- Dashboard layout — 4 D3 tiles added to revenue_mrr dashboard
- What
- Trim mrr_coverage_gap description from 498 → 376 chars to fix PostHog 400-char API limit. No SQL, no logic, no structural changes — metadata-only.
- Why
- PostHog API returns HTTP 400 when insight description exceeds 400 chars; terraform apply was failing on this resource.
- Areas
- infra/posthog/insights.tf+304−0infra/posthog/dashboards.tf+17−0
- Blast
- 2 files, +321/-0 across infra/posthog. PostHog-only — no platform code, no database, no API, no UI.
Findings · 3
correctness2
Dropped `d3_offplatform_mrr` variable name — readers must grep .tf to find what to refresh
infra/posthog/insights.tf:1485
Old text named the Terraform local explicitly: 'Constantes finance en locals (d3_offplatform_mrr), se refrescan a mano.' New text says only 'Constantes en locals (refresco manual)'. A reader who sees 'refresco manual' in the PostHog UI now has to grep the .tf file to find what to edit. Fix: 'Constantes en locals.d3_offplatform_mrr (manual).' fits within 400 chars.
Commit message cites 431 chars for old description; actual was 498
infra/posthog/insights.tf:1485
Minor inaccuracy in commit narrative only. New description is 376 chars — safely under the 400-char limit regardless. No impact on resource correctness.
improvement1
Consider `locals{}` for long descriptions to avoid future 400-char scrambles
infra/posthog/insights.tf
The file already uses locals for SQL CTEs. Applying the same pattern to long descriptions (e.g. `mrr_coverage_gap_description = "..."` in locals) uncaps HCL string length. Not urgent at 376 chars, but worth reaching for if a description approaches 350 chars again.