Repository navigation
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-07T02:08:29.856820+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
|
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
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
Capture v1 returns a per-event verdict for every event in a 2xx
resultsmap, keyed by the canonical lowercase hyphenated uuid. This PR makes the SDK report those verdicts, and every other capture failure, through one error type and one reporting path, aligned with posthog-go'sv1branch.Error model
CaptureErrornow carriesendpoint,request_id,attempts,retry_exhausted,dropsandevent_results(a new publicCaptureEventResult(result, details)per uuid).verdict_summary()renders counts such asdrop/billing=1, retry/not_persisted=1.CaptureError(status=0)with the original exception as__cause__, like go'sCaptureRequestError.UUIDs
resultsmap still counts as accepted, matching go and rs. With canonical keys, the server answers every event, so this only matters if the server breaks its contract.Reporting
on_error, every failure goes to it, and the SDK logs nothing extra.on_error, each failed batch logs one aggregate line:N event(s) not persisted by <endpoint>: .... The line has counts, verdicts, the error type and the status. It never includes payloads, uuids or server error text.sync_modefailures now go toon_errortoo, called on the calling thread after the send slot is released, soshutdown()from the callback works.capture()returnsNoneon failure. This reverses the contract asserted by #832'stest_sync_send_failure_does_not_invoke_async_on_error.on_errorlogs the aggregate line instead of callingon_erroragain. This applies to sync mode,AsyncPosthog.capture_immediateand the async consumer, and stops a callback that captures from recursing while the endpoint is down.Retries
Consumerdefaultretriesis 3 (4 attempts), matching the client default. It was 10.💚 How did you test it?
CaptureErrorendpoint,event_resultsandverdict_summaryon_errorwithshutdown()from inside the callbackon_errorpython -W error -c "import posthog", the public API snapshot anduv lock --check.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileCovered by the existing
capture-v1-majorchangeset; the migration guide lands later in this stack.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee.
Agreed before implementation:
sync_modecallson_error, with a reentrancy guardAgent calls worth review:
CaptureError(status=0)Consumerretries default