Repository navigation
chore(analytics): stop sending usage events to PostHog (growth phase 3) - #367
Closed
DevelopedByDev wants to merge 7 commits into
Closed
DevelopedByDev wants to merge 7 commits into
DevelopedByDev wants to merge 7 commits into
Conversation
Count each UTC day from existing tables: things created (tasks, agents, automations, files), work done (threads, messages, automation runs, file edits), signups, active users, W1/W4 cohorts, paid subscriptions, top-ups and billed usage. The job runs as resumable paged mutations from a daily cron, with a backfill entry point. Files now record when and by whom their text last changed, so edits aren't confused with indexing or moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The on-prem Convex boundary check tracks every cron and scheduler call site; add the nightly growth job's entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ero paid Address review findings on the nightly growth rollups: - Record file edits per (file, UTC day) as they happen, with every person who edited, instead of a last-edited field that a second editor, an agent overwrite or a post-midnight edit would overwrite before the nightly count. - Credit task creation through the task's `created` event actor, so an agent creating a task for its owner doesn't make the owner active. - Start the live paid-subscription snapshot at zero, so a night with no paid plans records 0 rather than leaving the earlier count in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address the second round of review findings on the nightly rollups: - Weekly/monthly actives and W1/W4 credit no longer depend on the order days are counted, so a backfill after the first nightly run is correct. - Count billed spend as billing/usageTotals does: finalized reservations plus self-charged usage operations. - Keep spend per (day, workspace) in its own table instead of an unbounded array on the job state. - Re-count the two days before each night so late top-ups, runs and reservation finalizations are picked up; count partly refunded top-ups. - Date accounts already paid at the first snapshot by their subscription, whichever runs first, and drop the capped backfill seeding. - Don't credit owners with agent-drive files (`files.createdByAgent`), and detect edits to object-stored text by its full-text hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eleted File edit rows no longer store editor ids; the editor is credited in growthUserDays when they save, and retention is checked for every user-day during the nightly count. Account deletion now removes the person's growthUsers and growthUserDays rows, leaving only anonymous totals and cohort counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
admin/console:getGrowthSummary reads only the growth tables: 90 days of totals, new paid accounts per day, the last 12 signup cohorts and the top workspaces by spend. GET /api/v1/admin/growth serves it to admin, auditor and billing operators; support has no access. The panel shows headline numbers against the prior week, weekly trends per group, W1/W4 retention and the top workspaces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Growth is counted from Convex now, so the client and server metrics pipelines, retention.engaged, the signed-in ping, feature-level captures (chat, Work, integrations, auth callback, sign-out) and the billing, automation and workspace lifecycle mappings are removed. PostHog keeps pageviews, identify/reset, feature flags and one signup event, renamed user.signed_up. The unused Convex withMetrics wrapper and its aggregation query are deleted; the functionMetrics table and cleanup cron stay until the table is empty. The growth plan is retired into admin-console.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Collaborator
Author
QA handoff (partial)
Hosted check: shipped browser bundlesI fetched
Public pages and Not yet covered
🤖 Generated with Claude Code |
This was referenced Nov 1, 2026
Collaborator
Author
|
Superseded by #372, which includes this change together with the admin console redesign. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of the growth analytics plan. This PR also retires the plan doc into
internal/develop/admin-console.md.Stacked on #365 (nightly job) → #366 (admin Growth panel). Merge those first. Until they merge, this diff includes their commits; the Phase 3 change is the last commit.
Merge only after the Growth panel is live in production and its backfill has run. Otherwise there is a gap where no growth numbers are visible. Before merging, also check that no PostHog dashboard or alert depends on the removed events listed below.
Removed
Client metrics. Removed
src/shared/observability/client-metrics.tsandduplicate-tracker.ts, their call sites, and the forwarding inObservabilityClient. Their call sites were:Server metrics. Removed
src/server/observability/metrics.ts:overlay.metrics.bff_requestis gone, though the[BFF_METRIC]server log line stays;ActContextService.emitTokenBreakdown.Session pings. Removed
retention.engagedandauth.session.signed_in. Returning users now come from Convex active users.Feature captures. Removed the remaining
posthog.capturecalls:work-analytics.tsand its test;The knowledge analytics adapter is now a no-op unless a
captureis injected.Lifecycle mappings. Removed the billing, automation and workspace lifecycle → PostHog mappings. The lifecycle email and audit sinks are unchanged.
Convex. Removed
convex/lib/metrics.ts(withMetricshad no users) andplatform/metrics:aggregateMetricsInternal.Kept
$pageviewwith a redacted URL,identify/reset, and the server client used for feature flags.activation.completed, renameduser.signed_up, so signups can be tied to the pages that brought them in. Any PostHog funnel that uses the old name needs updating.functionMetricstable and its 6-hourly cleanup cron. Nothing writes the table any more. Dropping a table that still has rows could block a production schema push, so remove it in a later PR once it's confirmed empty.Checks
Typecheck (
scripts/ci/typecheck-pre-push.mjs, web and admin): passes.Targeted ESLint on the changed files: 0 errors. The only warnings were already there.
Tests:
posthog-server(rewritten for the new mapping);webKnowledgeSurfaceAdapters;useAgentRunLifecycle;chat-list-cache;public-route-security;LifecycleEventPublisher;convex/growthAnalytics.convex.test.ts.All pass.
check:on-prem-convex-boundariesandcheck:shared-isomorphic: OK.Preview QA from the plan is still to do. On the PR preview, send a chat, create a task and connect an integration, then confirm:
🤖 Generated with Claude Code