Skip to content

chore(capture): v1 compliance adapter + CI job (capture v1, 5/6)#705

Open
eli-r-ph wants to merge 1 commit into
capture-v1/04-wirefrom
capture-v1/05-harness-ci
Open

chore(capture): v1 compliance adapter + CI job (capture v1, 5/6)#705
eli-r-ph wants to merge 1 commit into
capture-v1/04-wirefrom
capture-v1/05-harness-ci

Conversation

@eli-r-ph

Copy link
Copy Markdown

💡 Motivation and Context

Fifth PR in the stacked Capture V1 series (stacked on #704). This is the one that proves the v1 implementation against the cross-SDK conformance harness: it teaches the compliance adapter to speak capture-v1 and adds a CI job that runs the harness capture_v1 suite against it. Mirrors the posthog-go adapter at the same harness pin.

Adapter (sdk_compliance_adapter/adapter.py):

  • Protocol selected by CAPTURE_MODE (baked into a new Dockerfile.v1). One adapter process speaks one mode: /health advertises capture_v1 vs capture_v0, and /init creates the Client with the matching capture_mode. The harness uses the advertised capability to pick which suite to run.
  • /init now accepts disable_geoip and historical_migration.
  • /capture folds the harness's v1 options back into the SDK's $-prefixed sentinel properties (cookieless_mode -> $cookieless_mode, disable_skew_correction -> $ignore_sent_at, etc.), so the SDK lifts them onto the wire options object — exercising the feat(capture): v1 wire serialization transforms (capture v1, 2/6) #702 transform end to end.
  • A patched post_v1 records v1 attempts for /state (retry attempt read from the call, only terminal/non-retry per-event results counted as sent), mirroring the existing patched_batch_post.

CI (.github/workflows/sdk-compliance.yml):

  • Bumps the harness pin from the stale main SHA (a v0.5.2-era contract, predating the capture_v1 suites) to 0.8.0 (be8b8d5).
  • Splits into two jobs: compliance (v0, Dockerfile) and compliance-v1 (v1, Dockerfile.v1), each with its own report artifact.
  • docker-compose.yml gains a sdk-adapter-v1 service and pins the harness image to 0.8.0 for local runs.

💚 How did you test it?

ruff format/check clean; py_compile clean on the adapter. The v0 path is behavior-preserving — capture_mode="v0" resolves identically to the prior implicit default, and disable_geoip/historical_migration keep their previous effective defaults — so the existing v0 suite should pass unchanged at the new pin.

The harness integration itself is validated by the two CI jobs this PR adds (the multi-container harness orchestration is exactly what the reusable workflow runs per job). The adapter is a direct port of the posthog-go v1 adapter, which already passes the capture_v1 suite at this same pin.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change (adapter/CI only; v0 path preserved).

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored with Cursor (Claude Opus 4.8) per the agreed plan. The v1 suite asserts against the mock server's recorded requests rather than /state, so the adapter's /state tracking for v1 is best-effort parity with v0 (and with posthog-go) rather than load-bearing for the v1 assertions. Local harness runs were not performed — the added CI jobs are the gate, matching how the harness is intended to be exercised.

@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(capture): add v1 compliance adapte..." | Re-trigger Greptile

Comment thread sdk_compliance_adapter/adapter.py Outdated
Comment thread sdk_compliance_adapter/adapter.py
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-06-29 18:36:33 UTC
Duration: 327813ms

✅ All Tests Passed!

110/110 tests passed


Capture_V1 Tests

94/94 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint 516ms
Endpoint And Method.Does Not Use Legacy Endpoints 1009ms
Required Headers.Has Authorization Bearer Header 1008ms
Required Headers.Has Content Type Json 1009ms
Required Headers.Has Posthog Sdk Info Format 1008ms
Required Headers.Has Posthog Attempt Header 1008ms
Required Headers.Has Posthog Request Id 1009ms
Required Headers.Has Posthog Request Timestamp 1008ms
Required Headers.Has User Agent 1008ms
Body Format.Body Has Created At And Batch 1009ms
Body Format.No Api Key In Body 1008ms
Body Format.No Sent At In Body 1009ms
Event Format.Event Has Required Root Fields 1008ms
Event Format.Event Uuid Is Valid 1008ms
Event Format.Event Timestamp Is Rfc3339 1009ms
Event Format.Distinct Id Is String 1008ms
Event Format.Distinct Id At Root Not Properties 1008ms
Event Format.Custom Properties Preserved 1008ms
Event Format.Set Properties Preserved 1008ms
Event Format.Set Once Properties Preserved 1009ms
Event Format.Groups Properties Preserved 1008ms
Event Format.Sdk Generates Uuid If Not Provided 1008ms
Event Format.Event Has Required Root Fields Batch 1012ms
Event Format.Event Uuid Is Valid Batch 1013ms
Event Format.Event Timestamp Is Rfc3339 Batch 1012ms
Event Format.Distinct Id Is String Batch 1012ms
Event Format.Distinct Id At Root Not Properties Batch 1011ms
Event Format.Custom Properties Preserved Batch 1013ms
Event Format.Set Properties Preserved Batch 1012ms
Event Format.Set Once Properties Preserved Batch 1011ms
Event Format.Groups Properties Preserved Batch 1013ms
Event Format.Sdk Generates Uuid If Not Provided Batch 1011ms
Batch Behavior.Multiple Events In Single Batch 1507ms
Batch Behavior.Batch Envelope Smoke 1013ms
Batch Behavior.Flush With No Events Sends Nothing 1005ms
Batch Behavior.Flush At Triggers Batch 1508ms
Batch Behavior.Created At Reflects Batch Creation Time 1010ms
Deduplication.Generates Unique Uuids 1507ms
Deduplication.Different Events Same Content Different Uuids 1506ms
Deduplication.Preserves Uuid On Retry 7513ms
Deduplication.Preserves Timestamp On Retry 7513ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 7508ms
Deduplication.No Duplicate Events In Batch 1507ms
Header Behavior On Retry.Attempt Header Starts At One 1009ms
Header Behavior On Retry.Attempt Header Increments On Retry 13522ms
Header Behavior On Retry.Request Id Preserved On Retry 7504ms
Header Behavior On Retry.Different Requests Have Different Request Ids 3519ms
Header Behavior On Retry.Request Timestamp Changes On Retry 7509ms
Response Format Validation.Success Response Has Uuid Keyed Results 1010ms
Response Format Validation.Success Response Has Ok For Each Event 1506ms
Response Format Validation.Success No Retry After When All Ok 1506ms
Response Format Validation.Success Retry After Present When Retry Events 2511ms
Response Format Validation.Success No Retry After When Drop Only 1507ms
Response Format Validation.Response Echoes Request Id 1009ms
Retry Behavior.Retries On 408 7514ms
Retry Behavior.Retries On 500 7512ms
Retry Behavior.Retries On 503 8514ms
Retry Behavior.Retries On 504 7512ms
Retry Behavior.Retryable Errors Have Retry After 4508ms
Retry Behavior.Respects Retry After On Retryable Error 12517ms
Retry Behavior.Does Not Retry On 400 3503ms
Retry Behavior.Does Not Retry On 401 3508ms
Retry Behavior.Does Not Retry On 402 3507ms
Retry Behavior.Does Not Retry On 413 3507ms
Retry Behavior.Does Not Retry On 415 3508ms
Retry Behavior.Non Retryable Errors Have No Retry After 3507ms
Retry Behavior.Implements Backoff 19530ms
Retry Behavior.Max Retries Respected 19521ms
Partial Batch Handling.Handles 200 Full Success 3000ms
Partial Batch Handling.Handles 200 With All Ok 4507ms
Partial Batch Handling.Does Not Retry Dropped Events 4507ms
Partial Batch Handling.Does Not Retry Limited Events 4509ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 7513ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 7512ms
Partial Batch Handling.Retries Only Retry Events From Partial 7511ms
Partial Batch Handling.Partial Retry Preserves Uuids 7511ms
Partial Batch Handling.Partial Retry Attempt Header Increments 7511ms
Partial Batch Handling.Partial Retry Request Id Preserved 7511ms
Partial Batch Handling.Respects Retry After On Partial 9512ms
Partial Batch Handling.Unknown Result Treated As Terminal 4506ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 4508ms
Compression.Sends Gzip Content Encoding 1007ms
Compression.No Content Encoding When Disabled 1009ms
Compression.Compressed Body Is Decompressible 1009ms
Error Handling.Does Not Retry On Unknown 4Xx 3509ms
Event Options.Cookieless Mode Override 1007ms
Event Options.Disable Skew Correction Override 1008ms
Event Options.Process Person Profile Override 1008ms
Event Options.Product Tour Id Override 1008ms
Event Options.Unset Options Omitted 1009ms
Event Options.Options Override In Batch 1011ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 1009ms
Geoip And Historical Migration.Historical Migration Set In Body 1008ms
Geoip And Historical Migration.Historical Migration Absent By Default 1009ms

Feature_Flags Tests

16/16 tests passed

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

@eli-r-ph eli-r-ph force-pushed the capture-v1/04-wire branch from da60117 to 3274be1 Compare June 27, 2026 23:16
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 92affe0 to 6db84db Compare June 27, 2026 23:16
@eli-r-ph eli-r-ph force-pushed the capture-v1/04-wire branch from 3274be1 to 5026185 Compare June 27, 2026 23:58
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 6db84db to 241364f Compare June 28, 2026 00:02
@eli-r-ph eli-r-ph force-pushed the capture-v1/04-wire branch from 5026185 to d1875fc Compare June 28, 2026 00:20
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 241364f to 292e391 Compare June 28, 2026 00:20
@eli-r-ph eli-r-ph self-assigned this Jun 28, 2026
@eli-r-ph eli-r-ph force-pushed the capture-v1/04-wire branch from d1875fc to 73e034f Compare June 28, 2026 00:45
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 292e391 to 79dc48f Compare June 28, 2026 00:45
@eli-r-ph eli-r-ph requested a review from a team June 29, 2026 18:04
@eli-r-ph eli-r-ph marked this pull request as ready for review June 29, 2026 18:04
@eli-r-ph eli-r-ph requested a review from a team as a code owner June 29, 2026 18:04
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "chore(capture): add v1 compliance adapte..." | Re-trigger Greptile

Teaches the SDK compliance adapter to speak capture-v1 and adds a second
CI job that runs the harness capture_v1 suite against it.

Bumps the harness pin from the stale main SHA (v0.5.2 contract) to 0.8.0
(be8b8d5), which carries the capture_v1 suites, and splits the workflow
into v0 + v1 jobs. Also carries the /flags api_key_field="token" fix
required by the 0.8.0 harness contract and adapter timing/debug settings
for reliable test execution.
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 79dc48f to 8bd13a0 Compare June 29, 2026 18:30
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.

1 participant