Skip to content

test: enable local feature flag evaluation compliance - #930

Draft
marandaneto wants to merge 2 commits into
fix/versioned-boolean-local-evaluationfrom
test/local-evaluation-harness
Draft

test: enable local feature flag evaluation compliance#930
marandaneto wants to merge 2 commits into
fix/versioned-boolean-local-evaluationfrom
test/local-evaluation-harness

Conversation

@marandaneto

@marandaneto marandaneto commented Sep 8, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

Stacked on #922. Merge that PR first, then retarget this PR to main.

The SDK specs and harness now include optional local feature flag evaluation tests. This PR enables them for both Python capture adapters and upgrades the harness workflow and Docker image from 0.10.0 to released version 1.1.1. Both reusable workflow references are pinned to its release commit, 1d6b197ef46758f577f470535bb3d70e37a15fa2.

The adapter now accepts a personal API key, explicitly reloads definitions with a bounded readiness check, and uses the real SDK local-only result API. It distinguishes a conclusive false from an inconclusive result without remote fallback. Forced remote calls use a separate definitions-free Client. Failed loads cannot acknowledge stale definitions, and timed-out loads cannot publish into replacement Clients after reset.

The workflow adds adapter protocol tests and makes compliance failures blocking. No shipped SDK runtime code changes, so no SDK release changeset is included.

Harness routing fix

PostHog/posthog-sdk-test-harness#54 is now included in harness 1.1.1. The released image correctly accepts normal capture-v1 routing for AI-named events, removing the failure seen with 1.1.0. Both complete compliance suites pass with 1.1.1. No SDK routing workaround or additional adapter change was needed for the patch upgrade.

💚 How did you test it?

  • Adapter protocol tests: 23 passed, including versioned matching, false versus inconclusive, forced remote behavior, failed reloads, timeouts, overlapping reloads, empty definitions, and reset isolation.
  • Rebuilt both adapters and ran the full Docker suites against released harness 1.1.1: 56/56 capture-v0 and 121/121 capture-v1 passed.
  • Both modes passed all 17 remote feature-flag tests and all 4 local-evaluation tests, including version-only reloads.
  • Repository-locked Ruff lint and formatting, Mypy with the repository baseline, actionlint, and git diff --check passed.
  • Exact-head autoreview --mode branch --base origin/fix/versioned-boolean-local-evaluation passed at 8939d3fa4de04e984ebb3e870db391809716c5f2 with no actionable findings.

📝 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

Not applicable: this PR changes test infrastructure, not the published SDK.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Pi using Git, pytest, Docker, Ruff, Mypy, actionlint, and isolated Pi autoreview. The work was directed by @marandaneto and requires human review.

The adapter delegates matching to the SDK instead of recreating matcher behavior. The separate upstream harness routing fix is now released and consumed here. This draft remains stacked on #922.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-09-09T06:59:06.059498+00:00
Duration: 259970ms

✅ All Tests Passed!

121/121 tests passed


Capture_V1 Tests

