Repository navigation
feat(groups): add disableGeoip option to groupIdentify - #263
Conversation
groupIdentify() puts every caller property under $group_set, so PHP users had no way to set a top-level $geoip_disable on $groupidentify events. The new disableGeoip option sets it, matching the Node, Python, and Go SDKs and the group-identify spec. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
[Medium impact] The PR appears safe to merge. Reviews (2) · Last reviewed commit: "chore(groups): trim group_set detail fro..." · Reviewed by Greptile |
posthog-php-fork_curl Compliance ReportDate: 2026-10-16T18:53:48.991543+00:00
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 35ms |
| Format Validation.Event Has Uuid | ✅ | 529ms |
| Format Validation.Event Has Lib Properties | ✅ | 529ms |
| Format Validation.Distinct Id Is String | ✅ | 530ms |
| Format Validation.Token Is Present | ✅ | 531ms |
| Format Validation.Custom Properties Preserved | ✅ | 530ms |
| Format Validation.Event Has Timestamp | ✅ | 530ms |
| Format Validation.Non Utc Event Timestamp Is Converted To Utc | ✅ | 530ms |
| Retry Behavior.Retries On 503 | ❌ | 5532ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 2535ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 2533ms |
| Retry Behavior.Respects Retry After Header | ❌ | 5535ms |
| Retry Behavior.Implements Backoff | ❌ | 15540ms |
| Retry Behavior.Retries On 500 | ❌ | 5042ms |
| Retry Behavior.Retries On 502 | ❌ | 5533ms |
| Retry Behavior.Retries On 504 | ❌ | 5538ms |
| Retry Behavior.Max Retries Respected | ❌ | 15546ms |
| Deduplication.Generates Unique Uuids | ✅ | 538ms |
| Deduplication.Preserves Uuid On Retry | ❌ | 5533ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ❌ | 10543ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ❌ | 5538ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 536ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 532ms |
| Compression.Sends Gzip When Enabled | ✅ | 532ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 530ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 517ms |
| Batch Format.Multiple Events Batched Together | ✅ | 520ms |
| Error Handling.Does Not Retry On 403 | ✅ | 2532ms |
| Error Handling.Does Not Retry On 413 | ✅ | 2532ms |
| Error Handling.Retries On 408 | ❌ | 5536ms |
Failures
retry_behavior.retries_on_503
Expected at least 3 requests, got 1
retry_behavior.respects_retry_after_header
Expected at least 2 requests, got 1
retry_behavior.implements_backoff
Expected at least 3 requests, got 1
retry_behavior.retries_on_500
Expected at least 2 requests, got 1
retry_behavior.retries_on_502
Expected at least 2 requests, got 1
retry_behavior.retries_on_504
Expected at least 2 requests, got 1
retry_behavior.max_retries_respected
Expected 4 requests, got 1
deduplication.preserves_uuid_on_retry
Need at least 2 requests to check retry
deduplication.preserves_uuid_and_timestamp_on_retry
Expected at least 3 requests, got 1
deduplication.preserves_uuid_and_timestamp_on_batch_retry
Expected at least 2 requests, got 1
error_handling.retries_on_408
Expected at least 2 requests, got 1
Feature_Flags Tests
✅ 17/17 tests passed
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ✅ | 522ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 521ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 521ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 521ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 521ms |
| Request Payload.Groups Round Trip | ✅ | 521ms |
| Request Payload.Groups Default To Empty Object | ✅ | 522ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ✅ | 522ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ✅ | 521ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ✅ | 521ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 516ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 518ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 525ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 523ms |
| Retry Behavior.Retries Flags On 502 | ✅ | 625ms |
| Retry Behavior.Retries Flags On 504 | ✅ | 624ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 532ms |
posthog-php-lib_curl Compliance ReportDate: 2026-10-16T18:53:45.141132+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
posthog-php-socket Compliance ReportDate: 2026-10-16T18:54:09.789406+00:00
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 27ms |
| Format Validation.Event Has Uuid | ✅ | 522ms |
| Format Validation.Event Has Lib Properties | ✅ | 524ms |
| Format Validation.Distinct Id Is String | ✅ | 523ms |
| Format Validation.Token Is Present | ✅ | 523ms |
| Format Validation.Custom Properties Preserved | ✅ | 523ms |
| Format Validation.Event Has Timestamp | ✅ | 523ms |
| Format Validation.Non Utc Event Timestamp Is Converted To Utc | ✅ | 523ms |
| Retry Behavior.Retries On 503 | ❌ | 9233ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 2527ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 2526ms |
| Retry Behavior.Respects Retry After Header | ❌ | 9234ms |
| Retry Behavior.Implements Backoff | ❌ | 19245ms |
| Retry Behavior.Retries On 500 | ❌ | 9237ms |
| Retry Behavior.Retries On 502 | ❌ | 9236ms |
| Retry Behavior.Retries On 504 | ❌ | 9235ms |
| Retry Behavior.Max Retries Respected | ❌ | 19244ms |
| Deduplication.Generates Unique Uuids | ✅ | 531ms |
| Deduplication.Preserves Uuid On Retry | ❌ | 9233ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ❌ | 14241ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ❌ | 9239ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 531ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 524ms |
| Compression.Sends Gzip When Enabled | ✅ | 523ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 523ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 519ms |
| Batch Format.Multiple Events Batched Together | ✅ | 513ms |
| Error Handling.Does Not Retry On 403 | ✅ | 2526ms |
| Error Handling.Does Not Retry On 413 | ✅ | 2526ms |
| Error Handling.Retries On 408 | ❌ | 5529ms |
Failures
retry_behavior.retries_on_503
Expected at least 3 requests, got 1
retry_behavior.respects_retry_after_header
Expected at least 2 requests, got 1
retry_behavior.implements_backoff
Expected at least 3 requests, got 1
retry_behavior.retries_on_500
Expected at least 2 requests, got 1
retry_behavior.retries_on_502
Expected at least 2 requests, got 1
retry_behavior.retries_on_504
Expected at least 2 requests, got 1
retry_behavior.max_retries_respected
Expected 4 requests, got 1
deduplication.preserves_uuid_on_retry
Need at least 2 requests to check retry
deduplication.preserves_uuid_and_timestamp_on_retry
Expected at least 3 requests, got 1
deduplication.preserves_uuid_and_timestamp_on_batch_retry
Expected at least 2 requests, got 1
error_handling.retries_on_408
Expected at least 2 requests, got 1
Feature_Flags Tests
✅ 17/17 tests passed
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ✅ | 522ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 523ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 521ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 522ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 522ms |
| Request Payload.Groups Round Trip | ✅ | 522ms |
| Request Payload.Groups Default To Empty Object | ✅ | 522ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ✅ | 522ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ✅ | 522ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ✅ | 521ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 517ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 509ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 526ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 523ms |
| Retry Behavior.Retries Flags On 502 | ✅ | 623ms |
| Retry Behavior.Retries Flags On 504 | ✅ | 623ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 525ms |
…eset Co-Authored-By: Claude Opus 5.5 <[email protected]>
marandaneto
left a comment
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
| array $groupProperties = [], | ||
| bool $onlyEvaluateLocally = false, | ||
| bool $disableGeoip = false, | ||
| ?bool $disableGeoip = null, |
There was a problem hiding this comment.
P1 · Preserve compatibility with existing Client method overrides
Existing subclasses overriding Client::evaluateFlags() with bool $disableGeoip = false now fail at class loading: PHP rejects the narrower parameter because the parent accepts null. The same break affects overrides of Client::flags(). This makes the minor SDK update fatal for these applications; preserve the inherited signatures or reserve this change for a major release.
There was a problem hiding this comment.
We acknowledge this breaks compatibility for existing subclasses overriding these methods. We’re accepting that break in this minor release as an explicit tradeoff: nullable parameters let omitted arguments inherit the client-wide GeoIP setting while preserving an explicit false override. Keeping bool $disableGeoip = false would lose that distinction. Given that subclassing these SDK methods is an uncommon usage pattern, we prefer consistent configuration behavior here. Affected subclasses will need to update their overrides to ?bool $disableGeoip = null.
|
thanks @xljones |
💡 Motivation and Context
$groupidentifyevents, so backend group identify calls pick up the server's location.groupIdentify()has no option to set$geoip_disable.capture(),identify(), andalias()accept it inproperties.Changes:
disableGeoipoption and per-call overrides forcapture(),identify(),alias(), andgroupIdentify(). When enabled, the SDK setsproperties.$geoip_disable: true, alongside$group_setrather than inside it.falseoverrides a client setting oftrue; omitted ornulloptions inherit the client setting. Setting the option tofalsedoes not remove manually supplied$geoip_disableproperties.before_sendcan still modify the enriched event.before_sendcan already set the flag, but the group-identify spec defines a per-calldisableGeoip, and the Node, Python, and Go SDKs have one.disableGeoipdefaults tofalsefor compatibility with current PHP releases. Ideally it will becometruein the next major release; the initialization code documents this decision. SetdisableGeoip => trueto opt into Node's default behavior now.UPGRADING.mdfor configuration and compatibility notes.💚 How did you test it?
GeoipTestcovers client defaults, per-call precedence, omitted/null inheritance, all four event APIs, remote flag requests, filtered snapshot exposure events, minimized exposure events, exception capture,before_send, and manually supplied properties. It supersedes the original group-only test inRequestContextTest.truedefault and passed after restoringfalse.composer api:checkandgit diff --checkpass. Changed-file PHP_CodeSniffer reports no errors and two pre-existing line-length warnings.📝 Checklist
If releasing new changes
pnpm changeto generate the minor-release change intent.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
claude-opus-5-5) wrote the change. Skills used:writing-pr-descriptions.0fb3ea0was implemented with the Pi coding assistant at the maintainer's request. It adds shared GeoIP configuration while explicitly retainingfalseas the compatibility default.pnpm changeas a minor release.UPGRADING.md, a README link, and public API documentation. The PHP SDK page lives in the posthog.com repo and was not changed.🤖 Generated with Claude Code