Skip to content

[8.19] Scout: enable Selective testing in Pull Requests (#261510)#263016

Merged
dmlemeshko merged 2 commits intoelastic:8.19from
dmlemeshko:backport/8.19/pr-261510
Apr 14, 2026
Merged

[8.19] Scout: enable Selective testing in Pull Requests (#261510)#263016
dmlemeshko merged 2 commits intoelastic:8.19from
dmlemeshko:backport/8.19/pr-261510

Conversation

@dmlemeshko
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

## Summary

Closes elastic/appex-qa-team#700

This PR enables Scout selective testing as a _default test execution for
every PR targeting tracked branch_ (e.g. `main`).

### What selective testing means for kibana-contributors?

- When a PR build runs, `list_affected` uses git diff against the merge
base to find which `@kbn/` modules have changed files (including
downstream dependents) This produces a JSON array of affected module
IDs.

- Scout CLI uses this file to find all the matching test configs: each
Scout module's config path is resolved to its `@kbn/` ID via
`kibana.jsonc`. Scout config discovery filters down to only the affected
modules — so CI only creates Buildkite steps for Scout tests belonging
to changed modules (packages and plugins)

- PR builds run only the Scout tests scoped to the changed modules,
cutting wall-to-wall build time.

**Critical files bypass**
A new `resolve_selective_testing.ts` script runs before config
discovery. In a single git invocation it:

1. Computes the affected modules and writes the JSON file consumed by
`discover-playwright-configs`.
2. Checks whether any critical Scout files were touched (e.g.
package.json, yarn.lock, Scout runtime packages, the CI pipeline scripts
themselves) using touchedCriticalFiles against a new
`CRITICAL_FILES_SCOUT` constant — following the same pattern already
used for Jest unit and integration tests.

If critical files are detected, selective testing is bypassed and the
full suite runs. The affected-module labels on Buildkite steps are
always applied regardless, since `--affected-modules` is passed
unconditionally and `--selective-testing` is a separate flag.

<img width="1833" height="665" alt="Screenshot 2026-04-07 at 14 17 28"
src="https://github.com/user-attachments/assets/918ad0f8-28c4-471d-93fe-577264cf85f1"
/>

**Note**: The `scout:run-all-tests` label enforces the full test matrix
while still showing which modules were affected.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit b3c3317)

# Conflicts:
#	.buildkite/pipeline-utils/affected-packages/const.ts
@dmlemeshko dmlemeshko added the backport This PR is a backport of another PR label Apr 14, 2026
@dmlemeshko dmlemeshko enabled auto-merge (squash) April 14, 2026 10:45
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 14, 2026

💔 Build Failed

Failed CI Steps

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +127.0B

History

@dmlemeshko dmlemeshko requested a review from a team April 14, 2026 13:45
@dmlemeshko dmlemeshko merged commit 012db5b into elastic:8.19 Apr 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants