Skip to content

feat!: enable surveys by default - #984

Open
turnipdabeets wants to merge 2 commits into
chore/v4-remove-deprecatedfrom
feat/v4-surveys-default-on
Open

turnipdabeets wants to merge 2 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-16T16:52:55.618700+00:00
Duration: 475371ms

✅ 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 ✅ 383ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 41ms
Required Headers.Has Authorization Bearer Header ✅ 36ms
Required Headers.Has Content Type Json ✅ 28ms
Required Headers.Has Posthog Sdk Info Format ✅ 24ms
Required Headers.Has Posthog Attempt Header ✅ 33ms
Required Headers.Has Posthog Request Id ✅ 28ms
Required Headers.Has Posthog Request Timestamp ✅ 31ms
Required Headers.Has User Agent ✅ 29ms
Body Format.Body Has Created At And Batch ✅ 29ms
Body Format.No Api Key In Body ✅ 22ms
Body Format.No Sent At In Body ✅ 25ms
Event Format.Event Has Required Root Fields ✅ 22ms
Event Format.Event Uuid Is Valid ✅ 23ms
Event Format.Event Timestamp Is Rfc3339 ✅ 32ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 23ms
Event Format.Distinct Id Is String ✅ 21ms
Event Format.Distinct Id At Root Not Properties ✅ 24ms
Event Format.Custom Properties Preserved ✅ 25ms
Event Format.Set Properties Preserved ✅ 26ms
Event Format.Set Once Properties Preserved ✅ 25ms
Event Format.Groups Properties Preserved ✅ 24ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 19ms
Event Format.Event Has Required Root Fields Batch ✅ 40ms
Event Format.Event Uuid Is Valid Batch ✅ 30ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 29ms
Event Format.Distinct Id Is String Batch ✅ 25ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 26ms
Event Format.Custom Properties Preserved Batch ✅ 31ms
Event Format.Set Properties Preserved Batch ✅ 30ms
Event Format.Set Once Properties Preserved Batch ✅ 30ms
Event Format.Groups Properties Preserved Batch ✅ 43ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 37ms
Batch Behavior.Multiple Events In Single Batch ✅ 38ms
Batch Behavior.Batch Envelope Smoke ✅ 40ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 16ms
Batch Behavior.Flush At Triggers Batch ✅ 1026ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 21ms
Deduplication.Generates Unique Uuids ✅ 45ms
Deduplication.Different Events Same Content Different Uuids ✅ 25ms
Deduplication.Preserves Uuid On Retry ✅ 7014ms
Deduplication.Preserves Timestamp On Retry ✅ 7022ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7024ms
Deduplication.No Duplicate Events In Batch ✅ 34ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 18ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12024ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7019ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2029ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7018ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 22ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 28ms
Response Format Validation.Success No Retry After When All Ok ✅ 32ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2012ms
Response Format Validation.Success No Retry After When Drop Only ✅ 26ms
Response Format Validation.Response Echoes Request Id ✅ 18ms
Retry Behavior.Retries On 408 ✅ 7017ms
Retry Behavior.Retries On 500 ✅ 7017ms
Retry Behavior.Retries On 503 ✅ 7028ms
Retry Behavior.Retries On 504 ✅ 7026ms
Retry Behavior.Retries On 404 ✅ 6020ms
Retry Behavior.Retries On 429 ✅ 6013ms
Retry Behavior.Retries On 502 ✅ 6020ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4018ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10029ms
Retry Behavior.Does Not Retry On 400 ✅ 4023ms
Retry Behavior.Does Not Retry On 401 ✅ 4026ms
Retry Behavior.Does Not Retry On 402 ✅ 4022ms
Retry Behavior.Does Not Retry On 413 ✅ 4023ms
Retry Behavior.Does Not Retry On 415 ✅ 4025ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4023ms
Retry Behavior.Implements Backoff ✅ 14029ms
Partial Batch Handling.Handles 200 Full Success ✅ 2020ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3035ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3028ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3032ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7025ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7017ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7017ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7015ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7017ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7018ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7035ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3024ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3033ms
Compression.Sends Gzip Content Encoding ✅ 18ms
Compression.No Content Encoding When Disabled ✅ 18ms
Compression.Compressed Body Is Decompressible ✅ 18ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4024ms
Event Options.Cookieless Mode Override ✅ 17ms
Event Options.Disable Skew Correction Override ✅ 16ms
Event Options.Process Person Profile Override ✅ 21ms
Event Options.Product Tour Id Override ✅ 15ms
Event Options.Unset Options Omitted ✅ 15ms
Event Options.Options Override In Batch ✅ 27ms
Event Options.Unknown Option Passes Through ✅ 17ms
Event Options.Option Value Is Not Converted ✅ 17ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 20ms
Event Options.Option Wins Over Legacy Property ✅ 16ms
Event Options.Legacy Property Fills Unset Option ✅ 18ms
Event Options.Null Option Falls Back To Legacy Property ✅ 23ms
Property Layers.Caller Property Beats Registered Property ✅ 19ms
Property Layers.Before Send Runs Last ✅ 20ms
Fail Open.Empty Api Key Sends Nothing ✅ 3013ms
Fail Open.Personal Api Key Sends Nothing ✅ 3013ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 19ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 25ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 22ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 16ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 23ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 7024ms
Required Headers.Has Authorization Bearer Header ✅ 18ms
Required Headers.Has Content Type Json ✅ 24ms
Required Headers.Has Posthog Sdk Info Format ✅ 16ms
Required Headers.Has Posthog Attempt Header ✅ 15ms
Required Headers.Has Posthog Request Id ✅ 22ms
Required Headers.Has Posthog Request Timestamp ✅ 21ms
Required Headers.Has User Agent ✅ 20ms
Body Format.Body Has Created At And Batch ✅ 18ms
Body Format.No Api Key In Body ✅ 19ms
Body Format.No Sent At In Body ✅ 22ms
Event Format.Event Has Required Root Fields ✅ 21ms
Event Format.Event Uuid Is Valid ✅ 22ms
Event Format.Event Timestamp Is Rfc3339 ✅ 15ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 19ms
Event Format.Distinct Id Is String ✅ 17ms
Event Format.Distinct Id At Root Not Properties ✅ 26ms
Event Format.Custom Properties Preserved ✅ 16ms
Event Format.Set Properties Preserved ✅ 15ms
Event Format.Set Once Properties Preserved ✅ 17ms
Event Format.Groups Properties Preserved ✅ 18ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 15ms
Event Format.Event Has Required Root Fields Batch ✅ 21ms
Event Format.Event Uuid Is Valid Batch ✅ 26ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 27ms
Event Format.Distinct Id Is String Batch ✅ 21ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 23ms
Event Format.Custom Properties Preserved Batch ✅ 25ms
Event Format.Set Properties Preserved Batch ✅ 24ms
Event Format.Set Once Properties Preserved Batch ✅ 27ms
Event Format.Groups Properties Preserved Batch ✅ 33ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 23ms
Batch Behavior.Multiple Events In Single Batch ✅ 29ms
Batch Behavior.Batch Envelope Smoke ✅ 24ms
Batch Behavior.Flush At Triggers Batch ✅ 1020ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 20ms
Deduplication.Generates Unique Uuids ✅ 43ms
Deduplication.Different Events Same Content Different Uuids ✅ 19ms
Deduplication.Preserves Uuid On Retry ✅ 7014ms
Deduplication.Preserves Timestamp On Retry ✅ 7016ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7017ms
Deduplication.No Duplicate Events In Batch ✅ 30ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 23ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12020ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7020ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2028ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7021ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 19ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 24ms
Response Format Validation.Success No Retry After When All Ok ✅ 25ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2010ms
Response Format Validation.Success No Retry After When Drop Only ✅ 34ms
Response Format Validation.Response Echoes Request Id ✅ 27ms
Retry Behavior.Retries On 408 ✅ 7018ms
Retry Behavior.Retries On 500 ✅ 7015ms
Retry Behavior.Retries On 503 ✅ 7036ms
Retry Behavior.Retries On 504 ✅ 7017ms
Retry Behavior.Retries On 404 ✅ 7017ms
Retry Behavior.Retries On 429 ✅ 7020ms
Retry Behavior.Retries On 502 ✅ 6019ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4014ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10023ms
Retry Behavior.Does Not Retry On 400 ✅ 4021ms
Retry Behavior.Does Not Retry On 401 ✅ 4021ms
Retry Behavior.Does Not Retry On 402 ✅ 4022ms
Retry Behavior.Does Not Retry On 413 ✅ 4018ms
Retry Behavior.Does Not Retry On 415 ✅ 4020ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4030ms
Retry Behavior.Implements Backoff ✅ 14030ms
Partial Batch Handling.Handles 200 Full Success ✅ 2023ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3027ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3028ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3024ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7015ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7018ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7011ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7022ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7017ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7017ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7026ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3029ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3037ms
Compression.Sends Gzip Content Encoding ✅ 18ms
Compression.No Content Encoding When Disabled ✅ 19ms
Compression.Compressed Body Is Decompressible ✅ 21ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4019ms
Event Options.Cookieless Mode Override ✅ 15ms
Event Options.Disable Skew Correction Override ✅ 14ms
Event Options.Process Person Profile Override ✅ 13ms
Event Options.Product Tour Id Override ✅ 15ms
Event Options.Unset Options Omitted ✅ 15ms
Event Options.Options Override In Batch ✅ 25ms
Event Options.Unknown Option Passes Through ✅ 17ms
Event Options.Option Value Is Not Converted ✅ 20ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 18ms
Event Options.Option Wins Over Legacy Property ✅ 16ms
Event Options.Legacy Property Fills Unset Option ✅ 17ms
Event Options.Null Option Falls Back To Legacy Property ✅ 19ms
Event Size.Event Over Ceiling Is Not Sent ✅ 3473ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2058ms
Event Size.Batches Close Before Byte Target ✅ 6089ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 19ms
Property Layers.Caller Property Beats Registered Property ✅ 18ms
Property Layers.Before Send Runs Last ✅ 17ms
Fail Open.Empty Api Key Sends Nothing ✅ 1010ms
Fail Open.Personal Api Key Sends Nothing ✅ 1011ms

Feature_Flags Tests

✅ 17/17 tests passed

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

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.

This branch has not been deployed

No deployments
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