fix/ph-insights
needs attentionviewing older commitf9ad657 · incrementalpre-PRreviewed 2026-08-01 00:35 UTC0H · 1M · 2L · 1I- Purpose
- Fix misleading PostHog dashboards — dead-event tiles and admin-gated funnels that showed structurally wrong metrics
- Goal
- Make PostHog activation and job-health dashboards read correctly without misleading the team
- Sub-goals
- Remove permanently-empty dashboard tiles for dead cfe_job.* event insights
- Add member-level time-to-value funnel that excludes the admin-only credentials step
- Rename funnels to clarify org-level vs member-level semantics
- Add BAT-286 staleness warning to the dead-event block
- What
- Removed 2 dead-event tiles from platform_health dashboard layout. Added time_to_value_funnel_no_credentials insight (3-step, excl. credentials). Extracted shared funnel config into locals. Renamed time_to_value_funnel and org_activation_funnel to clarify scope.
- Why
- Four dashboard tiles were permanently empty — cfe_job.* terminal events never fired in the Lambda pipeline. The time-to-value funnel gated on credentials.saved (admin-only, ~10 people/90d), capping step-2 at ~8% BY CONSTRUCTION regardless of actual activation health.
- Areas
- infra/posthog/dashboards.tf+6−9infra/posthog/insights.tf+146−24
- Blast
- PostHog IaC only — 2 files, +152/-33. No application code, no DB, no API changes.
Findings · 4
improvement4
Staleness comment has no machine-enforceable hook — it will silently rot
infra/posthog/insights.tf
The '⚠ THIS BLOCK GOES STALE THE DAY BAT-286 LANDS' comment is a purely human reminder with no enforcement mechanism. When BAT-286 lands the reviewer must remember to grep for it. Consider a Terraform lifecycle precondition with BAT-286 in the error_message, or extract the two dead-event resources into insights_dead_events.tf so deletion is a file-drop.
org_activation_funnel repeats 30-day window inline — undocumented coincidence
infra/posthog/insights.tf
The inline funnelWindowInterval = 30 in org_activation_funnel is now an undocumented coincidence with the shared locals. A brief comment clarifying it is intentionally independent would prevent a future reviewer from incorrectly pulling it onto the shared local.
Alert-only guard comment lives only in dashboards.tf, not on the resource definition
infra/posthog/insights.tf
Already addressed — the job_success_rate and job_failure_by_error resources already carry '# Detached: kept as a resource for alerts.tf only.' at their definition sites. No action required.
time_to_value_date_range local adds indirection for a trivial single-field value
infra/posthog/insights.tf
time_to_value_funnels_filter (3 fields) justifies extraction. time_to_value_date_range ({ date_from = "-90d" }) is a single field — the indirection adds minimal DRY value. Consider inlining it or adding a comment explaining the 90-day window is a shared policy.