feat(flags): implement SDK compliance adapter for posthog-elixir#105
Merged
marandaneto merged 4 commits intomainfrom Apr 29, 2026
Merged
feat(flags): implement SDK compliance adapter for posthog-elixir#105marandaneto merged 4 commits intomainfrom
marandaneto merged 4 commits intomainfrom
Conversation
The endpoint constructs the /flags request body the harness contract expects: distinct_id at the top level, distinct_id mirrored into person_properties (the auto-added value the contract asserts on), groups/group_properties defaulting to empty maps, geoip_disable, and flag_keys_to_evaluate scoped to the requested key. The body is then sent through PostHog.FeatureFlags.flags/2 so the SDK's API client auto-injects api_key and (when enabled) gzip-compresses the request. Returns the resolved variant string, the boolean enabled state for boolean flags, or null when the flag is missing from the response. This satisfies request_payload.request_with_person_properties_device_id in the feature_flags suite of the SDK Test Harness.
marandaneto
approved these changes
Apr 28, 2026
Contributor
posthog-elixir Compliance ReportDate: 2026-04-29 09:45:29 UTC ✅ All Tests Passed!30/30 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 1/1 tests passed View Details
|
Member
|
i think codeql is having issues
|
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.
Summary
Extend the existing
sdk_compliance_adapter/so the PostHog SDK Test Harness can exercise the feature flag and capture suites againstposthog-elixir.capture_v0andencoding_gzipcapabilities on/health. The SDK already supports gzip via the defaultReq-based API client and the existing adapter passes the full capture contract — we just hadn't told the harness about it.POST /get_feature_flag, which constructs the/flagsbody the harness contract expects and forwards it throughPostHog.FeatureFlags.flags/2.distinct_idis mirrored intoperson_properties(the auto-added value the contract asserts on).groupsandgroup_propertiesdefault to empty maps.flag_keys_to_evaluateis scoped to the requested key.geoip_disableis forwarded when set.api_keyis auto-injected by the SDK's API client; gzip compression follows the value passed to/init.Test plan
Locally with
docker compose up --build --abort-on-container-exitagainstghcr.io/posthog/sdk-test-harness:latest(digestsha256:a04e04…):The single feature flag test currently in the suite —
request_payload.request_with_person_properties_device_id— passes, including theperson_properties.distinct_idauto-add assertion.Notes
bare_capture, so/capturestill responds with%{success: true}only. The harness validates UUIDs via the trackedrequests_madelist (intercepted bySdkComplianceAdapter.TrackedClient), so all UUID-related capture tests still pass.force_remoteis accepted but has no effect: the SDK has no local-evaluation path yet, so every/get_feature_flagalready issues a fresh remote/flagsrequest.