Repository navigation
fix: drop a 2xx batch without readable results and send crash-context person processing as an option - #990
Merged
Conversation
Contributor
posthog-ios Compliance ReportDate: 2026-10-29T15:00:00.783667+00:00
|
| Test | Status | Duration |
|---|---|---|
| Endpoint And Method.Targets V1 Endpoint | ✅ | 2933ms |
| Endpoint And Method.Does Not Use Legacy Endpoints | ✅ | 2734ms |
| Required Headers.Has Authorization Bearer Header | ✅ | 2770ms |
| Required Headers.Has Content Type Json | ✅ | 2783ms |
| Required Headers.Has Posthog Sdk Info Format | ✅ | 2706ms |
| Required Headers.Has Posthog Attempt Header | ✅ | 2805ms |
| Required Headers.Has Posthog Request Id | ✅ | 2741ms |
| Required Headers.Has Posthog Request Timestamp | ✅ | 2822ms |
| Required Headers.Has User Agent | ✅ | 2835ms |
| Body Format.Body Has Created At And Batch | ✅ | 2785ms |
| Body Format.No Api Key In Body | ✅ | 2809ms |
| Body Format.No Sent At In Body | ✅ | 2779ms |
| Event Format.Event Has Required Root Fields | ✅ | 2767ms |
| Event Format.Event Uuid Is Valid | ✅ | 2777ms |
| Event Format.Event Timestamp Is Rfc3339 | ✅ | 313ms |
| Event Format.Non Utc Event Timestamp Is Converted To Utc | ✅ | 2847ms |
| Event Format.Distinct Id Is String | ✅ | 2820ms |
| Event Format.Distinct Id At Root Not Properties | ✅ | 2772ms |
| Event Format.Custom Properties Preserved | ✅ | 2751ms |
| Event Format.Set Properties Preserved | ✅ | 2735ms |
| Event Format.Set Once Properties Preserved | ✅ | 2804ms |
| Event Format.Groups Properties Preserved | ✅ | 2715ms |
| Event Format.Sdk Generates Uuid If Not Provided | ✅ | 2747ms |
| Event Format.Event Has Required Root Fields Batch | ✅ | 2754ms |
| Event Format.Event Uuid Is Valid Batch | ✅ | 2908ms |
| Event Format.Event Timestamp Is Rfc3339 Batch | ✅ | 2839ms |
| Event Format.Distinct Id Is String Batch | ✅ | 2884ms |
| Event Format.Distinct Id At Root Not Properties Batch | ✅ | 2918ms |
| Event Format.Custom Properties Preserved Batch | ✅ | 2817ms |
| Event Format.Set Properties Preserved Batch | ✅ | 2752ms |
| Event Format.Set Once Properties Preserved Batch | ✅ | 2877ms |
| Event Format.Groups Properties Preserved Batch | ✅ | 2891ms |
| Event Format.Sdk Generates Uuid If Not Provided Batch | ✅ | 2761ms |
| Batch Behavior.Multiple Events In Single Batch | ✅ | 2863ms |
| Batch Behavior.Batch Envelope Smoke | ✅ | 2810ms |
| Batch Behavior.Flush With No Events Sends Nothing | ✅ | 327ms |
| Batch Behavior.Flush At Triggers Batch | ✅ | 1285ms |
| Batch Behavior.Created At Reflects Batch Creation Time | ✅ | 2810ms |
| Deduplication.Generates Unique Uuids | ✅ | 2908ms |
| Deduplication.Different Events Same Content Different Uuids | ✅ | 2910ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 9190ms |
| Deduplication.Preserves Timestamp On Retry | ✅ | 5379ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 7893ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 2905ms |
| Header Behavior On Retry.Attempt Header Starts At One | ✅ | 2656ms |
| Header Behavior On Retry.Attempt Header Increments On Retry | ✅ | 16702ms |
| Header Behavior On Retry.Request Id Preserved On Retry | ✅ | 5415ms |
| Header Behavior On Retry.Different Requests Have Different Request Ids | ✅ | 7456ms |
| Header Behavior On Retry.Request Timestamp Changes On Retry | ✅ | 8894ms |
| Response Format Validation.Success Response Has Uuid Keyed Results | ✅ | 2685ms |
| Response Format Validation.Success Response Has Ok For Each Event | ✅ | 2776ms |
| Response Format Validation.Success No Retry After When All Ok | ✅ | 2808ms |
| Response Format Validation.Success Retry After Present When Retry Events | ✅ | 2737ms |
| Response Format Validation.Success No Retry After When Drop Only | ✅ | 2824ms |
| Response Format Validation.Response Echoes Request Id | ✅ | 2683ms |
| Retry Behavior.Retries On 408 | ✅ | 9323ms |
| Retry Behavior.Retries On 500 | ✅ | 9223ms |
| Retry Behavior.Retries On 503 | ✅ | 11747ms |
| Retry Behavior.Retries On 504 | ✅ | 5292ms |
| Retry Behavior.Retryable Errors Have Retry After | ✅ | 6233ms |
| Retry Behavior.Respects Retry After On Retryable Error | ✅ | 8315ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 4784ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 4764ms |
| Retry Behavior.Does Not Retry On 402 | ✅ | 4787ms |
| Retry Behavior.Does Not Retry On 413 | ✅ | 4812ms |
| Retry Behavior.Does Not Retry On 415 | ✅ | 2367ms |
| Retry Behavior.Non Retryable Errors Have No Retry After | ✅ | 4733ms |
| Retry Behavior.Implements Backoff | ✅ | 19215ms |
| Retry Behavior.Max Retries Respected | ❌ | 21699ms |
| Partial Batch Handling.Handles 200 Full Success | ✅ | 4693ms |
| Partial Batch Handling.Handles 200 With All Ok | ✅ | 5897ms |
| Partial Batch Handling.Does Not Retry Dropped Events | ✅ | 5852ms |
| Partial Batch Handling.Does Not Retry Limited Events | ✅ | 5818ms |
| Partial Batch Handling.Prunes Ok Events On Partial Retry | ✅ | 7878ms |
| Partial Batch Handling.Prunes Dropped Events On Partial Retry | ✅ | 7982ms |
| Partial Batch Handling.Retries Only Retry Events From Partial | ✅ | 7773ms |
| Partial Batch Handling.Partial Retry Preserves Uuids | ✅ | 7869ms |
| Partial Batch Handling.Partial Retry Attempt Header Increments | ✅ | 7848ms |
| Partial Batch Handling.Partial Retry Request Id Preserved | ✅ | 7835ms |
| Partial Batch Handling.Respects Retry After On Partial | ✅ | 7868ms |
| Partial Batch Handling.Unknown Result Treated As Terminal | ✅ | 5696ms |
| Partial Batch Handling.Mixed Ok Drop Limited No Retry | ✅ | 5744ms |
| Compression.Sends Gzip Content Encoding | ✅ | 2760ms |
| Compression.No Content Encoding When Disabled | ✅ | 2657ms |
| Compression.Compressed Body Is Decompressible | ✅ | 283ms |
| Error Handling.Does Not Retry On Unknown 4Xx | ✅ | 4878ms |
| Event Options.Cookieless Mode Override | ✅ | 282ms |
| Event Options.Disable Skew Correction Override | ✅ | 2800ms |
| Event Options.Process Person Profile Override | ✅ | 2855ms |
| Event Options.Product Tour Id Override | ✅ | 2764ms |
| Event Options.Unset Options Omitted | ✅ | 2715ms |
| Event Options.Options Override In Batch | ✅ | 2719ms |
| Event Options.Unknown Option Passes Through | ✅ | 2646ms |
| Event Options.Option Value Is Not Converted | ✅ | 2766ms |
| Event Options.Lenient Bool Option Values Are Not Converted | ✅ | 356ms |
| Event Options.Option Wins Over Legacy Property | ✅ | 2696ms |
| Event Options.Legacy Property Fills Unset Option | ✅ | 2725ms |
| Event Options.Null Option Falls Back To Legacy Property | ✅ | 2781ms |
| Geoip And Historical Migration.Geoip Disable Injected Into Properties | ✅ | 2731ms |
| Geoip And Historical Migration.Historical Migration Set In Body | ❌ | 2765ms |
| Geoip And Historical Migration.Historical Migration Absent By Default | ✅ | 435ms |
Failures
retry_behavior.max_retries_respected
Expected 4 requests, got 5
geoip_and_historical_migration.historical_migration_set_in_body
Body missing 'historical_migration' field. Body keys: ['batch', 'created_at']
Capture_Ai_V1 Tests
View Details
| Test | Status | Duration |
|---|---|---|
| Endpoint And Method.Targets V1 Endpoint | ✅ | 2665ms |
| Endpoint And Method.Does Not Use Legacy Endpoints | ✅ | 2634ms |
| Endpoint And Method.Capture Does Not Reroute Ai Named Events | ✅ | 2781ms |
| Required Headers.Has Authorization Bearer Header | ✅ | 2679ms |
| Required Headers.Has Content Type Json | ✅ | 2728ms |
| Required Headers.Has Posthog Sdk Info Format | ✅ | 2842ms |
| Required Headers.Has Posthog Attempt Header | ✅ | 2821ms |
| Required Headers.Has Posthog Request Id | ✅ | 2762ms |
| Required Headers.Has Posthog Request Timestamp | ✅ | 2719ms |
| Required Headers.Has User Agent | ✅ | 384ms |
| Body Format.Body Has Created At And Batch | ✅ | 2673ms |
| Body Format.No Api Key In Body | ✅ | 2741ms |
| Body Format.No Sent At In Body | ✅ | 399ms |
| Event Format.Event Has Required Root Fields | ✅ | 2732ms |
| Event Format.Event Uuid Is Valid | ✅ | 2767ms |
| Event Format.Event Timestamp Is Rfc3339 | ✅ | 303ms |
| Event Format.Non Utc Event Timestamp Is Converted To Utc | ✅ | 2693ms |
| Event Format.Distinct Id Is String | ✅ | 2735ms |
| Event Format.Distinct Id At Root Not Properties | ✅ | 2670ms |
| Event Format.Custom Properties Preserved | ✅ | 2697ms |
| Event Format.Set Properties Preserved | ✅ | 2691ms |
| Event Format.Set Once Properties Preserved | ✅ | 2804ms |
| Event Format.Groups Properties Preserved | ✅ | 2688ms |
| Event Format.Sdk Generates Uuid If Not Provided | ✅ | 2732ms |
| Event Format.Capture Ai Keeps Supplied Uuid | ❌ | 122ms |
| Event Format.Event Has Required Root Fields Batch | ❌ | 2920ms |
| Event Format.Event Uuid Is Valid Batch | ✅ | 2870ms |
| Event Format.Event Timestamp Is Rfc3339 Batch | ✅ | 2807ms |
| Event Format.Distinct Id Is String Batch | ✅ | 2875ms |
| Event Format.Distinct Id At Root Not Properties Batch | ✅ | 2787ms |
| Event Format.Custom Properties Preserved Batch | ✅ | 2783ms |
| Event Format.Set Properties Preserved Batch | ✅ | 2846ms |
| Event Format.Set Once Properties Preserved Batch | ✅ | 2806ms |
| Event Format.Groups Properties Preserved Batch | ✅ | 2834ms |
| Event Format.Sdk Generates Uuid If Not Provided Batch | ✅ | 413ms |
| Batch Behavior.Multiple Events In Single Batch | ✅ | 2888ms |
| Batch Behavior.Batch Envelope Smoke | ✅ | 2862ms |
| Batch Behavior.Flush At Triggers Batch | ✅ | 1165ms |
| Batch Behavior.Created At Reflects Batch Creation Time | ✅ | 2804ms |
| Deduplication.Generates Unique Uuids | ✅ | 2910ms |
| Deduplication.Different Events Same Content Different Uuids | ✅ | 3215ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 5384ms |
| Deduplication.Preserves Timestamp On Retry | ✅ | 8762ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 7800ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 2994ms |
| Header Behavior On Retry.Attempt Header Starts At One | ✅ | 2833ms |
| Header Behavior On Retry.Attempt Header Increments On Retry | ✅ | 16859ms |
| Header Behavior On Retry.Request Id Preserved On Retry | ✅ | 9261ms |
| Header Behavior On Retry.Different Requests Have Different Request Ids | ✅ | 2573ms |
| Header Behavior On Retry.Request Timestamp Changes On Retry | ✅ | 9215ms |
| Response Format Validation.Success Response Has Uuid Keyed Results | ✅ | 2826ms |
| Response Format Validation.Success Response Has Ok For Each Event | ✅ | 3147ms |
| Response Format Validation.Success No Retry After When All Ok | ✅ | 3191ms |
| Response Format Validation.Success Retry After Present When Retry Events | ✅ | 2868ms |
| Response Format Validation.Success No Retry After When Drop Only | ✅ | 2786ms |
| Response Format Validation.Response Echoes Request Id | ✅ | 2750ms |
| Retry Behavior.Retries On 408 | ✅ | 9232ms |
| Retry Behavior.Retries On 500 | ✅ | 5396ms |
| Retry Behavior.Retries On 503 | ✅ | 11253ms |
| Retry Behavior.Retries On 504 | ✅ | 9167ms |
| Retry Behavior.Retryable Errors Have Retry After | ✅ | 6220ms |
| Retry Behavior.Respects Retry After On Retryable Error | ✅ | 10704ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 4788ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 4753ms |
| Retry Behavior.Does Not Retry On 402 | ✅ | 4714ms |
| Retry Behavior.Does Not Retry On 413 | ✅ | 4777ms |
| Retry Behavior.Does Not Retry On 415 | ✅ | 4764ms |
| Retry Behavior.Non Retryable Errors Have No Retry After | ✅ | 4659ms |
| Retry Behavior.Implements Backoff | ✅ | 21644ms |
| Retry Behavior.Max Retries Respected | ❌ | 15324ms |
| Partial Batch Handling.Handles 200 Full Success | ✅ | 4673ms |
| Partial Batch Handling.Handles 200 With All Ok | ✅ | 5882ms |
| Partial Batch Handling.Does Not Retry Dropped Events | ✅ | 5767ms |
| Partial Batch Handling.Does Not Retry Limited Events | ✅ | 5867ms |
| Partial Batch Handling.Prunes Ok Events On Partial Retry | ✅ | 7935ms |
| Partial Batch Handling.Prunes Dropped Events On Partial Retry | ✅ | 7724ms |
| Partial Batch Handling.Retries Only Retry Events From Partial | ✅ | 7813ms |
| Partial Batch Handling.Partial Retry Preserves Uuids | ✅ | 7840ms |
| Partial Batch Handling.Partial Retry Attempt Header Increments | ✅ | 7797ms |
| Partial Batch Handling.Partial Retry Request Id Preserved | ✅ | 8015ms |
| Partial Batch Handling.Respects Retry After On Partial | ✅ | 7821ms |
| Partial Batch Handling.Unknown Result Treated As Terminal | ✅ | 5995ms |
| Partial Batch Handling.Mixed Ok Drop Limited No Retry | ✅ | 5799ms |
| Compression.Sends Gzip Content Encoding | ✅ | 2818ms |
| Compression.No Content Encoding When Disabled | ✅ | 2821ms |
| Compression.Compressed Body Is Decompressible | ✅ | 255ms |
| Error Handling.Does Not Retry On Unknown 4Xx | ✅ | 4750ms |
| Event Options.Cookieless Mode Override | ✅ | 2785ms |
| Event Options.Disable Skew Correction Override | ✅ | 2745ms |
| Event Options.Process Person Profile Override | ✅ | 2722ms |
| Event Options.Product Tour Id Override | ✅ | 267ms |
| Event Options.Unset Options Omitted | ✅ | 2806ms |
| Event Options.Options Override In Batch | ✅ | 399ms |
| Event Options.Unknown Option Passes Through | ✅ | 2760ms |
| Event Options.Option Value Is Not Converted | ✅ | 2769ms |
| Event Options.Lenient Bool Option Values Are Not Converted | ✅ | 2764ms |
| Event Options.Option Wins Over Legacy Property | ✅ | 2826ms |
| Event Options.Legacy Property Fills Unset Option | ✅ | 411ms |
| Event Options.Null Option Falls Back To Legacy Property | ✅ | 2768ms |
| Geoip And Historical Migration.Geoip Disable Injected Into Properties | ✅ | 2786ms |
| Geoip And Historical Migration.Historical Migration Absent By Default | ✅ | 2894ms |
Failures
event_format.capture_ai_keeps_supplied_uuid
Expected last action result '0198c0de-0000-7000-8000-000000000abc', got '01a18826-608f-71fb-8c4d-f2e72ed59e38'
event_format.event_has_required_root_fields_batch
Expected 1 requests, got 2
retry_behavior.max_retries_respected
Expected 4 requests, got 5
Feature_Flags Tests
✅ 17/17 tests passed
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ✅ | 2852ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 2830ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 2864ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 2801ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 2851ms |
| Request Payload.Groups Round Trip | ✅ | 2815ms |
| Request Payload.Groups Default To Empty Object | ✅ | 2796ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ✅ | 2837ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ✅ | 2833ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ✅ | 2845ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 60ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 2826ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 5504ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 2765ms |
| Retry Behavior.Retries Flags On 502 | ✅ | 2885ms |
| Retry Behavior.Retries Flags On 504 | ✅ | 2851ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 2923ms |
marandaneto
approved these changes
Oct 29, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
… person processing as an option 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>
turnipdabeets
force-pushed
the
fix/v4-v1-followups-2
branch
from
October 29, 2026 14:35
b697dee to
77b0a21
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
Two capture v1 gaps against the SDK spec (PostHog/sdk-specs#146), stacked on #989:
{"results": {...}}was logged as delivered. The spec makes it a terminal failure of the whole batch. The queue outcome doesn't change (records are removed, not retried), but the debug log now counts the batch as dropped. The log stays content-free.$process_person_profileproperty, which the send then hoisted. The spec says SDK-internal code sets theprocess_person_profileoption directly. The snapshot now saves it asoptions, and the crash and memory exception reporters pass it to the$exception. A crash saved by an older build still carries the property, which hoisting still handles.Neither changes what reaches PostHog, so there's no changeset or migration-guide entry.
A whitespace-only token was also on the list, but
PostHogConfigalready trims the token, so the existing empty check disables the SDK (covered bynoOpsSetupWhenProjectTokenIsEmpty). No change needed.💚 How did you test it?
malformedSuccessDropsBatchandcrashContextSavesPersonlessOption. Both fail with the source changes reverted.swift test --filter "PostHogCaptureV1|PostHogSDKTest|ErrorTracking": 153 tests pass.make test: onlyPostHogStorageTestgroup-container cases andPostHogLogsQueueTestfail. Both fail on the base branch locally too (the logs ones are flaky).📝 Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code from a list of capture v1 spec discrepancies. The whitespace-token item was dropped after checking that
PostHogConfigtrims the token.🤖 Generated with Claude Code