Repository navigation
test: ignore leaked requests in push and survey translation tests - #892
Merged
Merged
Conversation
Push tests get a per-test token with batch and push-subscription filtering; survey translation suites enable batch filtering.
dustinbyrne
approved these changes
Oct 1, 2026
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 more Swift Testing failures with the same cause as #885: a test reads a request sent by another test's still-running SDK instance.
PostHogPushNotificationTest"registerPushNotificationToken with an explicit appId sends a request" (#889, run)device_token → "tok",app_id → "app": another push test's registrationPostHogSurveyTranslationsTest"survey sent reports each question in the language it was answered in" (#886 re-run; #869)events.first { $0.event == "survey sent" } → nil: another SDK's batch satisfied the wait firstChanges:
MockPostHogServergetspushSubscriptionProjectToken. It works like test: ignore other SDK instances' batches in session event tests #885'sbatchProjectToken, but for/push_subscriptions: requests with a differentapi_keyget a 200 response and aren't recorded.PostHogPushNotificationTestuses a per-testpush_<UUID>token instead of the sharedtestProjectToken, and enables both filters.batchProjectToken. Their SDKs already use a UUID token per test.Test-only.
💚 How did you test it?
Reproduced each failure with an SDK that sends the same kind of request during the test (iOS 26 simulator):
main+ reproPostHogPushNotificationTest: an SDK on the shared token registerstok/appdevice_token → "tok"(same as CI)PostHogSurveyTranslationsTest: an SDK with another token captures an event"survey sent" → nil(same as CI)make lint: no new violations.Other Swift Testing suites that read
/batchor/push_subscriptionswithout a filter are left for a follow-up. Several of them need individual care:PostHogApiTestassertsapi_key == "test_project_token",PostHogExceptionStepsTestdeliberately uses two tokens, andPostHogEventSnapshotTestsstores its token in a golden file.📝 Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Found with Claude Code (Claude Opus 5.5) while getting #886 and #889 green. It follows the pattern from #885.
🤖 Generated with Claude Code