Repository navigation
fix: drop empty event names locally and count duplicates capture dropped - #989
Open
turnipdabeets wants to merge 5 commits into
Open
turnipdabeets wants to merge 5 commits into
turnipdabeets wants to merge 5 commits into
Conversation
Drop an event whose name is empty after beforeSend before it's queued, logging the first one. Read duplicates_dropped from capture v1 results and add it to the per-batch debug count.
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 |
Contributor
posthog-ios Compliance ReportDate: 2026-10-29T19:52:06.591697+00:00 ✅ All Tests Passed!233/233 tests passed Capture_V1 Tests✅ 106/106 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
…er the same maps in properties
5 tasks done
5 of 6 tasks
… person processing as an option (#990) Count a capture v1 2xx whose body can't be read as per-event results as a dropped batch in the debug log, not as delivered. The records are still removed and not retried. Save person processing in the crash context as the process_person_profile option instead of the legacy $process_person_profile property, and pass it when the crash and memory exception reporters send the $exception. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…log terminal batch losses - Check for an empty event name in queueEvent, so screen, identify, alias, group and autocapture events that beforeSend renames to "" are dropped like capture's. - identify ignores a whitespace-only distinct ID and no longer logs it. - The capture v1 aggregate debug line names the endpoint and status, and counts the batch on a terminal status (400, 401, 402, 415, or a single-event 413). 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.
💡 Motivation and Context
Three small capture v1 parity gaps on the 4.0 branch, so iOS matches the other v1 SDKs:
Empty event names were sent and then dropped by capture. Typed v1 SDKs drop
""locally instead.capture("")andcaptureAi("")now drop the event before it's queued, including whenbeforeSendrenames it to"".captureAireturnsnil, and the first one is logged withdebugon.duplicates_dropped: capture v1 now keeps the first copy of a repeated UUID and reports how many later copies it dropped on that result. The SDK ignored the field. It now adds it to the per-batch debug count (Capture: 0 dropped, 2 duplicates dropped, 0 to retry.), and a repeated UUID in one request takes its first copy's result once instead of being counted per copy.Typed values win key by key:
userProperties,userPropertiesSetOnceandgroupsnow win key by key over$set,$set_onceand$groupsmaps passed in the same call's properties, matching posthog-android. Before, a$setor$set_oncein the properties replaced the per-call value, and$groupsin the properties won per key.iOS generates a fresh v7 UUID for every event and callers can't set one, so duplicates only happen through an SDK bug. Known limit: if the kept copy comes back
retry, the queue keeps every record with that UUID (records are matched by UUID), so a dropped copy is resent with it. Capture drops it again, and nothing is lost.Stacked on #938.
💚 How did you test it?
PostHogCaptureV1Test: empty names viacapture,captureAi, and abeforeSendrename are not sent;duplicates_droppedis counted once per UUID. Both fail on the base branch and pass here.swift test --no-parallel --filter PostHogCaptureV1Test: 48 tests pass.PostHogSDKTestscase for typed values winning key by key fails on the base branch and passes here;PostHogSDKTests(79 tests) passes.swiftformat --lintandswiftlintshow no new warnings.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (added a line to the existingv4-capture-v1changeset)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
beforeSend, so a hook can't rename an event to""past it. Whitespace-only names are still sent, matching the other v1 SDKs, which only reject"".duplicates_droppedgoes into the existing debug count, since iOS has no per-event failure callback.🤖 Generated with Claude Code