Skip to content

fix: keep flag payload reads out of only_accessed#112

Merged
dustinbyrne merged 1 commit into
mainfrom
fix/get-flag-payload-only-accessed
May 5, 2026
Merged

fix: keep flag payload reads out of only_accessed#112
dustinbyrne merged 1 commit into
mainfrom
fix/get-flag-payload-only-accessed

Conversation

@dustinbyrne
Copy link
Copy Markdown
Contributor

💡 Motivation and Context

get_flag_payload/2 should be a silent payload lookup. Other server-side SDKs (Python/Node/PHP) document and implement payload reads as not counting for only_accessed, but the Elixir SDK was recording those reads as accesses. That meant only_accessed/1 could attach flags that code only fetched payloads for, not flags it branched on.

This aligns Elixir with the server-side SDK behavior by keeping get_flag_payload/2 out of the accessed set.

💚 How did you test it?

  • mix format
  • mix test
  • mix credo --strict

📝 Checklist

  • 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 sampo add to generate a changeset file
    • Added .sampo/changesets/silent-payload-access.md manually because the sampo CLI is not installed locally.

@github-project-automation github-project-automation Bot moved this from In Review to Approved in Feature Flags May 5, 2026
@marandaneto
Copy link
Copy Markdown
Member

merge #111 before

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

posthog-elixir Compliance Report

Date: 2026-05-05 17:42:19 UTC
Duration: 107209ms

⚠️ Some Tests Failed

40/45 tests passed, 5 failed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 608ms
Format Validation.Event Has Uuid 608ms
Format Validation.Event Has Lib Properties 608ms
Format Validation.Distinct Id Is String 608ms
Format Validation.Token Is Present 607ms
Format Validation.Custom Properties Preserved 608ms
Format Validation.Event Has Timestamp 608ms
Retry Behavior.Retries On 503 5613ms
Retry Behavior.Does Not Retry On 400 2610ms
Retry Behavior.Does Not Retry On 401 2610ms
Retry Behavior.Respects Retry After Header 5614ms
Retry Behavior.Implements Backoff 15625ms
Retry Behavior.Retries On 500 5614ms
Retry Behavior.Retries On 502 5615ms
Retry Behavior.Retries On 504 5614ms
Retry Behavior.Max Retries Respected 15624ms
Deduplication.Generates Unique Uuids 617ms
Deduplication.Preserves Uuid On Retry 5614ms
Deduplication.Preserves Uuid And Timestamp On Retry 10618ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5615ms
Deduplication.No Duplicate Events In Batch 613ms
Deduplication.Different Events Have Different Uuids 610ms
Compression.Sends Gzip When Enabled 608ms
Batch Format.Uses Proper Batch Structure 609ms
Batch Format.Flush With No Events Sends Nothing 606ms
Batch Format.Multiple Events Batched Together 612ms
Error Handling.Does Not Retry On 403 2611ms
Error Handling.Does Not Retry On 413 2610ms
Error Handling.Retries On 408 5612ms

Feature_Flags Tests

⚠️ 11/16 tests passed, 5 failed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 7ms
Request Payload.Flags Request Uses V2 Query Param 5ms
Request Payload.Flags Request Hits Flags Path Not Decide 5ms
Request Payload.Flags Request Omits Authorization Header 5ms
Request Payload.Token In Flags Body Matches Init 6ms
Request Payload.Groups Round Trip 5ms
Request Payload.Groups Default To Empty Object 5ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 5ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 6ms
Request Payload.Disable Geoip Omitted Defaults To False 5ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 5ms
Request Lifecycle.No Flags Request On Init Alone 3ms
Request Lifecycle.No Flags Request On Normal Capture 606ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 9ms
Request Lifecycle.Mock Response Value Is Returned To Caller 6ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 607ms

Failures

request_payload.request_with_person_properties_device_id

Field 'token' not found in /flags request body at path 'token'. Available keys: ['groups', 'api_key', 'distinct_id', 'flag_keys_to_evaluate', 'geoip_disable', 'group_properties', 'person_properties']

request_payload.token_in_flags_body_matches_init

Field 'token' not found in /flags request body at path 'token'. Available keys: ['groups', 'api_key', 'distinct_id', 'flag_keys_to_evaluate', 'group_properties', '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: ['groups', 'api_key', 'distinct_id', 'flag_keys_to_evaluate', 'group_properties', 'person_properties']

request_lifecycle.mock_response_value_is_returned_to_caller

Last action result missing field 'value'. Keys: ['error', 'success']

side_effect_events.get_feature_flag_captures_feature_flag_called_event

Expected 1 events with name '$feature_flag_called', got 0

@dustinbyrne
Copy link
Copy Markdown
Contributor Author

Noted, thanks — no code dependency from this branch, but happy to let #111 merge first.

@dustinbyrne dustinbyrne merged commit 68baae7 into main May 5, 2026
24 checks passed
@dustinbyrne dustinbyrne deleted the fix/get-flag-payload-only-accessed branch May 5, 2026 17:59
@github-project-automation github-project-automation Bot moved this from Approved to Done in Feature Flags May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants