Skip to content

fix(analytics): Harden analytics setup#2594

Draft
charlesvien wants to merge 1 commit into
mainfrom
06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option
Draft

fix(analytics): Harden analytics setup#2594
charlesvien wants to merge 1 commit into
mainfrom
06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option

Conversation

@charlesvien

@charlesvien charlesvien commented Jun 11, 2026

Copy link
Copy Markdown
Member

Changes

  1. Pass main-minted session id via additionalArguments and init PostHog synchronously
  2. Bind AnalyticsBootContribution first so init runs before render and all effects
  3. Gate boot-time analytics reset on bootstrapComplete to stop wiping the persisted distinct_id
  4. Fire buffered flag listeners at init so cached flag values apply without waiting for /flags
  5. Remove now-unused getSessionId tRPC procedure
  6. Add tests for the reset gate and listener buffering

How did you test this?

Manually

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

charlesvien commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

React Doctor could not complete this scan.

No React dependency found in /tmp/react-doctor-baseline-ZGKVfn/package.json. Add "react" to dependencies (or peerDependencies) and re-run.

Reviewed by React Doctor for commit 58f22c0.

@charlesvien charlesvien marked this pull request as ready for review June 11, 2026 08:06
@charlesvien charlesvien force-pushed the 06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option branch from 0b565fc to 3e04f1c Compare June 11, 2026 08:08
@charlesvien charlesvien force-pushed the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch from b815015 to 1430655 Compare June 11, 2026 08:08
@charlesvien charlesvien changed the title fix(analytics): Fix feature flag race hiding the Cloud option fix(analytics): Harden analytics setup Jun 11, 2026
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

T-Rex T-Rex Logs

What T-Rex did

  • Traced the session-id flow from the Electron main process through preload exposure to renderer initialization to confirm correct argument handling.
  • Verified the analytics boot contribution is bound first and that contributions are executed in sequence so PostHog initializes before other renderer contributions.
  • Examined feature-flag listener buffering, including pre-init subscribe, unsubscribe before and after init, and delivery of cached flags.
  • Validated the useAuthIdentitySync gate ensuring analytics reset is skipped while the auth bootstrap is incomplete.
  • Attempted to run existing tests with vitest but the run was blocked by Node version incompatibility with the repository toolchain.
  • Created a targeted analytics boot and feature flag validation notes artifact to document the checks.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(analytics): Fix feature flag race hi..." | Re-trigger Greptile

@charlesvien charlesvien marked this pull request as draft June 11, 2026 08:36
@charlesvien charlesvien force-pushed the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch 2 times, most recently from 0cefecf to 78f207b Compare June 11, 2026 09:04
@charlesvien charlesvien force-pushed the 06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option branch from 3e04f1c to 081582a Compare June 11, 2026 09:04
@charlesvien charlesvien changed the base branch from 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 to graphite-base/2594 June 11, 2026 09:13
@charlesvien charlesvien force-pushed the 06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option branch from 081582a to f42178f Compare June 11, 2026 09:13
@graphite-app graphite-app Bot changed the base branch from graphite-base/2594 to main June 11, 2026 09:14
@charlesvien charlesvien force-pushed the 06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option branch from f42178f to bcba098 Compare June 11, 2026 09:14
@charlesvien charlesvien force-pushed the 06-11-fix_analytics_fix_feature_flag_race_hiding_the_cloud_option branch from bcba098 to 58f22c0 Compare June 11, 2026 20:17
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.

1 participant