Repository navigation
fix: match capture v1 rules for empty names, drop logs, retry identity and typed values - #903
turnipdabeets wants to merge 22 commits into
Conversation
…ntity and typed values
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 0f90073: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
posthog-android Compliance ReportDate: 2026-10-31T02:25:10.553732+00:00 ✅ All Tests Passed!232/232 tests passed Capture_V1 Tests✅ 105/105 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
… without results (#905) * fix: keep the personless option when a legacy person processing property is set A passed or registered `$process_person_profile` property no longer stops the SDK from setting `process_person_profile: false` when person processing is off. The send hoists the property only into an unset option, so an option set by any layer wins, as the capture spec requires. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: treat a 2xx without readable per-event results as a terminal failure A 2xx whose body can't be read as `{"results": {...}}` no longer counts the batch as delivered. It throws a PostHogApiError with that status, which the queue drops without retrying, and logs only the status and event count, as the capture spec requires. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ption Reverts the person-processing half of #905. A passed or registered `$process_person_profile` property again stops the SDK from adding `process_person_profile: false` when person processing is off, so the caller wins, as the client property precedence in sdk-specs `capture` (#143) requires. The send still hoists the property into the option. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ytes - The capture v1 per-batch debug line names the endpoint and counts the dropped events by their `details` tag (opaque strings, never uuids or content), e.g. `ai_event_too_big: 1, misrouted_event: 1`. - Sending events cached by 2.x/3.x closes a batch before it would pass the 5 MiB capture v1 byte target, as the queue does, so a large migrated batch isn't lost to a 413. Order is kept and an event over the target ships alone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…v1-rubric-followups Moves this branch's queue changes into enqueueEvent(), where #904 put capture's queueing step.
…v1-rubric-followups
eli-r-ph
left a comment
There was a problem hiding this comment.
Both token messages now print with
logWarning, also without debug, so this line can say so and mention the empty token too.
"Flushing failed with N, dropping M records" doesn't say which queue or endpoint. Could it include the queue's label?
| if (config.projectToken.isEmpty()) { | ||
| config.logger.log( | ||
| config.logger.logWarning( | ||
| "PostHog SDK is disabled because the project token is required and was empty after trimming whitespace.", |
There was a problem hiding this comment.
posthog-server goes through this path, so it now drops empty event names, merges typed $set/$set_once/$groups per key, and prints these warnings without debug. Could a posthog-server changeset say so, and a test cover the captureStateless path?
There was a problem hiding this comment.
Fixed in 15e60c7 — added a posthog-server changeset and captureStateless tests for empty names and typed merges.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also adds the posthog-server changeset for them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…v1-rubric-followups # Conflicts: # .changeset/android-v4-major.md # docs/migration-3.x-to-4.0.md
…v1-rubric-followups
…v1-rubric-followups
💡 Motivation and Context
Follow-ups on the capture v1 branch (#881) to match the fleet rules the other v1 SDKs follow:
capture(""), or abeforeSendthat renames an event to"", is dropped before sending and logged once (debug). Capture drops these anyway; now they never leave the device. Only an exactly-empty name, same as iOS #989 and Flutter desktop fix(server): keep locally evaluated flags when one flag is inconclusive #681.duplicates_dropped), matching iOS.userProperties,userPropertiesSetOnceandgroupsare merged over a$set,$set_onceor$groupsmap passed in the same call's properties, instead of being replaced by it.$groupsmap in properties adds to the groups set withgroup()instead of replacing them; typedgroupsstill win per key. Matches iOS.NaNand infinite numbers are dropped from the properties.Not changed here: if capture asks to retry a uuid that was duplicated in the batch, the queue still keeps every copy of that uuid. The SDK never sends duplicate uuids itself, so this only happens after a
beforeSendbug.💚 How did you test it?
./gradlew :posthog:test :posthog-android:testDebugUnitTest :posthog:apiCheck spotlessCheckpass.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (updated the existing 4.0 major changeset)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
$groupsmerge rules, so both SDKs build these maps the same way.🤖 Generated with Claude Code