Repository navigation
feat(analytics): hierarchical groups support - #201
Draft
tylerjroach wants to merge 19 commits into
Draft
tylerjroach wants to merge 19 commits into
tylerjroach wants to merge 19 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rarchical groups projects $add, $append and $merge were logged and still sent. They now raise UnsupportedOperationError before anything is sent, like the people operations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y profile API Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…clients The company profile is updated through the existing group methods instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings back the company profile methods in place of inferring the company from $company_id group writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MixpanelIdentity.to_flag_context puts the ids under the keys flags read, the groups at the top level and the custom properties under custom_properties, so callers do not hand-write $user_id and $company_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…client A people update through a client bound with for_company used the identity's company and ignored the bound one, so a mismatched identity silently updated the other company's user. It now raises ValueError and sends nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al groups An identity with a user id but no company or device id threw on every call. It is valid to send, like a plain distinct id, so events now send it as given. User profile updates still need the company and fail with the existing company-required error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The reviewed changes appear safe to merge; the previous wrong-profile issue is fixed.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #201 +/- ##
==========================================
+ Coverage 96.39% 98.08% +1.68%
==========================================
Files 15 17 +2
Lines 2888 4287 +1399
Branches 176 255 +79
==========================================
+ Hits 2784 4205 +1421
+ Misses 67 45 -22
Partials 37 37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…l groups profile updates - A user profile update for an identity without a company now uses the for_company client's bound company, and the identity's or bound company wins over a $company_id in meta. Unbound clients still fall back to meta. - A None or empty $company_id no longer counts as a company, so the update raises CompanyRequiredError instead of being sent. - Unsupported operations are checked on the record after meta is merged, so meta cannot send $add, $append or $merge to /groups. - A for_company client no longer shuts down the flag providers it shares with its parent when used as a context manager. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the local_feature_flags import in the flags tests to the top of the
file (ruff PLC0415), and exclude "{" from the placeholder capture so a
template full of "{" can't make matching slow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Public docs are the source of truth for hierarchical groups usage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on keys on hierarchical groups - Exposure events on hierarchical groups keep $user_id when the flag context has no $company_id; the skip rule ($company_id or distinct_id) is unchanged. - MixpanelIdentity and for_company accept string and integer ids (not bool) and refuse other types with ValueError; for_company(0) is accepted and the bound company is compared as a string. - people_update on hierarchical groups no longer treats $company_id, $group_key or $group_id as unknown operations. - track() docstring: distinct_id is also sent when properties carry one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d distinct id On a hierarchical groups client, $group_key, $group_id or $company_id in a people_update message or meta could retarget the update away from the user named by the combined $distinct_id. Values that repeat the parsed identity are accepted; conflicting ones raise ValueError and nothing is sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds hierarchical groups (HG) support: a
MixpanelIdentitycarrying user and company ids, HG-aware profile updates, and company-bound group writes. HG behavior is gated on the SDK's hierarchical groups init flag; projects without it behave as before.Draft, opened for an early automated review. Not ready to merge.
Commits
🤖 Generated with Claude Code