Repository navigation
feat!: add global and context option layers - #1024
Merged
Merged
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-14T03:50:51.206323+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-option-layers
branch
from
October 7, 2026 02:03
816a97e to
0f828c1
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 7, 2026 17:43
a515200 to
ea1d279
Compare
eli-r-ph
force-pushed
the
v1-capture-option-layers
branch
from
October 7, 2026 17:43
0f828c1 to
4753ddb
Compare
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
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-option-layers
branch
from
October 8, 2026 16:25
4753ddb to
89a4dfb
Compare
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 |
eli-r-ph
force-pushed
the
v1-capture-option-layers
branch
from
October 8, 2026 23:40
f595725 to
62ac4ab
Compare
eli-r-ph
force-pushed
the
v1-capture-options
branch
2 times, most recently
from
October 10, 2026 23:35
965fbe6 to
0263391
Compare
eli-r-ph
force-pushed
the
v1-capture-option-layers
branch
2 times, most recently
from
October 11, 2026 20:17
4120a8b to
73b3b03
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
dustinbyrne
left a comment
Contributor
There was a problem hiding this comment.
AI-assisted review.
Two observations below concern queued async defaults and MCP group attribution.
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 14, 2026 03:45
d912a87 to
a210bcc
Compare
Context tags, context options, super_properties, super_options, the derived personless option and the environment $release_id now fill only keys an event leaves unset, after before_send runs. before_send sees only the event's own values and SDK enrichment, and its changes beat every default. A None option counts as unset and is filled. Legacy properties still fill only unset options and are always removed.
Context tags, context options, super_properties, super_options, the derived personless option and the environment $release_id now fill before before_send runs, still only into keys the event leaves unset. before_send sees every value and has the final say, including removing a super property. $set, $set_once, $groups and $group_set fill one level deep when both values are dicts. The set() and set_once() values now win key by key over a $set or $set_once in properties, as ingestion merges them. Hoisting still runs once, after the hook.
$is_server, $geoip_disable and system context now fill last, only keys the event, context tags and super_properties left unset, before before_send. A super property $geoip_disable: False now wins over disable_geoip=True. The groups argument merges into a $groups property key by key and wins, in Client, AsyncClient and posthog.mcp events.
…exception events AsyncPosthog filled defaults in the worker from references to the live super_properties and options, so a change after capture could reach a queued event. Each layer is now shallow-copied when the event is admitted, as 7.x merged super_properties into a new dict at capture. The MCP exception event now merges typed groups after custom properties, like the primary event, so both events of a failing call get the same groups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eli-r-ph
force-pushed
the
v1-capture-option-layers
branch
from
October 14, 2026 03:46
820ef6e to
2c6c696
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
Stacked on #1023, which added per-event
options. This PR adds the layers below them, so every option and property fills in one order, as in posthog-go:optionsandpropertiesset_context_option()andtag()super_optionsandsuper_properties$is_server,$geoip_disable,$osand personlessbefore_send, which sees all of the above and has the final sayLayers 2-4 fill only keys the event does not set.
Changes
super_optionsonClient,AsyncPosthogand the module.set_context_option()andget_context_options(), inherited liketag().$set,$set_once,$groupsand$group_setmerge one level deep, so the event wins key by key.set()andset_once()values beat a$setor$set_onceinproperties.super_properties, sosuper_propertiescan no longer override$lib.disable_geoip.groups=merges into$groupsinstead of replacing it.process_person_profile: falseas the lowest layer, so any caller option can override it.AsyncPosthogcopies each default layer when it queues an event, so a later change tosuper_propertiescannot reach a queued event.💚 How did you test it?
capture_immediate.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee. A legacy
$process_person_profileinsuper_propertiesno longer opts a personless event in; usesuper_optionsinstead.🤖 Generated with Claude Code