feat: make posthog analytics configurable#3707
Conversation
|
Claude finished @joeyorlando's task in 3m 7s —— View job PR Review: make posthog analytics configurable
SummaryOverall this is a clean, well-tested refactor. It correctly moves PostHog key/host out of the hardcoded frontend bundle and into the backend's A few observations / suggestions below, ordered by significance. Nothing blocking. Suggestions1. The frontend "empty key" guard is effectively dead code given current backend behavior — if (
!isPublicConfigLoading &&
analytics?.enabled &&
analytics.posthog.key && // <— can never be falsy today
!isPostHogInitializedRef.current
) {
Two reasonable choices:
I'd lean toward the second option — it makes the "disable by unsetting key" path work intuitively. Fix this → 2. Ambiguity between "enabled + empty key" vs Right now there are two ways an operator could plausibly try to opt out:
The latter is almost certainly surprising: a user explicitly setting an empty key does NOT expect their telemetry to be sent to Archestra's hosted project. Consider either:
3. analytics: getAnalyticsConfig(),This is consistent with how the rest of 4. PostHog init now races with the public-config query Previously PostHog was initialized synchronously at mount from the bundled config. Now initialization waits on Since 5. Minor: section ordering in Per the repo's "Module Code Order" convention (CLAUDE.md), internal constants belong at the bottom of the file. 6. Backend test: consider asserting against the exact default key — key: expect.stringMatching(/^phc_/),This is fine, but the regex is loose enough that a refactor that accidentally drops the default value and leaves a stray 7. Test gap: no explicit "enabled" env var case — Tests cover 8. Now that the backend is the source of truth, setting 9. Removing the 10. The diff adds Non-issues / things done well
VerdictLGTM with minor suggestions. The two things I'd most like to see addressed before merge are:
Everything else is optional polish. |
🤖 I have created a release *beep* *boop* --- ## [1.2.10](platform-v1.2.9...platform-v1.2.10) (2026-04-11) ### Features * make posthog analytics configurable ([#3707](#3707)) ([7ae9101](7ae9101)) ### Bug Fixes * `/llm/costs` table scrolling ([#3722](#3722)) ([6a42ba8](6a42ba8)) * apply MCP OAuth lifetime for gateway slugs ([#3711](#3711)) ([362aaec](362aaec)) * Bedrock tool name encoding ([#3706](#3706)) ([0e2c2d1](0e2c2d1)) * costs timeframes and surface limit reset settings ([#3709](#3709)) ([6e4154b](6e4154b)) * jira oauth discovery overrides ([#3721](#3721)) ([2c4cf8f](2c4cf8f)) * OIDC discovery trusted origins for IdP registration ([#3714](#3714)) ([adb5f5e](adb5f5e)) * preserve shared chat agents on fork ([#3715](#3715)) ([252edfc](252edfc)) * reranker model dropdown labels ([#3704](#3704)) ([ebd1c8a](ebd1c8a)) * session logs loading state ([#3712](#3712)) ([ffba126](ffba126)) ### Miscellaneous Chores * **ci:** add ID-JAG MCP e2e test ([#3702](#3702)) ([1a5078a](1a5078a)) * **deps:** bump next from 16.1.7 to 16.2.3 in /platform/frontend ([#3708](#3708)) ([d47967c](d47967c)) * use neutral token prefixes with legacy support ([#3719](#3719)) ([db5929c](db5929c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: archestra-ci[bot] <222894074+archestra-ci[bot]@users.noreply.github.com> Co-authored-by: Joey Orlando <joey@archestra.ai>
Summary
ARCHESTRA_ANALYTICS_POSTHOG_KEYandARCHESTRA_ANALYTICS_POSTHOG_HOST, while preserving the existing hosted PostHog defaults.ARCHESTRA_ANALYTICS=disabled.