chore(flags): prefer remote config over flags config parameter#421
chore(flags): prefer remote config over flags config parameter#421
Conversation
posthog-android Compliance ReportDate: 2026-02-18 12:06:50 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 2322ms |
| Format Validation.Event Has Uuid | ✅ | 2023ms |
| Format Validation.Event Has Lib Properties | ✅ | 2021ms |
| Format Validation.Distinct Id Is String | ✅ | 2021ms |
| Format Validation.Token Is Present | ✅ | 2019ms |
| Format Validation.Custom Properties Preserved | ✅ | 2022ms |
| Format Validation.Event Has Timestamp | ✅ | 2020ms |
| Retry Behavior.Retries On 503 | ❌ | 7025ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 4022ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 4023ms |
| Retry Behavior.Respects Retry After Header | ❌ | 7023ms |
| Retry Behavior.Implements Backoff | ❌ | 17022ms |
| Retry Behavior.Retries On 500 | ❌ | 7025ms |
| Retry Behavior.Retries On 502 | ❌ | 7019ms |
| Retry Behavior.Retries On 504 | ❌ | 7024ms |
| Retry Behavior.Max Retries Respected | ❌ | 17033ms |
| Deduplication.Generates Unique Uuids | ✅ | 2036ms |
| Deduplication.Preserves Uuid On Retry | ❌ | 7018ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ❌ | 12026ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ❌ | 7026ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 2031ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 2021ms |
| Compression.Sends Gzip When Enabled | ❌ | 2016ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 2016ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 2013ms |
| Batch Format.Multiple Events Batched Together | ✅ | 2028ms |
| Error Handling.Does Not Retry On 403 | ✅ | 4019ms |
| Error Handling.Does Not Retry On 413 | ❌ | 4020ms |
| Error Handling.Retries On 408 | ✅ | 7025ms |
Failures
retry_behavior.retries_on_503
Expected at least 3 requests, got 1
retry_behavior.respects_retry_after_header
Expected at least 2 requests, got 1
retry_behavior.implements_backoff
Expected at least 3 requests, got 1
retry_behavior.retries_on_500
Expected at least 2 requests, got 1
retry_behavior.retries_on_502
Expected at least 2 requests, got 1
retry_behavior.retries_on_504
Expected at least 2 requests, got 1
retry_behavior.max_retries_respected
Expected 4 requests, got 1
deduplication.preserves_uuid_on_retry
Need at least 2 requests to check retry
deduplication.preserves_uuid_and_timestamp_on_retry
Expected at least 3 requests, got 1
deduplication.preserves_uuid_and_timestamp_on_batch_retry
Expected at least 2 requests, got 1
compression.sends_gzip_when_enabled
Header 'Content-Encoding' with value 'gzip' not found in requests
error_handling.does_not_retry_on_413
Expected 1 requests, got 2
435edda to
6a2bc5f
Compare
Remove `config=true` parameter from the flags endpoint URL. Remote config
(`/array/{apiKey}/config`) is now the sole source for configuration data,
so the flags endpoint only needs to return feature flags.
Also adds `timezone` field to all flags requests, aligning with posthog-js.
Based on PostHog/posthog-js#2895
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
6a2bc5f to
c05b926
Compare
|
so we have this posthog-android/posthog/src/main/java/com/posthog/PostHogConfig.kt Lines 99 to 103 in be77f61 what we can do is to deprecate this and make it a noop, removing it would break builds the only problem i see is that if session replay has changed its flags conditions, eg session recording was enabled and now it is disabled, we wont know unless we call remote config again for every reloadfeatureflags() call. are we ok with keeping session replay running even if it should not or are we ok calling remote config again for every reloadfeatureflags() call? |
- Resolve merge conflict with #415 in CHANGELOG - Deprecate `remoteConfig` config option (now always enabled) - Simplify PostHog.kt to always load remote config
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This follows the same pattern as posthog-js, where:
We're accepting the same tradeoff here: session replay config staleness until app restart. I think this is a reasonable tradeoff because:
If we wanted session replay config to be more responsive, we could add periodic remote config refresh (e.g., every 5 minutes), but that adds complexity and battery/network overhead for a rare scenario. We can always add that later if it becomes a real need. TL;DR – let's do it this way for now. But open to pushback! |
The remoteConfig option is deprecated but still functional. Making it a complete no-op would require significant test updates. For now, the option works as before but shows a deprecation warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| init { | ||
| this["api_key"] = apiKey | ||
| this["distinct_id"] = distinctId | ||
| this["timezone"] = TimeZone.getDefault().id |
There was a problem hiding this comment.
whats the expectation here? this would return eg Europe/Vienna
|
@ioannisj can you review this since i've done many changes to account for the behaviour changes |
Summary
config=trueparameter from the flags endpoint URL (/flags/?v=2instead of/flags/?v=2&config=true)timezonefield to all flags requestsremoteConfigconfig option and make it a no-op (remote config is now always loaded)Remote config (
/array/{apiKey}/config) is now the sole source for configuration data, so the flags endpoint only needs to return feature flags. This aligns the Android SDK with the direction being taken in posthog-js.Based on PostHog/posthog-js#2895
Changes
PostHogApi.ktconfig=truefrom flags URLPostHogFlagsRequest.kttimezonefield (usesTimeZone.getDefault().id)PostHogConfig.kt(posthog)remoteConfigoptionPostHogConfig.kt(posthog-server)remoteConfigoptionPostHog.kt@Suppress("DEPRECATION")Notes
This follows the same pattern as posthog-js:
reloadFeatureFlags()only reloads feature flags, not the full remote configThis is an acceptable tradeoff for simplicity and reduced API calls.
Test plan