Repository navigation
feat!: add per-event capture options - #1023
Merged
Merged
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-14T03:50:28.472481+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
|
3 of 20 tasks
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 7, 2026 02:03
891b4c8 to
a515200
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 7, 2026 02:03
0ae6eb7 to
8da410d
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 7, 2026 17:43
a515200 to
ea1d279
Compare
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
dustinbyrne
reviewed
Oct 7, 2026
| uuid: Optional[Union[str, UUID]] = None, | ||
| disable_geoip: Optional[bool] = None, | ||
| distinct_id: Optional[ID_TYPES] = None, | ||
| options: Optional[Dict[str, Any]] = None, |
Contributor
There was a problem hiding this comment.
worth using stronger types? e.g.
class CaptureOptions(TypedDict, total=False):
cookieless_mode: Optional[bool]
disable_skew_correction: Optional[bool]
process_person_profile: Optional[bool]
Contributor
Author
There was a problem hiding this comment.
🤔 good callout I considered this - as long as no SDK code changes are needed for future options once we define them, the solution does what we want 👍
I rejected TypedDict here so far for two reasons:
- the backend does a curated lenient parse on these values for "boolean-intent" that will shore up some current silent fails in legacy capture, that will now apply uniformly across v1 SDKs; with
TypedDict, legacy hoisted props would fail hard on non-boolvalues just on this SDK, or we'd need to dup the backend parsing then keep it in parity w/capture - I think as we add future options to
TypedDictthat aren't in the schema,mypyand friends might flag end user call sites that apply them with warnings?
If I'm missing something let me know, happy to adjust, but I'm leaning towards keeping this as is for those reasons?
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 8, 2026 16:25
ea1d279 to
9705c81
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 8, 2026 16:25
ba59e9d to
44d141d
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 8, 2026 23:40
9705c81 to
965fbe6
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 10, 2026 23:34
682fd47 to
2e1ba3c
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 10, 2026 23:35
965fbe6 to
0263391
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 11, 2026 20:17
0263391 to
d912a87
Compare
dustinbyrne
approved these changes
Oct 13, 2026
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 14, 2026 03:45
d912a87 to
a210bcc
Compare
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 reads processing options, such as
process_person_profileandcookieless_mode, from a per-eventoptionsobject. Python callers had no way to set them directly. This PR adds anoptionsargument, as posthog-go and posthog-rs already have. Stacked on #1050.Changes
capture,capture_ai,set,set_once,group_identify,aliasandcapture_exceptiontakeoptions=, onClient,AsyncPosthogand the module.optionsis logged and the event is sent without it.$cookieless_mode,$ignore_sent_at,$product_tour_idand$process_person_profileproperties still fill their option, and are always removed fromproperties.Noneoption counts as unset.before_sendseesoptionsand can change it.$feature_flag_calledevents keep the properties that carry options, so those options are no longer lost.Global and context options come next, in #1024.
💚 How did you test it?
test_event_options.pychecks thatoptionsreaches the wire from every method, on both clients, includingbefore_sendchanges.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee.
🤖 Generated with Claude Code