Skip to content

feat(ci): extend shuffle-tests with automatic detect-test-pollution#108286

Draft
joshuarli wants to merge 20 commits intomasterfrom
shuffle-tests-across-shards
Draft

feat(ci): extend shuffle-tests with automatic detect-test-pollution#108286
joshuarli wants to merge 20 commits intomasterfrom
shuffle-tests-across-shards

Conversation

@joshuarli
Copy link
Member

@joshuarli joshuarli commented Feb 14, 2026

This extends the shuffle-tests job to, on test failure, run detect-test-pollution.py which automatically bisects down to the polluting test.

That bisection process would otherwise tie up a local dev environment for ~1 hour (numerous pytest runs needed) and cannot be parallelized (unless we have disposable dev environment VMs - which is basically what CI is today).

This'll make shuffle-tests much, much, much more actionable and I expect to very quickly burn down any test pollution.

This also:

  • changes shuffle-tests to run more often but in off-hours so we don't tie up GHA capacity during working hours
  • adds some optimizations (since selected testids are ordered, we can truncate the candidate list up to and including the failing test)

Manually triggered workflow runs are here (start from #22)

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 14, 2026
@joshuarli joshuarli changed the title feat(ci): shuffle tests across shards feat(ci): extend shuffle-tests with automatic detect-test-pollution Feb 17, 2026
…revent test pollution

Partition flag validation in `_cleanup()` was happening after
`_validate_and_setup_environment()`, which sets `os.environ["_SENTRY_CLEANUP"]`.
When validation raised a ClickException, the env var was left set, causing
subsequent tests to skip error event deletion (the env var makes group deletion
skip `ErrorEventsDeletionTask`).
The test_put_self_hosted_superuser_access_allowed test sets
auth.allow-registration to 1 via the API, which persists in the
database across tests when using --reuse-db. This pollutes
test_customer_domain_feature which expects only organizations:create
and system:multi-region in features, but gets an unexpected
auth:register feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant