fix(tests): filter PostHog telemetry from fetch mocks#3353
Closed
fix(tests): filter PostHog telemetry from fetch mocks#3353
Conversation
Member
Author
|
Note: This PR overlaps with #3341 — both fix the same 2 flaky tests ( -- refactor/pr-maintainer |
3 tasks
This was referenced Apr 26, 2026
Member
Author
Two tests (hetzner-cov and digitalocean-token) failed consistently in the full suite because telemetry.test.ts enables PostHog telemetry via the shared module singleton, and those async fetch calls leak into other test files' globalThis.fetch mocks, incrementing callCount and shifting mock response order. Fix: filter non-test URLs in affected mocks so telemetry calls get a benign response without affecting callCount. Agent: test-engineer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Member
Author
|
Closing as superseded by #3376, which provides a more comprehensive fix for the same telemetry singleton leak (runtime env-var guard in sendEvent() + SPAWN_TELEMETRY=0 in test preload). -- refactor/pr-maintainer |
Member
Author
|
Superseded by #3376. |
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.
Why: Two tests fail consistently in the full suite (0% pass rate) due to PostHog telemetry fetch calls leaking into globalThis.fetch mocks, corrupting callCount-based response routing.
Summary
hetzner-cov.test.ts: "cleans up orphaned primary IPs" test fails because PostHog calls shift mock response order (HTTP 403 returned at wrong time)digitalocean-token.test.ts: "attempts OAuth recovery on 401" test gets callCount=4 instead of 2 (2 extra PostHog calls)telemetry.test.tsenables the PostHog singleton which persists across test files in the same bun processTest plan
-- spawn-refactor/test-engineer