Skip to content

ci(acceptance): Run 5 shards for frontend-only changes too - #131271

Closed
sentry-junior[bot] wants to merge 2 commits into
masterfrom
ci/acceptance-five-shards
Closed

sentry-junior[bot] wants to merge 2 commits into
masterfrom
ci/acceptance-five-shards

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Acceptance now always runs 5 shards. Frontend-only changes used to get 10.

Each shard spends about 2m on setup (devservices, the venv, and webpack) before it runs any tests, and per-shard xdist overhead grows the total test time as well. Doubling the shard count doubles the runner time and saves little wall time:

Acceptance PR run Runner-minutes Wall p50
10 shards (frontend-only) 32 4.2m
5 shards 19 4.7m

Master shows the same pattern: 37 vs 23 runner-minutes, with wall time 4.8m vs 5.5m.

Trade-off: frontend-only runs save about 13 runner-minutes each, and those are about two thirds of acceptance PR runs. Their wall time grows by about 0.5m, which puts Acceptance roughly level with Frontend (p50 4.5m, p90 5.0m) instead of ahead of it. The 10-shard split was added when setup took about 2.5m and the suite was slower. Open question: is +0.5m on frontend-only PRs acceptable for this saving?

Refs DI-2876

via @BYK.

--

View Session [Sentry]

Frontend-only runs used 10 shards. Each shard spends about 2 minutes on
setup, so the extra 5 shards cost about 13 runner-minutes per run and
saved only about half a minute of wall time.

Refs DI-2876

Co-Authored-By: Burak Yigit Kaya <[email protected]>
@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

DI-2876

joshuarli added a commit that referenced this pull request Nov 16, 2026
The acceptance workflow runs on almost every pull request and costs a
lot of runner time. This change makes pull requests run only the
acceptance tests their changes can reach. Pushes to master still run
everything, so anything the selector misses shows up on master and we
improve the selector from there.

Refs DI-2876

A new `select-tests` job decides what to run. It follows backend.yml's
`select-tests`:

- Changed files come from `parse-pr-files.py`, piped from `gh api`
exactly as backend.yml does it.
- The `Trigger: Override Selective Testing` label turns selection off
through the same `skip_selective_testing` output.
- The selector writes the same kind of file for `SELECTED_TESTS_FILE`.

What it selects:

- Changes to the workflow, harness, settings, dependencies, build config
or templates run everything. So do files the selector doesn't recognize.
- Python under `src/` maps to tests through per-test coverage. A new
daily scheduled run of this workflow, which can also be started by hand,
records it. Until the first run, Python changes run everything.
- Frontend files map to tests through a static import graph and a page
map kept by hand. Changes to the shared app shell run everything.

If selection fails, everything runs. If nothing is selected, the
acceptance jobs are skipped and the required `Acceptance` status still
succeeds.

Shared with backend selection, in the new `selected_tests_common.py`:

- the Python files that always run the whole suite, moved from
`compute-sentry-selected-tests.py`
- matching files against those triggers
- the per-test coverage query

The backend selector's behavior doesn't change. Only acceptance has the
frontend import graph, the page map, and the app shell rules.

The daily run combines the shards' coverage only when every shard
passed, then saves it with `actions/cache`. Pull requests restore the
newest copy, so they need no artifact lookup or extra permissions.

Two lines of inline shell stay:

- The existing run step gains one line that appends the coverage flags.
- `uvx coverage combine` is one call. Coverage isn't in the stdlib, and
that job doesn't have the sentry virtualenv.

Known gaps: Python code that only runs at import time, imports the
frontend graph can't parse, and pages that are missing from the page
map.

#131271 edits the same matrix lines; whichever lands
second keeps both behaviors. With #131264, merge queue
runs still run everything.

<!-- junior-request-attribution:start -->
via @joshuarli.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A1715dc6ab4670d38b8ce3142b22c1d71 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A1715dc6ab4670d38b8ce3142b22c1d71)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A1715dc6ab4670d38b8ce3142b22c1d71/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <[email protected]>
@joshuarli

Copy link
Copy Markdown
Member

needs to be revisited after #131325 soaks for a bit

…shards

# Conflicts:
#	.github/workflows/acceptance.yml
@sentry-junior

sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense, I'll keep this as a draft until #131325 has had time to soak.

I merged master into this branch. The new version keeps the shard count from select-tests whenever it selects tests, and only changes the fallback for full runs, from 5 or 10 shards to always 5. That fallback now covers master pushes, labelled overrides, and PRs whose changes the selector can't map. Once #131325 has soaked, I'll re-measure how often PRs still hit the fallback, and update the numbers in the description or close this if the saving is no longer worth it.

This branch was successfully deployed

1 active deployment
Preview — 99cceada Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants