Skip to content

feat(analytics): add nightly retention cohort rollup job - #607

Merged
phertyameen merged 1 commit into
MindBlockLabs:mainfrom
kiel997:feature/547-retention-cohort-rollup-job
Jul 29, 2026
Merged

feat(analytics): add nightly retention cohort rollup job#607
phertyameen merged 1 commit into
MindBlockLabs:mainfrom
kiel997:feature/547-retention-cohort-rollup-job

Conversation

@kiel997

@kiel997 kiel997 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #547

Adds a @Cron job that updates RetentionCohort rows nightly.

Since User has no signup-date column, cohort membership is derived from
each user's earliest AnalyticsEvent (same proxy GetChurnRiskProvider
uses). A user's day-N retention can only change on the calendar day
exactly N days after their cohort date, so instead of recomputing the
full 90-day window nightly, the job only ever touches up to four rows
per run: today's forming cohort, plus the day-1/7/30 cohorts crossing
a threshold today.

Verified with unit tests covering: new cohort creation, single-row
day-1 updates, no-op when no cohort exists for an offset, and
idempotent re-runs. All 5 tests pass in well under 50ms of actual
job logic each.

Closes MindBlockLabs#547
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
mind-block-app-frontend Skipped Skipped Jul 29, 2026 9:18am

@phertyameen
phertyameen merged commit a605acf into MindBlockLabs:main Jul 29, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement nightly retention cohort rollup job

2 participants