chore: update endpoint for flags local eval#509
Merged
patricio-posthog merged 2 commits intomainfrom Apr 15, 2026
Merged
Conversation
Contributor
Prompt To Fix All With AIThis is a comment left during a code review.
Path: posthog/test/test_feature_flags.py
Line: 3782
Comment:
**No test for new `/flags/definitions` URL**
`TestLocalEvalEndpointConfig` was the only test asserting what URL `_fetch_feature_flags_from_api` passes to `get()`. Now that it is removed there is nothing to prevent a silent regression if the hardcoded path is accidentally changed. A minimal parameterised replacement (even a single case) that checks `patch_get.call_args[0][1].startswith("/flags/definitions?")` would close this gap while keeping the test suite honest about the URL the SDK actually calls.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "chore: update endpoint for flags local e..." | Re-trigger Greptile |
Contributor
posthog-python Compliance ReportDate: 2026-04-15 15:16:34 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 516ms |
| Format Validation.Event Has Uuid | ✅ | 1506ms |
| Format Validation.Event Has Lib Properties | ✅ | 1506ms |
| Format Validation.Distinct Id Is String | ✅ | 1507ms |
| Format Validation.Token Is Present | ✅ | 1505ms |
| Format Validation.Custom Properties Preserved | ✅ | 1505ms |
| Format Validation.Event Has Timestamp | ✅ | 1505ms |
| Retry Behavior.Retries On 503 | ✅ | 9517ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 3506ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 3508ms |
| Retry Behavior.Respects Retry After Header | ✅ | 9513ms |
| Retry Behavior.Implements Backoff | ✅ | 23519ms |
| Retry Behavior.Retries On 500 | ✅ | 7509ms |
| Retry Behavior.Retries On 502 | ✅ | 7509ms |
| Retry Behavior.Retries On 504 | ✅ | 7505ms |
| Retry Behavior.Max Retries Respected | ✅ | 23521ms |
| Deduplication.Generates Unique Uuids | ✅ | 1508ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 7510ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ✅ | 14525ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 7507ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 1502ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 1508ms |
| Compression.Sends Gzip When Enabled | ✅ | 1506ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 1507ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 1004ms |
| Batch Format.Multiple Events Batched Together | ✅ | 1504ms |
| Error Handling.Does Not Retry On 403 | ✅ | 3509ms |
| Error Handling.Does Not Retry On 413 | ✅ | 3507ms |
| Error Handling.Retries On 408 | ✅ | 7509ms |
Feature_Flags Tests
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ❌ | 506ms |
Failures
request_payload.request_with_person_properties_device_id
404, message='NOT FOUND', url='http://sdk-adapter:8080/get_feature_flag'
marandaneto
approved these changes
Apr 15, 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
The Rust feature flags definitions fleet now serves 100% of
/api/feature_flag/local_evaluationtraffic in all environments (dev, prod-us, prod-eu) via Contour weighted routing. We saw zero errors after ramping 10% → 50% → 100% over the past week.This PR switches the SDK's default polling URL from the legacy Django path (
/api/feature_flag/local_evaluation/) to the Rust endpoint's native path (/flags/definitions). This also removes the intermediatePOSTHOG_LOCAL_EVALUATION_ENDPOINTenv var override and fallback logic that were added as temporary migration scaffolding.The old
/api/feature_flag/local_evaluationpath remains registered as a route alias on the Rust service, so older SDK versions continue to work.💚 How did you test it?
TestLocalEvalEndpointConfigclass tested the env var/fallback machinery that no longer exists)/flags/definitionsendpoint has been serving production traffic since 2026-04-09 (PostHog internal SDK) and 100% of external traffic since 2026-04-15📝 Checklist
If releasing new changes
sampo addto generate a changeset filereleaselabel to the PR