95/95 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint 517ms
Endpoint And Method.Does Not Use Legacy Endpoints 511ms
Required Headers.Has Authorization Bearer Header 510ms
Required Headers.Has Content Type Json 510ms
Required Headers.Has Posthog Sdk Info Format 511ms
Required Headers.Has Posthog Attempt Header 511ms
Required Headers.Has Posthog Request Id 511ms
Required Headers.Has Posthog Request Timestamp 510ms
Required Headers.Has User Agent 511ms
Body Format.Body Has Created At And Batch 510ms
Body Format.No Api Key In Body 511ms
Body Format.No Sent At In Body 510ms
Event Format.Event Has Required Root Fields 511ms
Event Format.Event Uuid Is Valid 511ms
Event Format.Event Timestamp Is Rfc3339 511ms
Event Format.Non Utc Event Timestamp Is Converted To Utc 517ms
Event Format.Distinct Id Is String 511ms
Event Format.Distinct Id At Root Not Properties 510ms
Event Format.Custom Properties Preserved 510ms
Event Format.Set Properties Preserved 511ms
Event Format.Set Once Properties Preserved 510ms
Event Format.Groups Properties Preserved 510ms
Event Format.Sdk Generates Uuid If Not Provided 511ms
Event Format.Event Has Required Root Fields Batch 513ms
Event Format.Event Uuid Is Valid Batch 514ms
Event Format.Event Timestamp Is Rfc3339 Batch 514ms
Event Format.Distinct Id Is String Batch 513ms
Event Format.Distinct Id At Root Not Properties Batch 513ms
Event Format.Custom Properties Preserved Batch 513ms
Event Format.Set Properties Preserved Batch 514ms
Event Format.Set Once Properties Preserved Batch 514ms
Event Format.Groups Properties Preserved Batch 514ms
Event Format.Sdk Generates Uuid If Not Provided Batch 513ms
Batch Behavior.Multiple Events In Single Batch 518ms
Batch Behavior.Batch Envelope Smoke 516ms
Batch Behavior.Flush With No Events Sends Nothing 506ms
Batch Behavior.Flush At Triggers Batch 1013ms
Batch Behavior.Created At Reflects Batch Creation Time 511ms
Deduplication.Generates Unique Uuids 518ms
Deduplication.Different Events Same Content Different Uuids 512ms
Deduplication.Preserves Uuid On Retry 6519ms
Deduplication.Preserves Timestamp On Retry 6516ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 6524ms
Deduplication.No Duplicate Events In Batch 519ms
Header Behavior On Retry.Attempt Header Starts At One 510ms
Header Behavior On Retry.Attempt Header Increments On Retry 13528ms
Header Behavior On Retry.Request Id Preserved On Retry 6516ms
Header Behavior On Retry.Different Requests Have Different Request Ids 3019ms
Header Behavior On Retry.Request Timestamp Changes On Retry 6516ms
Response Format Validation.Success Response Has Uuid Keyed Results 512ms
Response Format Validation.Success Response Has Ok For Each Event 514ms
Response Format Validation.Success No Retry After When All Ok 513ms
Response Format Validation.Success Retry After Present When Retry Events 1516ms
Response Format Validation.Success No Retry After When Drop Only 513ms
Response Format Validation.Response Echoes Request Id 510ms
Retry Behavior.Retries On 408 6520ms
Retry Behavior.Retries On 500 6516ms
Retry Behavior.Retries On 503 8519ms
Retry Behavior.Retries On 504 6519ms
Retry Behavior.Retryable Errors Have Retry After 3517ms
Retry Behavior.Respects Retry After On Retryable Error 11523ms
Retry Behavior.Does Not Retry On 400 2513ms
Retry Behavior.Does Not Retry On 401 2514ms
Retry Behavior.Does Not Retry On 402 2513ms
Retry Behavior.Does Not Retry On 413 2514ms
Retry Behavior.Does Not Retry On 415 2513ms
Retry Behavior.Non Retryable Errors Have No Retry After 2512ms
Retry Behavior.Implements Backoff 22538ms
Retry Behavior.Max Retries Respected 22533ms
Partial Batch Handling.Handles 200 Full Success 2513ms
Partial Batch Handling.Handles 200 With All Ok 3519ms
Partial Batch Handling.Does Not Retry Dropped Events 3517ms
Partial Batch Handling.Does Not Retry Limited Events 3515ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 6518ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 6526ms
Partial Batch Handling.Retries Only Retry Events From Partial 6525ms
Partial Batch Handling.Partial Retry Preserves Uuids 6523ms
Partial Batch Handling.Partial Retry Attempt Header Increments 6523ms
Partial Batch Handling.Partial Retry Request Id Preserved 6521ms
Partial Batch Handling.Respects Retry After On Partial 8519ms
Partial Batch Handling.Unknown Result Treated As Terminal 3518ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 3520ms
Compression.Sends Gzip Content Encoding 511ms
Compression.No Content Encoding When Disabled 511ms
Compression.Compressed Body Is Decompressible 511ms
Error Handling.Does Not Retry On Unknown 4Xx 2515ms
Event Options.Cookieless Mode Override 511ms
Event Options.Disable Skew Correction Override 511ms
Event Options.Process Person Profile Override 510ms
Event Options.Product Tour Id Override 511ms
Event Options.Unset Options Omitted 511ms
Event Options.Options Override In Batch 514ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 511ms
Geoip And Historical Migration.Historical Migration Set In Body 510ms
Geoip And Historical Migration.Historical Migration Absent By Default 511ms

Capture_Ai Tests

5/5 tests passed

View Details
Test Status Duration
Routing.Capture Ai Posts To Ai Endpoint 511ms
Routing.Capture Does Not Reroute Ai Named Events 511ms
Identity.Capture Ai Event Has Uuid 511ms
Identity.Capture Ai Keeps Supplied Uuid 510ms
Timestamp Format.Non Utc Event Timestamp Is Converted To Utc 511ms

Feature_Flags Tests

17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 13ms
Request Payload.Flags Request Uses V2 Query Param 11ms
Request Payload.Flags Request Hits Flags Path Not Decide 11ms
Request Payload.Flags Request Omits Authorization Header 12ms
Request Payload.Token In Flags Body Matches Init 11ms
Request Payload.Groups Round Trip 11ms
Request Payload.Groups Default To Empty Object 11ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 13ms
Request Payload.Disable Geoip Omitted Defaults To False 12ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 12ms
Request Lifecycle.No Flags Request On Init Alone 5ms
Request Lifecycle.No Flags Request On Normal Capture 511ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 19ms
Request Lifecycle.Mock Response Value Is Returned To Caller 12ms
Retry Behavior.Retries Flags On 502 315ms
Retry Behavior.Retries Flags On 504 317ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 514ms

Feature_Flags_Local_Evaluation Tests

4/4 tests passed

View Details
Test Status Duration
Versioned Boolean Matching.Matching Version Missing 83ms
Versioned Boolean Matching.Matching Version 1 87ms
Versioned Boolean Matching.Matching Version 2 83ms
Versioned Boolean Matching.Version Only Reload 1 2 1 2 Missing 49ms

@marandaneto
marandaneto marked this pull request as ready for review September 9, 2026 07:29
@marandaneto
marandaneto requested a review from a team as a code owner September 9, 2026 07:29
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "test: upgrade SDK compliance harness to ..." | Re-trigger Greptile

@marandaneto
marandaneto marked this pull request as draft September 9, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants