Repository navigation
Conversation
…ai/events Capture v1 is now the default capture mode. The AI lane always posts capture v1 to /i/v1/ai/events, uncompressed, regardless of the analytics capture_mode. Tests move to a shared capture v1 send seam (posthog/test/capture_helpers.py); v0-only tests are pinned to CaptureMode.V0 until v0 removal.
Contributor
posthog-python Compliance ReportDate: 2026-10-06T19:32:08.842651+00:00 ✅ All Tests Passed!116/116 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
This was referenced Oct 6, 2026
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
5 tasks done
This branch has not been deployed
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.
💡 Motivation and Context
First PR in the capture v1 series, stacked on
v1(#1016).capture_mode. A blank or unrecognizedPOSTHOG_CAPTURE_MODEfalls back to v1. v0 stays opt-in until it is removed in a later PR.capture_aialways posts capture v1 to/i/v1/ai/events, uncompressed, whatever the analyticscapture_modeandcapture_compressionare. This keeps multi-MB AI events off the analytics endpoint's smaller caps._send_v1_batch/_post_v1take apathargument, and the consumer sends to its lane's endpoint.$liband$lib_versionfrom the request'sPostHog-Sdk-Infoheader and overwrites any value in the event. A$libset in a call, insuper_propertiesor inbefore_senddoes not reach PostHog. feat!: keep the posthog-python identity when instrumenting MCP #1034 fixes the header atposthog-python/<version>, so MCP instrumentation no longer relabels the client.capture/capture_aitests only change once.Test plumbing:
posthog/test/capture_helpers.pygives one seam for asserting on sent batches (patch_capture_send,patch_async_capture_send,sent_batch,sent_events), plusoffline_v1_postfor the subprocess tests. v1 never logs payloads, so those tests can no longer read the batch from the debug log.CaptureMode.V0for now. They get deleted along with v0.Compliance adapter:
_post_v1forwards the newpathargument.capture_ai_v0. Harness 1.1.1 only has an AI suite for/i/v0/ai/batch/, so it would fail now. AI compliance comes back ascapture_ai_v1with the harness 1.13.1 bump later in the series. Until then, the AI lane is covered by unit tests only.No new changeset: the major changeset on
v1already covers this.💚 How did you test it?
pytestsuite,ruff format --check,ruff check,mypywith the baseline filter,python -W error -c "import posthog", and the public API snapshot check, all locally.test_ai_capture_lane.pyasserts that the AI lane sends v1 to/i/v1/ai/eventswith no compression, even when analytics is pinned to v0 with gzip, in both async andsync_mode.test_capture_v1.pyasserts thatpathreaches the URL and is forwarded by_send_v1_batch.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee. The test ports were mostly mechanical codemods from the v0
batch_postseam to the v1 send seam, followed by manual fixes. We chose to pin v0-only tests rather than delete them yet, so this diff stays reviewable before the v0 removal PR.