fix: Clear feature flag called cache on close#585
Merged
Conversation
|
Reviews (1): Last reviewed commit: "fix: Clear feature flag called cache on ..." | Re-trigger Greptile |
Contributor
posthog-android Compliance ReportDate: 2026-06-24 17:47:50 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 330ms |
| Format Validation.Event Has Uuid | ✅ | 27ms |
| Format Validation.Event Has Lib Properties | ✅ | 27ms |
| Format Validation.Distinct Id Is String | ✅ | 29ms |
| Format Validation.Token Is Present | ✅ | 27ms |
| Format Validation.Custom Properties Preserved | ✅ | 24ms |
| Format Validation.Event Has Timestamp | ✅ | 25ms |
| Retry Behavior.Retries On 503 | ✅ | 7021ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 4022ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 4022ms |
| Retry Behavior.Respects Retry After Header | ✅ | 7026ms |
| Retry Behavior.Implements Backoff | ✅ | 17035ms |
| Retry Behavior.Retries On 500 | ✅ | 7013ms |
| Retry Behavior.Retries On 502 | ✅ | 7020ms |
| Retry Behavior.Retries On 504 | ✅ | 7020ms |
| Retry Behavior.Max Retries Respected | ✅ | 17022ms |
| Deduplication.Generates Unique Uuids | ✅ | 38ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 7012ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ✅ | 12028ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 7016ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 32ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 24ms |
| Compression.Sends Gzip When Enabled | ✅ | 18ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 16ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 11ms |
| Batch Format.Multiple Events Batched Together | ✅ | 30ms |
| Error Handling.Does Not Retry On 403 | ✅ | 4017ms |
| Error Handling.Does Not Retry On 413 | ❌ | 4014ms |
| Error Handling.Retries On 408 | ✅ | 5029ms |
Failures
error_handling.does_not_retry_on_413
Expected 1 requests, got 2
Feature_Flags Tests
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ❌ | 31ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 19ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 22ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 22ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 24ms |
| Request Payload.Groups Round Trip | ✅ | 20ms |
| Request Payload.Groups Default To Empty Object | ❌ | 23ms |
| Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It | ❌ | 22ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ❌ | 21ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ❌ | 20ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ❌ | 19ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 9ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 26ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 2025ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 19ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 20ms |
Failures
request_payload.request_with_person_properties_device_id
Expected distinct_id='test_user_123', got '019efabe-cb72-7be6-8d6a-b82fa642725e'
request_payload.groups_default_to_empty_object
Field 'groups' not found in /flags request body at path 'groups'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']
request_payload.person_properties_distinct_id_auto_populated_when_caller_omits_it
Field 'distinct_id' not found in /flags request body at path 'person_properties.distinct_id'. Available keys: ['$lib', '$lib_version', 'email']
request_payload.disable_geoip_false_propagates_as_geoip_disable_false
Field 'geoip_disable' not found in /flags request body at path 'geoip_disable'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']
request_payload.disable_geoip_omitted_defaults_to_false
Field 'geoip_disable' not found in /flags request body at path 'geoip_disable'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']
request_payload.flag_keys_to_evaluate_contains_only_requested_key
Field 'flag_keys_to_evaluate' not found in /flags request body at path 'flag_keys_to_evaluate'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']
marandaneto
commented
Jun 24, 2026
marandaneto
commented
Jun 24, 2026
|
Reviews (2): Last reviewed commit: "chore: update flag cache changeset" | Re-trigger Greptile |
dustinbyrne
approved these changes
Jun 24, 2026
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.
💡 Motivation and Context
PostHogStateless.close()shut down the queue and feature flag provider but left the in-memory feature flag called cache populated. If the same SDK instance is closed and set up again, stale cache entries can suppress future$feature_flag_calledevents for values that were only seen before shutdown.This PR clears the feature flag called cache during close and adds regression coverage for that behavior.
💚 How did you test it?
make stop && ./gradlew :posthog:test --tests "com.posthog.PostHogStatelessTest.close clears feature flag called cache"make checkFormat📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
An OpenAI API coding agent prepared this PR using the existing dedicated
fix/ff-called-cache-shutdownworktree. The branch was fast-forwarded to the latestmainbefore committing because it was behind the base branch.The implementation is intentionally narrow: clear the existing feature flag called cache during SDK close, add a regression test, and add a patch changeset for the affected release packages.