Skip to content

feat!: enable surveys by default - #984

Merged
turnipdabeets merged 3 commits into
chore/v4-remove-deprecatedfrom
feat/v4-surveys-default-on
Nov 16, 2026
Merged

turnipdabeets merged 3 commits into
chore/v4-remove-deprecatedfrom
feat/v4-surveys-default-on

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Flips PostHogConfig.surveys to default to true in 4.0, following up on this comment on posthog-kmp#125: sync config defaults across the mobile SDKs.

Android is the only SDK that defaults surveys off:

SDK surveys default
iOS true
Flutter true
React Native true (disableSurveys = false)
Web true
KMP (posthog-kmp#125) true
Android 3.x false

false made sense when Android had no built-in survey UI and the flag only existed so hybrid SDKs could attach their own display logic. Now that posthog-android-surveys-compose (#541) provides that UI, the default just means adding the module isn't enough on its own; you also have to find and flip the flag.

What changes for apps:

  • No compose module, no custom delegate: nothing visible. The SDK keeps the survey definitions from remote config and installs PostHogSurveysIntegration. The integration then skips matching (bb699a9), since PostHogSurveysDefaultDelegate only logs. Without that check, a flag-linked survey would send $feature_flag_called and run property-filter regexes on capture() for surveys nobody can see.
  • Compose module or custom surveysDelegate: matching surveys start showing. Those apps almost certainly set surveys = true already, because the module did nothing without it. The rare app that added the module but kept surveys off on purpose needs surveys = false; that's covered in MIGRATION.md ("Check surveys").
  • posthog-server: unaffected, it uses its own flags provider and never processes surveys.

Also rewrites the KDoc, which still said "Intended for internal use only… Defaults to false", and drops the now-redundant surveys = true from the sample app.

💚 How did you test it?

  • Added surveys is enabled by default to PostHogConfigTest.
  • Added PostHogSurveysNoRendererTest. It fails without bb699a9 (isFeatureEnabled called) and passes with it. PostHogSurveysEventPropertyFilterTest now sets a mock delegate, as the other survey tests already do.
  • ./gradlew :posthog:test :posthog-server:test :posthog-android:testDebugUnitTest :posthog-android-surveys-compose:testDebugUnitTest, spotlessCheck and apiDump (no API change) pass locally.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Claude Code compared config defaults across the Android, iOS, Flutter, React Native and KMP SDKs, then traced what surveys = true does on Android: remote config survey caching, PostHogSurveysIntegration, and delegate discovery.
  • Targets the 4.0 branch (feat!: posthog-android 4.0 and posthog 7.0 #871) rather than main, since a default flip is a behavior change.
  • Follow-up outside this repo: the posthog.com Android surveys docs that tell users to set surveys = true.

🤖 Generated with Claude Code

Match the iOS, Flutter, React Native, web and KMP SDKs. Surveys still
display only with posthog-android-surveys-compose or a custom
surveysDelegate.
@turnipdabeets
turnipdabeets requested a review from a team as a code owner November 16, 2026 16:10
@turnipdabeets turnipdabeets self-assigned this Nov 16, 2026
@veria-ai

veria-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Reviews

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed be906a4: 1 Should fix.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

posthog-android Compliance Report

Date: 2026-11-16T18:33:11.130758+00:00
Duration: 474219ms

✅ All Tests Passed!

232/232 tests passed


Capture_V1 Tests

✅ 105/105 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 313ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 25ms
Required Headers.Has Authorization Bearer Header ✅ 23ms
Required Headers.Has Content Type Json ✅ 23ms
Required Headers.Has Posthog Sdk Info Format ✅ 20ms
Required Headers.Has Posthog Attempt Header ✅ 19ms
Required Headers.Has Posthog Request Id ✅ 17ms
Required Headers.Has Posthog Request Timestamp ✅ 22ms
Required Headers.Has User Agent ✅ 19ms
Body Format.Body Has Created At And Batch ✅ 18ms
Body Format.No Api Key In Body ✅ 17ms
Body Format.No Sent At In Body ✅ 15ms
Event Format.Event Has Required Root Fields ✅ 18ms
Event Format.Event Uuid Is Valid ✅ 16ms
Event Format.Event Timestamp Is Rfc3339 ✅ 16ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 19ms
Event Format.Distinct Id Is String ✅ 15ms
Event Format.Distinct Id At Root Not Properties ✅ 17ms
Event Format.Custom Properties Preserved ✅ 18ms
Event Format.Set Properties Preserved ✅ 19ms
Event Format.Set Once Properties Preserved ✅ 18ms
Event Format.Groups Properties Preserved ✅ 15ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 16ms
Event Format.Event Has Required Root Fields Batch ✅ 23ms
Event Format.Event Uuid Is Valid Batch ✅ 21ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 20ms
Event Format.Distinct Id Is String Batch ✅ 19ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 20ms
Event Format.Custom Properties Preserved Batch ✅ 21ms
Event Format.Set Properties Preserved Batch ✅ 22ms
Event Format.Set Once Properties Preserved Batch ✅ 21ms
Event Format.Groups Properties Preserved Batch ✅ 20ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 30ms
Batch Behavior.Multiple Events In Single Batch ✅ 23ms
Batch Behavior.Batch Envelope Smoke ✅ 22ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 12ms
Batch Behavior.Flush At Triggers Batch ✅ 1018ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 16ms
Deduplication.Generates Unique Uuids ✅ 26ms
Deduplication.Different Events Same Content Different Uuids ✅ 17ms
Deduplication.Preserves Uuid On Retry ✅ 7015ms
Deduplication.Preserves Timestamp On Retry ✅ 7016ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7019ms
Deduplication.No Duplicate Events In Batch ✅ 26ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 12ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12023ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7016ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2021ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7014ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 14ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 17ms
Response Format Validation.Success No Retry After When All Ok ✅ 18ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2009ms
Response Format Validation.Success No Retry After When Drop Only ✅ 14ms
Response Format Validation.Response Echoes Request Id ✅ 12ms
Retry Behavior.Retries On 408 ✅ 7013ms
Retry Behavior.Retries On 500 ✅ 7015ms
Retry Behavior.Retries On 503 ✅ 7017ms
Retry Behavior.Retries On 504 ✅ 7015ms
Retry Behavior.Retries On 404 ✅ 6015ms
Retry Behavior.Retries On 429 ✅ 7013ms
Retry Behavior.Retries On 502 ✅ 7013ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4013ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10023ms
Retry Behavior.Does Not Retry On 400 ✅ 4016ms
Retry Behavior.Does Not Retry On 401 ✅ 4016ms
Retry Behavior.Does Not Retry On 402 ✅ 4016ms
Retry Behavior.Does Not Retry On 413 ✅ 4015ms
Retry Behavior.Does Not Retry On 415 ✅ 4017ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4016ms
Retry Behavior.Implements Backoff ✅ 14014ms
Partial Batch Handling.Handles 200 Full Success ✅ 2016ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3022ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3018ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3017ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7015ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7013ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7015ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7014ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7014ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7015ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7020ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3018ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3021ms
Compression.Sends Gzip Content Encoding ✅ 13ms
Compression.No Content Encoding When Disabled ✅ 12ms
Compression.Compressed Body Is Decompressible ✅ 11ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4013ms
Event Options.Cookieless Mode Override ✅ 11ms
Event Options.Disable Skew Correction Override ✅ 10ms
Event Options.Process Person Profile Override ✅ 12ms
Event Options.Product Tour Id Override ✅ 14ms
Event Options.Unset Options Omitted ✅ 12ms
Event Options.Options Override In Batch ✅ 15ms
Event Options.Unknown Option Passes Through ✅ 12ms
Event Options.Option Value Is Not Converted ✅ 11ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 12ms
Event Options.Option Wins Over Legacy Property ✅ 11ms
Event Options.Legacy Property Fills Unset Option ✅ 12ms
Event Options.Null Option Falls Back To Legacy Property ✅ 12ms
Property Layers.Caller Property Beats Registered Property ✅ 13ms
Property Layers.Before Send Runs Last ✅ 11ms
Fail Open.Empty Api Key Sends Nothing ✅ 3009ms
Fail Open.Personal Api Key Sends Nothing ✅ 3010ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 12ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 12ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 10ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 12ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 13ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 7022ms
Required Headers.Has Authorization Bearer Header ✅ 13ms
Required Headers.Has Content Type Json ✅ 13ms
Required Headers.Has Posthog Sdk Info Format ✅ 14ms
Required Headers.Has Posthog Attempt Header ✅ 10ms
Required Headers.Has Posthog Request Id ✅ 10ms
Required Headers.Has Posthog Request Timestamp ✅ 12ms
Required Headers.Has User Agent ✅ 13ms
Body Format.Body Has Created At And Batch ✅ 13ms
Body Format.No Api Key In Body ✅ 11ms
Body Format.No Sent At In Body ✅ 12ms
Event Format.Event Has Required Root Fields ✅ 10ms
Event Format.Event Uuid Is Valid ✅ 12ms
Event Format.Event Timestamp Is Rfc3339 ✅ 11ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 12ms
Event Format.Distinct Id Is String ✅ 11ms
Event Format.Distinct Id At Root Not Properties ✅ 9ms
Event Format.Custom Properties Preserved ✅ 13ms
Event Format.Set Properties Preserved ✅ 13ms
Event Format.Set Once Properties Preserved ✅ 11ms
Event Format.Groups Properties Preserved ✅ 11ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 14ms
Event Format.Event Has Required Root Fields Batch ✅ 16ms
Event Format.Event Uuid Is Valid Batch ✅ 15ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 21ms
Event Format.Distinct Id Is String Batch ✅ 18ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 21ms
Event Format.Custom Properties Preserved Batch ✅ 18ms
Event Format.Set Properties Preserved Batch ✅ 21ms
Event Format.Set Once Properties Preserved Batch ✅ 18ms
Event Format.Groups Properties Preserved Batch ✅ 21ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 20ms
Batch Behavior.Multiple Events In Single Batch ✅ 24ms
Batch Behavior.Batch Envelope Smoke ✅ 18ms
Batch Behavior.Flush At Triggers Batch ✅ 1016ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 12ms
Deduplication.Generates Unique Uuids ✅ 21ms
Deduplication.Different Events Same Content Different Uuids ✅ 13ms
Deduplication.Preserves Uuid On Retry ✅ 7012ms
Deduplication.Preserves Timestamp On Retry ✅ 7014ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7015ms
Deduplication.No Duplicate Events In Batch ✅ 20ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 12ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12015ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7014ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2020ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7015ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 11ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 15ms
Response Format Validation.Success No Retry After When All Ok ✅ 14ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2008ms
Response Format Validation.Success No Retry After When Drop Only ✅ 14ms
Response Format Validation.Response Echoes Request Id ✅ 8ms
Retry Behavior.Retries On 408 ✅ 7013ms
Retry Behavior.Retries On 500 ✅ 7012ms
Retry Behavior.Retries On 503 ✅ 7019ms
Retry Behavior.Retries On 504 ✅ 7014ms
Retry Behavior.Retries On 404 ✅ 7013ms
Retry Behavior.Retries On 429 ✅ 6014ms
Retry Behavior.Retries On 502 ✅ 6013ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4011ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10016ms
Retry Behavior.Does Not Retry On 400 ✅ 4015ms
Retry Behavior.Does Not Retry On 401 ✅ 4013ms
Retry Behavior.Does Not Retry On 402 ✅ 4013ms
Retry Behavior.Does Not Retry On 413 ✅ 4014ms
Retry Behavior.Does Not Retry On 415 ✅ 4014ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4013ms
Retry Behavior.Implements Backoff ✅ 14020ms
Partial Batch Handling.Handles 200 Full Success ✅ 2012ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3018ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3018ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3018ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7014ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7014ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7010ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7014ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7013ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7013ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7018ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3016ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3021ms
Compression.Sends Gzip Content Encoding ✅ 12ms
Compression.No Content Encoding When Disabled ✅ 14ms
Compression.Compressed Body Is Decompressible ✅ 13ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4012ms
Event Options.Cookieless Mode Override ✅ 11ms
Event Options.Disable Skew Correction Override ✅ 9ms
Event Options.Process Person Profile Override ✅ 10ms
Event Options.Product Tour Id Override ✅ 10ms
Event Options.Unset Options Omitted ✅ 10ms
Event Options.Options Override In Batch ✅ 12ms
Event Options.Unknown Option Passes Through ✅ 11ms
Event Options.Option Value Is Not Converted ✅ 12ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 12ms
Event Options.Option Wins Over Legacy Property ✅ 11ms
Event Options.Legacy Property Fills Unset Option ✅ 9ms
Event Options.Null Option Falls Back To Legacy Property ✅ 11ms
Event Size.Event Over Ceiling Is Not Sent ✅ 3285ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2044ms
Event Size.Batches Close Before Byte Target ✅ 6077ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 13ms
Property Layers.Caller Property Beats Registered Property ✅ 9ms
Property Layers.Before Send Runs Last ✅ 10ms
Fail Open.Empty Api Key Sends Nothing ✅ 1007ms
Fail Open.Personal Api Key Sends Nothing ✅ 1007ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 26ms
Request Payload.Flags Request Uses V2 Query Param ✅ 14ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 14ms
Request Payload.Flags Request Omits Authorization Header ✅ 13ms
Request Payload.Token In Flags Body Matches Init ✅ 11ms
Request Payload.Groups Round Trip ✅ 13ms
Request Payload.Groups Default To Empty Object ✅ 12ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 14ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 10ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 13ms
Request Lifecycle.No Flags Request On Init Alone ✅ 6ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 10ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 17ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 13ms
Retry Behavior.Retries Flags On 502 ✅ 314ms
Retry Behavior.Retries Flags On 504 ✅ 313ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 12ms

turnipdabeets and others added 2 commits November 16, 2026 11:39
Without posthog-android-surveys-compose or a custom surveysDelegate, the default delegate only logs, so matching evaluated linked flags (capturing $feature_flag_called) and property-filter regexes for surveys nobody could see.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turnipdabeets
turnipdabeets merged commit 3625302 into chore/v4-remove-deprecated Nov 16, 2026
12 checks passed
@turnipdabeets
turnipdabeets deleted the feat/v4-surveys-default-on branch November 16, 2026 18:36
turnipdabeets added a commit that referenced this pull request Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants