Admin report: retention cohorts (signup week, weeks 1/4/12) #239
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 422 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #239"
general
weight: 0.35
cursor[bot]
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
Summary
Adds an admin Retention cohorts report under Admin → Reports, registered in the existing reports registry.
collections.updatedAtin weeks 1, 4, and 12 after that cohort week (windows are seven days each, starting at cohort week + N×7 days).getAdminRetentionCohorts(reusesassertSiteAdmin/admin: trueclaim). One-shot load plus Refresh in the UI.Not tracked yet
| Metric | Reason |
|--------|--------|
| Site visits / page views | PostHog captures
$pageviewand funnel events client-side, but there is no server-side PostHog query (no personal API key in Cloud Functions), so visit-based “return” cannot be shown safely from the admin UI. || Sign-in-only return | Firebase Auth exposes
lastSignInTimeonly as the latest sign-in, not per-week history, so it cannot power week-1/4/12 retention. |The report UI lists these gaps explicitly in a Not tracked yet callout.
Return signal caveat
Percentages reflect collection entry updates, not passive browsing. Users who only view the site without touching their collection count as non-returned in this report.
Setup / deploy
1. Functions: Deploy Cloud Functions so
getAdminRetentionCohortsis available (firebase deploy --only functionsor full project deploy).2. Firestore rules: No change in this PR (data is not client-readable).
3. Indexes: None required (admin SDK pagination only).
4. Config: No new env vars. Existing PostHog build-time keys are unchanged and are not used by this report.
Tests
functions/retentionCohorts.test.js— cohort grouping, week windows, admin gate, handler merge.frontend/src/pages/Admin/reports/useRetentionCohortsReport.test.js— callable hook.frontend/src/pages/Admin/reports/RetentionCohortsReport.test.jsx— UI render.Demo
Retention cohorts report
<sub>To show artifacts inline, <a href="https://cursor.com/dashboard/cloud-agents#my-pull-requests">enable</a> in settings.</sub>
<!-- CURSOR_AGENT_PR_BODY_END -->
<div><a href="https://cursor.com/agents/bc-557b1c8a-a53f-5030-b945-2f06410dc72b?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-557b1c8a-a53f-5030-b945-2f06410dc72b&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>