Skip to content

ci(acceptance): Select acceptance tests on pull requests - #131325

Merged
joshuarli merged 4 commits into
masterfrom
ci/acceptance-selective-testing
Nov 16, 2026
Merged

joshuarli merged 4 commits into
masterfrom
ci/acceptance-selective-testing

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

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.

via @joshuarli.

--

View Session [Sentry]

Pull requests now run only the acceptance tests that their changes can
reach. Frontend changes map through a static import graph and a
test-to-page map, Python changes through per-test coverage that a daily
scheduled acceptance run records, and changed tests run themselves.
Build, harness, dependency, and app-shell changes run the whole suite,
and so does any failure to select. Pushes to master always run the whole
suite, so a test that selection misses fails there.

Refs DI-2876

Co-Authored-By: Joshua Li <[email protected]>
@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

DI-2876

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 16, 2026
sentry-junior Bot and others added 3 commits November 16, 2026 19:41
An unset job output is null, and null == '0' in workflow expressions, so
the whole-suite fallback skipped acceptance instead of running it.

Co-Authored-By: Joshua Li <[email protected]>
A comment body can no longer match across its closing */, so the
pattern has one way to match each comment.

Co-Authored-By: Joshua Li <[email protected]>
The backend and acceptance selectors now share selected_tests_common.py:
the Python full-suite triggers, trigger matching, and the per-test
coverage query. Acceptance reuses parse-pr-files.py and the
skip_selective_testing output from backend.yml for changed files and the
override label.

The four shell scripts are gone. The run step keeps its inline shell with
one more line for the coverage flags. Coverage moves from an artifact
lookup to actions/cache, saved only when every shard passed, and shards
are combined with one inline coverage call.

Refs DI-2876

Co-Authored-By: Joshua Li <[email protected]>
@joshuarli
joshuarli marked this pull request as ready for review November 16, 2026 23:52
@joshuarli
joshuarli requested a review from a team as a code owner November 16, 2026 23:52
@sentry-junior
sentry-junior Bot requested a review from joshuarli November 16, 2026 23:52
@joshuarli
joshuarli merged commit 75c7558 into master Nov 16, 2026
78 checks passed
@joshuarli
joshuarli deleted the ci/acceptance-selective-testing branch November 16, 2026 23:52

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 985b7f2. Configure here.

Comment thread .github/workflows/acceptance.yml Resolved
joshuarli added a commit that referenced this pull request Nov 17, 2026
Adding `Trigger: Override Selective Testing` to a pull request now
starts a full acceptance run right away. Before, it only took effect on
the next push, because the `pull_request` trigger in `acceptance.yml`
left out `labeled`.

Workflow triggers can't filter by label name, so every label event
starts a run:

- **Override label:** the run behaves like a push and runs the full
suite. It shares the PR's concurrency group, so it cancels an in-flight
selective run.
- **Any other label:**
- `detect what files changed` is skipped, so every acceptance job skips.
- The run gets its own concurrency group, so it doesn't cancel the real
run.
  - The aggregator reports as `Acceptance (ignored label event)`.

GitHub counts a job skipped by a condition as passing for required
checks. A skipped job named `Acceptance` could replace a real failure,
or a run still in progress, on the same commit. The rename keeps ignored
runs off the `Acceptance` check.

Trade-offs:
- Each ignored label event still uses a small runner for a few seconds.
- The label condition appears in three places, because concurrency, job
`if` and job `name` can't read workflow `env`.

Open question: none of the `labeled` paths has run on a real label event
yet.

Related: #131325,
#131325 (comment)

Refs DI-2885

<!-- 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]>
jan-auer added a commit that referenced this pull request Nov 17, 2026
…-store

