From 096542f0b65688c6d512d57f2658961841f217a2 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 10 Apr 2026 11:59:46 +0200 Subject: [PATCH 1/2] chore(bugbot): Add rules to flag test-flake-provoking patterns --- .cursor/BUGBOT.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.cursor/BUGBOT.md b/.cursor/BUGBOT.md index 0ac58c1503ec..9411aa67b915 100644 --- a/.cursor/BUGBOT.md +++ b/.cursor/BUGBOT.md @@ -58,6 +58,10 @@ Do not flag the issues below if they appear in tests. - Flag usage of `expect.objectContaining` and other relaxed assertions, when a test expects something NOT to be included in a payload but there's no respective assertion. - Flag usage of conditionals in one test and recommend splitting up the test for the different paths. - Flag usage of loops testing multiple scenarios in one test and recommend using `(it)|(test).each` instead. +- Flag tests that are likely to introduce flakes. In our case this usually means we wait for some telemetry requests sent from an SDK. Patterns to look out for: + - Only waiting for a request, after an action is performed. Instead, start waiting, perform action, await request promise. + - Race conditions when waiting on multiple requests. Ensure that waiting checks are unique enough and don't depend on a hard order when there's a chance that telemetry can be sent in arbitrary order. + - Timeouts or sleeps in tests. Instead suggest concrete events or other signals to wait on. ## Platform-safe code From 610f1dc3a25ce47ae088bfe6fbbec09c4e573be7 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 10 Apr 2026 12:05:13 +0200 Subject: [PATCH 2/2] one more rule --- .cursor/BUGBOT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.cursor/BUGBOT.md b/.cursor/BUGBOT.md index 9411aa67b915..f4b4bd287271 100644 --- a/.cursor/BUGBOT.md +++ b/.cursor/BUGBOT.md @@ -62,6 +62,7 @@ Do not flag the issues below if they appear in tests. - Only waiting for a request, after an action is performed. Instead, start waiting, perform action, await request promise. - Race conditions when waiting on multiple requests. Ensure that waiting checks are unique enough and don't depend on a hard order when there's a chance that telemetry can be sent in arbitrary order. - Timeouts or sleeps in tests. Instead suggest concrete events or other signals to wait on. +- Flag usage of `getFirstEnvelope*`, `getMultipleEnvelope*` or related test helpers. These are NOT reliable anymore. Instead suggest helpers like `waitForTransaction`, `waitForError`, `waitForSpans`, etc. ## Platform-safe code