[9.3] Scout: enable Selective testing in Pull Requests (#261510)#262959
Merged
dmlemeshko merged 1 commit intoelastic:9.3from Apr 14, 2026
Merged
[9.3] Scout: enable Selective testing in Pull Requests (#261510)#262959dmlemeshko merged 1 commit intoelastic:9.3from
dmlemeshko merged 1 commit intoelastic:9.3from
Conversation
## 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)
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
cc @dmlemeshko |
dmlemeshko
added a commit
that referenced
this pull request
Apr 16, 2026
…3086) # Backport This will backport the following commits from `main` to `9.2`: - [Scout: enable Selective testing in Pull Requests (#261510)](#261510) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2026-04-14T07:51:52Z","message":"Scout: enable Selective testing in Pull Requests (#261510)\n\n## Summary\n\nCloses https://github.com/elastic/appex-qa-team/issues/700\n\nThis PR enables Scout selective testing as a _default test execution for\nevery PR targeting tracked branch_ (e.g. `main`).\n\n### What selective testing means for kibana-contributors?\n\n- When a PR build runs, `list_affected` uses git diff against the merge\nbase to find which `@kbn/` modules have changed files (including\ndownstream dependents) This produces a JSON array of affected module\nIDs.\n\n- Scout CLI uses this file to find all the matching test configs: each\nScout module's config path is resolved to its `@kbn/` ID via\n`kibana.jsonc`. Scout config discovery filters down to only the affected\nmodules — so CI only creates Buildkite steps for Scout tests belonging\nto changed modules (packages and plugins)\n\n- PR builds run only the Scout tests scoped to the changed modules,\ncutting wall-to-wall build time.\n\n**Critical files bypass**\nA new `resolve_selective_testing.ts` script runs before config\ndiscovery. In a single git invocation it:\n\n1. Computes the affected modules and writes the JSON file consumed by\n`discover-playwright-configs`.\n2. Checks whether any critical Scout files were touched (e.g.\npackage.json, yarn.lock, Scout runtime packages, the CI pipeline scripts\nthemselves) using touchedCriticalFiles against a new\n`CRITICAL_FILES_SCOUT` constant — following the same pattern already\nused for Jest unit and integration tests.\n\nIf critical files are detected, selective testing is bypassed and the\nfull suite runs. The affected-module labels on Buildkite steps are\nalways applied regardless, since `--affected-modules` is passed\nunconditionally and `--selective-testing` is a separate flag.\n\n\n\n<img width=\"1833\" height=\"665\" alt=\"Screenshot 2026-04-07 at 14 17 28\"\nsrc=\"https://github.com/user-attachments/assets/918ad0f8-28c4-471d-93fe-577264cf85f1\"\n/>\n\n\n**Note**: The `scout:run-all-tests` label enforces the full test matrix\nwhile still showing which modules were affected.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b3c331750e67222a9c0f48f15f2b829d9c71e28e","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:QA","release_note:skip","backport:all-open","test:scout","v9.4.0","v9.5.0","v9.3.4"],"title":"Scout: enable Selective testing in Pull Requests","number":261510,"url":"https://github.com/elastic/kibana/pull/261510","mergeCommit":{"message":"Scout: enable Selective testing in Pull Requests (#261510)\n\n## Summary\n\nCloses https://github.com/elastic/appex-qa-team/issues/700\n\nThis PR enables Scout selective testing as a _default test execution for\nevery PR targeting tracked branch_ (e.g. `main`).\n\n### What selective testing means for kibana-contributors?\n\n- When a PR build runs, `list_affected` uses git diff against the merge\nbase to find which `@kbn/` modules have changed files (including\ndownstream dependents) This produces a JSON array of affected module\nIDs.\n\n- Scout CLI uses this file to find all the matching test configs: each\nScout module's config path is resolved to its `@kbn/` ID via\n`kibana.jsonc`. Scout config discovery filters down to only the affected\nmodules — so CI only creates Buildkite steps for Scout tests belonging\nto changed modules (packages and plugins)\n\n- PR builds run only the Scout tests scoped to the changed modules,\ncutting wall-to-wall build time.\n\n**Critical files bypass**\nA new `resolve_selective_testing.ts` script runs before config\ndiscovery. In a single git invocation it:\n\n1. Computes the affected modules and writes the JSON file consumed by\n`discover-playwright-configs`.\n2. Checks whether any critical Scout files were touched (e.g.\npackage.json, yarn.lock, Scout runtime packages, the CI pipeline scripts\nthemselves) using touchedCriticalFiles against a new\n`CRITICAL_FILES_SCOUT` constant — following the same pattern already\nused for Jest unit and integration tests.\n\nIf critical files are detected, selective testing is bypassed and the\nfull suite runs. The affected-module labels on Buildkite steps are\nalways applied regardless, since `--affected-modules` is passed\nunconditionally and `--selective-testing` is a separate flag.\n\n\n\n<img width=\"1833\" height=\"665\" alt=\"Screenshot 2026-04-07 at 14 17 28\"\nsrc=\"https://github.com/user-attachments/assets/918ad0f8-28c4-471d-93fe-577264cf85f1\"\n/>\n\n\n**Note**: The `scout:run-all-tests` label enforces the full test matrix\nwhile still showing which modules were affected.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b3c331750e67222a9c0f48f15f2b829d9c71e28e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/262960","number":262960,"state":"MERGED","mergeCommit":{"sha":"f6504aed0dc507f3e7efbea70c9d52ab81771bbe","message":"[9.4] Scout: enable Selective testing in Pull Requests (#261510) (#262960)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.4`:\n- [Scout: enable Selective testing in Pull Requests\n(#261510)](https://github.com/elastic/kibana/pull/261510)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>"}},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/261510","number":261510,"mergeCommit":{"message":"Scout: enable Selective testing in Pull Requests (#261510)\n\n## Summary\n\nCloses https://github.com/elastic/appex-qa-team/issues/700\n\nThis PR enables Scout selective testing as a _default test execution for\nevery PR targeting tracked branch_ (e.g. `main`).\n\n### What selective testing means for kibana-contributors?\n\n- When a PR build runs, `list_affected` uses git diff against the merge\nbase to find which `@kbn/` modules have changed files (including\ndownstream dependents) This produces a JSON array of affected module\nIDs.\n\n- Scout CLI uses this file to find all the matching test configs: each\nScout module's config path is resolved to its `@kbn/` ID via\n`kibana.jsonc`. Scout config discovery filters down to only the affected\nmodules — so CI only creates Buildkite steps for Scout tests belonging\nto changed modules (packages and plugins)\n\n- PR builds run only the Scout tests scoped to the changed modules,\ncutting wall-to-wall build time.\n\n**Critical files bypass**\nA new `resolve_selective_testing.ts` script runs before config\ndiscovery. In a single git invocation it:\n\n1. Computes the affected modules and writes the JSON file consumed by\n`discover-playwright-configs`.\n2. Checks whether any critical Scout files were touched (e.g.\npackage.json, yarn.lock, Scout runtime packages, the CI pipeline scripts\nthemselves) using touchedCriticalFiles against a new\n`CRITICAL_FILES_SCOUT` constant — following the same pattern already\nused for Jest unit and integration tests.\n\nIf critical files are detected, selective testing is bypassed and the\nfull suite runs. The affected-module labels on Buildkite steps are\nalways applied regardless, since `--affected-modules` is passed\nunconditionally and `--selective-testing` is a separate flag.\n\n\n\n<img width=\"1833\" height=\"665\" alt=\"Screenshot 2026-04-07 at 14 17 28\"\nsrc=\"https://github.com/user-attachments/assets/918ad0f8-28c4-471d-93fe-577264cf85f1\"\n/>\n\n\n**Note**: The `scout:run-all-tests` label enforces the full test matrix\nwhile still showing which modules were affected.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b3c331750e67222a9c0f48f15f2b829d9c71e28e"}},{"branch":"9.3","label":"v9.3.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/262959","number":262959,"state":"MERGED","mergeCommit":{"sha":"454c1dff03f1fd64247bff4e457bd6b332914018","message":"[9.3] Scout: enable Selective testing in Pull Requests (#261510) (#262959)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.3`:\n- [Scout: enable Selective testing in Pull Requests\n(#261510)](https://github.com/elastic/kibana/pull/261510)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>"}},{"url":"https://github.com/elastic/kibana/pull/263016","number":263016,"branch":"8.19","state":"OPEN"}]}] BACKPORT-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.3:Questions ?
Please refer to the Backport tool documentation