Skip to content

chore(capture): document capture_mode + release changeset (capture v1, 6/6)#706

Open
eli-r-ph wants to merge 3 commits into
capture-v1/05-harness-cifrom
capture-v1/06-docs
Open

chore(capture): document capture_mode + release changeset (capture v1, 6/6)#706
eli-r-ph wants to merge 3 commits into
capture-v1/05-harness-cifrom
capture-v1/06-docs

Conversation

@eli-r-ph

Copy link
Copy Markdown

💡 Motivation and Context

Final PR in the stacked Capture V1 series (stacked on #705). Documents the new opt-in capture_mode so the feature ships with release notes and in-repo guidance.

  • Sampo changeset (.sampo/changesets/capture-v1-mode.md, minor) — describes the new capture_mode / POSTHOG_CAPTURE_MODE opt-in for the next release. CHANGELOG.md is generated by sampo release, so the changeset is the right place to add this (not a manual CHANGELOG edit).
  • AGENTS.md — a "Capture protocol (capture_mode)" section mapping the modes to the modules and routing that implement them (capture_mode.py, capture_v1.py, Consumer._send_analytics / Client._enqueue), plus the v1 invariants to preserve when editing (sentinel lifting + coerce-or-omit, $set/$set_once relocation, partial retry with stable request id, 429 terminal).

User-facing usage examples intentionally stay in the official docs — the README explicitly defers to them ("SDK usage examples and code snippets live in the official documentation so they stay up to date"), so this PR adds developer-facing notes rather than README usage.

💚 How did you test it?

Docs/changeset only — no runtime code. import posthog smoke check passes; from posthog import CaptureMode resolves. The changeset format matches the existing .sampo/changesets/*.md convention.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored with Cursor (Claude Opus 4.8) per the agreed plan. Final PR of the 6-part stack (#701 -> #706): config scaffolding, transforms, transport, wiring, compliance adapter/CI, and these docs.

@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "docs(capture): document capture_mode and..." | Re-trigger Greptile

Comment thread AGENTS.md
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-07-03 19:11:33 UTC
Duration: 337796ms

✅ 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 1008ms
Required Headers.Has Posthog Sdk Info Format 1009ms
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 1008ms
Body Format.No Api Key In Body 1009ms
Body Format.No Sent At In Body 1009ms
Event Format.Event Has Required Root Fields 1008ms
Event Format.Event Uuid Is Valid 1009ms
Event Format.Event Timestamp Is Rfc3339 1008ms
Event Format.Distinct Id Is String 1008ms
Event Format.Distinct Id At Root Not Properties 1009ms
Event Format.Custom Properties Preserved 1008ms
Event Format.Set Properties Preserved 1009ms
Event Format.Set Once Properties Preserved 1008ms
Event Format.Groups Properties Preserved 1008ms
Event Format.Sdk Generates Uuid If Not Provided 1009ms
Event Format.Event Has Required Root Fields Batch 1012ms
Event Format.Event Uuid Is Valid Batch 1012ms
Event Format.Event Timestamp Is Rfc3339 Batch 1012ms
Event Format.Distinct Id Is String Batch 1011ms
Event Format.Distinct Id At Root Not Properties Batch 1012ms
Event Format.Custom Properties Preserved Batch 1012ms
Event Format.Set Properties Preserved Batch 1012ms
Event Format.Set Once Properties Preserved Batch 1012ms
Event Format.Groups Properties Preserved Batch 1012ms
Event Format.Sdk Generates Uuid If Not Provided Batch 1011ms
Batch Behavior.Multiple Events In Single Batch 1506ms
Batch Behavior.Batch Envelope Smoke 1014ms
Batch Behavior.Flush With No Events Sends Nothing 1004ms
Batch Behavior.Flush At Triggers Batch 1509ms
Batch Behavior.Created At Reflects Batch Creation Time 1011ms
Deduplication.Generates Unique Uuids 1506ms
Deduplication.Different Events Same Content Different Uuids 1506ms
Deduplication.Preserves Uuid On Retry 7515ms
Deduplication.Preserves Timestamp On Retry 7510ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 7509ms
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 14524ms
Header Behavior On Retry.Request Id Preserved On Retry 7508ms
Header Behavior On Retry.Different Requests Have Different Request Ids 3516ms
Header Behavior On Retry.Request Timestamp Changes On Retry 7510ms
Response Format Validation.Success Response Has Uuid Keyed Results 1009ms
Response Format Validation.Success Response Has Ok For Each Event 1506ms
Response Format Validation.Success No Retry After When All Ok 1507ms
Response Format Validation.Success Retry After Present When Retry Events 2510ms
Response Format Validation.Success No Retry After When Drop Only 1507ms
Response Format Validation.Response Echoes Request Id 1008ms
Retry Behavior.Retries On 408 7513ms
Retry Behavior.Retries On 500 7513ms
Retry Behavior.Retries On 503 9515ms
Retry Behavior.Retries On 504 7511ms
Retry Behavior.Retryable Errors Have Retry After 4510ms
Retry Behavior.Respects Retry After On Retryable Error 12518ms
Retry Behavior.Does Not Retry On 400 3504ms
Retry Behavior.Does Not Retry On 401 3507ms
Retry Behavior.Does Not Retry On 402 3505ms
Retry Behavior.Does Not Retry On 413 3509ms
Retry Behavior.Does Not Retry On 415 3507ms
Retry Behavior.Non Retryable Errors Have No Retry After 3507ms
Retry Behavior.Implements Backoff 23519ms
Retry Behavior.Max Retries Respected 23520ms
Partial Batch Handling.Handles 200 Full Success 3012ms
Partial Batch Handling.Handles 200 With All Ok 4507ms
Partial Batch Handling.Does Not Retry Dropped Events 4506ms
Partial Batch Handling.Does Not Retry Limited Events 4510ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 7508ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 7512ms
Partial Batch Handling.Retries Only Retry Events From Partial 7512ms
Partial Batch Handling.Partial Retry Preserves Uuids 7510ms
Partial Batch Handling.Partial Retry Attempt Header Increments 7515ms
Partial Batch Handling.Partial Retry Request Id Preserved 7510ms
Partial Batch Handling.Respects Retry After On Partial 9511ms
Partial Batch Handling.Unknown Result Treated As Terminal 4504ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 4510ms
Compression.Sends Gzip Content Encoding 1006ms
Compression.No Content Encoding When Disabled 1008ms
Compression.Compressed Body Is Decompressible 1008ms
Error Handling.Does Not Retry On Unknown 4Xx 3508ms
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 1008ms
Event Options.Options Override In Batch 1012ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 1008ms
Geoip And Historical Migration.Historical Migration Set In Body 1008ms
Geoip And Historical Migration.Historical Migration Absent By Default 1007ms

Feature_Flags Tests

16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 1005ms
Request Payload.Flags Request Uses V2 Query Param 1006ms
Request Payload.Flags Request Hits Flags Path Not Decide 1007ms
Request Payload.Flags Request Omits Authorization Header 1005ms
Request Payload.Token In Flags Body Matches Init 1006ms
Request Payload.Groups Round Trip 1005ms
Request Payload.Groups Default To Empty Object 1006ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 1007ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 1006ms
Request Payload.Disable Geoip Omitted Defaults To False 1005ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 1007ms
Request Lifecycle.No Flags Request On Init Alone 502ms
Request Lifecycle.No Flags Request On Normal Capture 1506ms
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 1507ms

@eli-r-ph eli-r-ph force-pushed the capture-v1/06-docs branch from 171fdd0 to 4604596 Compare June 27, 2026 23:16
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch 2 times, most recently from 6db84db to 241364f Compare June 28, 2026 00:02
@eli-r-ph eli-r-ph force-pushed the capture-v1/06-docs branch 2 times, most recently from 4615a22 to 57eef07 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/05-harness-ci branch from 292e391 to 79dc48f Compare June 28, 2026 00:45
@eli-r-ph eli-r-ph force-pushed the capture-v1/06-docs branch from 57eef07 to 65d724c Compare June 28, 2026 00:45
@eli-r-ph eli-r-ph changed the title docs(capture): document capture_mode + release changeset (capture v1, 6/6) chore(capture): document capture_mode + release changeset (capture v1, 6/6) Jun 28, 2026
@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: "docs(capture): document capture_mode, ca..." | Re-trigger Greptile

@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
@eli-r-ph eli-r-ph force-pushed the capture-v1/06-docs branch 2 times, most recently from 49645ed to 1129196 Compare July 3, 2026 17:01
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from 8bd13a0 to e70d7f6 Compare July 3, 2026 17:01
eli-r-ph added 3 commits July 3, 2026 12:04
Adds the Sampo changeset for the opt-in capture_mode (v1 ingestion
protocol) and capture_compression, plus an AGENTS.md section mapping
capture_mode/capture_compression and their env vars to the modules and
routing that implement them, the v1 invariants to preserve, and the
sync_mode blocking-retry behavior.

User-facing usage stays in the official docs per the README convention.
Document the two parity behaviors added to the v1 transport: server `drop`
verdicts are accumulated across attempts and surfaced via CaptureV1Error/
on_error even on a 2xx, and Retry-After acts as a minimum (max of configured
backoff and Retry-After, hard-capped) rather than a replacement.
MAX_BACKOFF_SECONDS (30s) caps both the exponential backoff and the
Retry-After clamp; update the v1 invariants note accordingly.
@eli-r-ph eli-r-ph force-pushed the capture-v1/05-harness-ci branch from e70d7f6 to f30a46c Compare July 3, 2026 19:05
@eli-r-ph eli-r-ph force-pushed the capture-v1/06-docs branch from 1129196 to e1f90ae Compare July 3, 2026 19:05
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