:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(test): reset ConcurrencyController between tests to prevent flaky StickinessLineChart (#62835)
mendral-app[bot]1bfadd1bdd87
diff --git a/frontend/jest.setup.ts b/frontend/jest.setup.tsindex fc7e37504fa5..8f6ffc490cc9 100644--- a/frontend/jest.setup.ts+++ b/frontend/jest.setup.ts@@ -122,6 +122,18 @@ configure({ testIdAttribute: 'data-attr' })// Mock DecompressionWorkerManager globally to avoid import.meta.url issues in testsjest.mock('scenes/session-recordings/player/snapshot-processing/DecompressionWorkerManager')+// Mock ConcurrencyController to be a pass-through. The module-level singleton in+// dataNodeLogic persists across test files on the same Jest worker (resetModules is+// disabled). Under CI load, stale items can block subsequent tests' queries indefinitely.+// Tests don't need concurrency limiting, so we bypass it entirely.+jest.mock('lib/utils/concurrencyController', () => {+ class ConcurrencyController {+ run = <T>({ fn }: { fn: () => Promise<T> }): Promise<T> => fn()+ setConcurrencyLimit = (): void => {}+ }+ return { ConcurrencyController }+})+// Mock posthog-js surveys-preview to avoid ESM import issues in testsjest.mock('posthog-js/dist/surveys-preview', () => ({renderFeedbackWidgetPreview: jest.fn(),diff --git a/frontend/src/lib/utils/concurrencyController.test.ts b/frontend/src/lib/utils/concurrencyController.test.tsindex b222f5b1b29f..5146d4cabbd7 100644--- a/frontend/src/lib/utils/concurrencyController.test.ts+++ b/frontend/src/lib/utils/concurrencyController.test.ts@@ -1,3 +1,5 @@+jest.unmock('lib/utils/concurrencyController')+import { delay } from 'lib/utils'import { ConcurrencyController } from './concurrencyController'