Skip to content

[9.2] [@kbn/scout] Add runtime validation for global.setup.ts (#248113)#248514

Merged
steliosmavro merged 2 commits intoelastic:9.2from
steliosmavro:backport/9.2/pr-248113
Jan 13, 2026
Merged

[9.2] [@kbn/scout] Add runtime validation for global.setup.ts (#248113)#248514
steliosmavro merged 2 commits intoelastic:9.2from
steliosmavro:backport/9.2/pr-248113

Conversation

@steliosmavro
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.2:

Questions ?

Please refer to the Backport tool documentation

…8113)

## Summary

This PR replaces the ESLint rule
`scout_require_global_setup_hook_in_parallel_tests` with a runtime
validation in Scout's config validator. The runtime check is more
reliable since it validates the actual config and filesystem state at
execution time, rather than relying on static analysis.

## Changes

**Runtime validation in `@kbn/scout`:**
- Added `runGlobalSetup` to `ScoutTestOptions` type
- `createPlaywrightConfig` now passes `runGlobalSetup` to the config's
`use` object
- `validatePlaywrightConfig` checks that `global.setup.ts` exists when
`runGlobalSetup: true`
- Clear error message with expected file path and resolution steps

**Removed ESLint rule:**
- Deleted `scout_require_global_setup_hook_in_parallel_tests.js` rule
and tests
- Removed from `kbn-eslint-plugin-eslint/index.js` exports
- Removed from `.eslintrc.js` configuration

## Why runtime over ESLint?

- ESLint can't reliably check filesystem/config consistency when values
are computed dynamically
- Runtime validation catches the issue at the right moment (before tests
run)
- Having `global.setup.ts` present but unused is valid (teams may enable
it later)
- The opposite case (`runGlobalSetup: true` without the file) should
fail fast

(cherry picked from commit 80affb2)

# Conflicts:
#	packages/kbn-eslint-plugin-eslint/rules/scout_require_global_setup_hook_in_parallel_tests.js
#	packages/kbn-eslint-plugin-eslint/rules/scout_require_global_setup_hook_in_parallel_tests.test.js
@steliosmavro steliosmavro added the backport This PR is a backport of another PR label Jan 9, 2026
@steliosmavro steliosmavro enabled auto-merge (squash) January 9, 2026 17:47
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jan 12, 2026

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/scout 201 202 +1
@kbn/scout-oblt 208 209 +1
@kbn/scout-search 205 206 +1
@kbn/scout-security 212 213 +1
total +4
Unknown metric groups

API count

id before after diff
@kbn/scout 538 539 +1
@kbn/scout-oblt 547 548 +1
@kbn/scout-search 543 544 +1
@kbn/scout-security 550 551 +1
total +4

History

@steliosmavro steliosmavro merged commit 3854059 into elastic:9.2 Jan 13, 2026
13 checks passed
@steliosmavro steliosmavro self-assigned this Jan 30, 2026
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