* ref/inline-payload-defaults: (2542 commits)
  feat(classifiers): Support search syntax in classifier list query (#131423)
  ref(settings): Update settings tour entry copy (#131424)
  fix(conversations): Track tab switch from the View Timeline button (#131196)
  ref(sourcemaps): Read has_debug_ids in the source map debugger (#130425)
  ci(acceptance): Re-run on the override selective testing label (#131408)
  feat(inbox): Include inbox URLs in item responses (#131406)
  ref(flags): Remove `organizations:jira-explicit-mapping-removals` (frontend) (#130393)
  ci(acceptance): Select acceptance tests on pull requests (#131325)
  fix(audit-log): Render legacy internal integration token entries (#131042)
  ref(api): Drop the isRecord guard from SentryApiError body reads (#131394)
  ref: bump sentry-protos to 0.120.1 (#131396)
  feat(inbox): add URL configuration for inbox events (#131336)
  fix(circuit-breaker): Don't raise from record_error or record_success when redis fails (#131364)
  fix(redis): Let cluster client_args set the per-node connection limit (#131355)
  fix(sentry-apps): Stop retrying service hooks to blocked or unreachable URLs (#131171)
  fix(charts): Stop tooltip errors when a chart refresh removes series (#131341)
  perf(crons): Make the check-in timeout index partial (#131376)
  feat(api): Know per-operation error codes and read top-level codes (#131362)
  feat(api): Generate error codes and challenge fields from the spec (#131287)
  feat(apidocs): Mark auth-challenge error codes in the error component (#131346)
  ...

# Conflicts:
#	src/sentry/conf/server.py
#	src/sentry/event_manager.py
#	src/sentry/ingest/consumer/attachment_event.py
#	src/sentry/ingest/consumer/processors.py
#	src/sentry/processing/backpressure/topology.py
#	src/sentry/tasks/store.py
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_kafka.py
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py
#	tests/sentry/processing/backpressure/test_checking.py
#	tests/sentry/processing/backpressure/test_monitoring.py
#	tests/sentry/tasks/test_post_process.py
#	tests/sentry/tasks/test_store.py
#	tests/sentry/tasks/test_symbolication.py
sentry-junior Bot added a commit that referenced this pull request Nov 17, 2026
files-changed and select-tests are skipped on schedule and workflow_dispatch.
Without a status function, the implicit success() on acceptance-coverage
counted those skipped ancestors and skipped the job, so no coverage cache was
ever saved and select-tests fell back to the full suite for every Python
change.

Refs #131325

Co-Authored-By: Joshua Li <[email protected]>
joshuarli added a commit that referenced this pull request Nov 17, 2026
`combine acceptance coverage` now runs on `schedule` and
`workflow_dispatch` once every acceptance shard passes, so the
`acceptance-coverage-` cache that `select-tests` restores actually gets
written. Without that cache, every PR that touches Python falls back to
the full acceptance suite.

`files-changed` and `select-tests` are skipped on `schedule`. The job's
`if:` has no status function, so the implicit `success()` stays in place
and also looks at those skipped ancestors, which skips the job even when
`needs.acceptance.result == 'success'`. The `acceptance` job avoids the
same problem with `always() && !cancelled()`. Adding `!cancelled()`
keeps the existing requirement that acceptance itself succeeded.

Until the next scheduled run, a manual `workflow_dispatch` of
`acceptance` on master would seed the cache.

Refs #131325

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_85c55561853e09366939b9c7ceea098a)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_85c55561853e09366939b9c7ceea098a/?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]>
xb18 pushed a commit to xb18/sentry that referenced this pull request Nov 22, 2026
…defaults

* origin/master: (2542 commits)
  feat(classifiers): Support search syntax in classifier list query (getsentry#131423)
  ref(settings): Update settings tour entry copy (getsentry#131424)
  fix(conversations): Track tab switch from the View Timeline button (getsentry#131196)
  ref(sourcemaps): Read has_debug_ids in the source map debugger (getsentry#130425)
  ci(acceptance): Re-run on the override selective testing label (getsentry#131408)
  feat(inbox): Include inbox URLs in item responses (getsentry#131406)
  ref(flags): Remove `organizations:jira-explicit-mapping-removals` (frontend) (getsentry#130393)
  ci(acceptance): Select acceptance tests on pull requests (getsentry#131325)
  fix(audit-log): Render legacy internal integration token entries (getsentry#131042)
  ref(api): Drop the isRecord guard from SentryApiError body reads (getsentry#131394)
  ref: bump sentry-protos to 0.120.1 (getsentry#131396)
  feat(inbox): add URL configuration for inbox events (getsentry#131336)
  fix(circuit-breaker): Don't raise from record_error or record_success when redis fails (getsentry#131364)
  fix(redis): Let cluster client_args set the per-node connection limit (getsentry#131355)
  fix(sentry-apps): Stop retrying service hooks to blocked or unreachable URLs (getsentry#131171)
  fix(charts): Stop tooltip errors when a chart refresh removes series (getsentry#131341)
  perf(crons): Make the check-in timeout index partial (getsentry#131376)
  feat(api): Know per-operation error codes and read top-level codes (getsentry#131362)
  feat(api): Generate error codes and challenge fields from the spec (getsentry#131287)
  feat(apidocs): Mark auth-challenge error codes in the error component (getsentry#131346)
  ...

# Conflicts:
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py
#	tests/sentry/tasks/test_reprocessing2.py
#	tests/sentry/tasks/test_store.py
#	tests/sentry/tasks/test_symbolication.py
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.

2 participants