Skip to content

Add local Moon-based validation via scripts/check#256599

Merged
tylersmalley merged 9 commits intoelastic:mainfrom
tylersmalley:moon-check-changes
Apr 4, 2026
Merged

Add local Moon-based validation via scripts/check#256599
tylersmalley merged 9 commits intoelastic:mainfrom
tylersmalley:moon-check-changes

Conversation

@tylersmalley
Copy link
Copy Markdown
Member

@tylersmalley tylersmalley commented Mar 8, 2026

Introduce a new scripts/check entrypoint that uses Moon changed-file resolution to run eslint, jest, and type_check against local, staged, or branch-scoped changes.

Keep the existing eslint, jest, and type_check commands intact for their default direct usage, and only route them through the new validation contract when scoped validation flags are present. This also adds dedicated contract runners for jest, eslint, and type_check, plus clearer help and shallow-repo warnings for the new workflow.

Updates #255391

@tylersmalley tylersmalley force-pushed the moon-check-changes branch 9 times, most recently from 57daa3d to d5c0edb Compare March 20, 2026 18:57
tylersmalley added a commit that referenced this pull request Mar 23, 2026
Part of #256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 23, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Mar 24, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)

# Conflicts:
#	.github/CODEOWNERS
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Mar 24, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)

# Conflicts:
#	.github/CODEOWNERS
kubasobon pushed a commit that referenced this pull request Mar 24, 2026
Part of #256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@tylersmalley tylersmalley force-pushed the moon-check-changes branch 2 times, most recently from f26378d to 4f623c6 Compare March 27, 2026 07:42
@tylersmalley tylersmalley changed the title Moon driven check changes Add local Moon-based validation via scripts/check Mar 27, 2026
@tylersmalley tylersmalley added release_note:skip Skip the PR/issue when compiling release notes backport:all-open Backport to all branches that could still receive a release labels Mar 27, 2026
@tylersmalley tylersmalley requested a review from jbudz March 27, 2026 07:46
@tylersmalley tylersmalley added the Team:Operations Kibana-Operations Team label Mar 27, 2026
@tylersmalley tylersmalley force-pushed the moon-check-changes branch 2 times, most recently from 352d6a1 to b394cb3 Compare March 27, 2026 07:53
@tylersmalley tylersmalley marked this pull request as ready for review March 27, 2026 08:06
tylersmalley and others added 5 commits April 1, 2026 15:50
Introduce a new `scripts/check` entrypoint that uses Moon changed-file resolution to run eslint, jest, and type_check against local, staged, or branch-scoped changes.

Keep the existing `eslint`, `jest`, and `type_check` commands intact for their default direct usage, and only route them through the new validation contract when scoped validation flags are present. This also adds dedicated contract runners for jest, eslint, and type_check, plus clearer help and shallow-repo warnings for the new workflow.
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Comment on lines +856 to +852
let tsconfig = '';
if (fileMatch) {
let dir = Path.dirname(Path.resolve(REPO_ROOT, fileMatch[1]));
while (dir !== REPO_ROOT && dir !== Path.dirname(dir)) {
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.

🟢 Low dev/run_check.ts:856

The while loop in the tsc error handling uses dir !== REPO_ROOT && dir !== Path.dirname(dir) as its condition, so when dir equals REPO_ROOT, the loop exits before checking for tsconfig.json at the root. If a TypeScript error occurs in a file whose only owning config is at the repository root, tsconfig remains empty and the suggested rerun command incorrectly omits the --project flag.

-            while (dir !== REPO_ROOT && dir !== Path.dirname(dir)) {
+            while (true) {
🤖 Copy this AI Prompt to have your agent fix this:
In file src/dev/run_check.ts around line 856:

The `while` loop in the tsc error handling uses `dir !== REPO_ROOT && dir !== Path.dirname(dir)` as its condition, so when `dir` equals `REPO_ROOT`, the loop exits before checking for `tsconfig.json` at the root. If a TypeScript error occurs in a file whose only owning config is at the repository root, `tsconfig` remains empty and the suggested rerun command incorrectly omits the `--project` flag.

Evidence trail:
src/dev/run_check.ts lines 854-878 at REVIEWED_COMMIT. The while loop condition at line 856 `while (dir !== REPO_ROOT && dir !== Path.dirname(dir))` prevents the loop body from executing when dir equals REPO_ROOT, so tsconfig.json at the repository root is never checked. Lines 871-877 show that when tsconfig is empty, the fallback command `--profile quick` is used instead of `--project tsconfig.json`.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Apr 2, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Apr 2, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)

# Conflicts:
#	.github/CODEOWNERS
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Apr 2, 2026
Part of elastic#256599 — extracts the shared validation runner infrastructure into its own package to land incrementally.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit edea080)

# Conflicts:
#	.github/CODEOWNERS
Copy link
Copy Markdown
Contributor

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

LGTM. Code review + local testing.

This review was focused on functionality, design, and UX through the CLI.

When this is added to other areas the review scope will expand -

  • agent loop: (e.g. a change in x-pack/test can pull in the whole typescript tree and take 20+ minutes to type check)
  • primary check on CI: the review will enumerate edge cases.

tylersmalley added a commit that referenced this pull request Apr 2, 2026
# Backport

This will backport the following commits from `main` to `8.19`:
- [Add shared validation runner package
(#258768)](#258768)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Tyler
Smalley","email":"tyler.smalley@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T22:12:20Z","message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","backport:all-open","v9.4.0"],"title":"Add shared validation
runner
package","number":258768,"url":"https://github.com/elastic/kibana/pull/258768","mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258768","number":258768,"mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},{"url":"https://github.com/elastic/kibana/pull/259217","number":259217,"branch":"9.3","state":"OPEN"}]}]
BACKPORT-->
tylersmalley added a commit that referenced this pull request Apr 2, 2026
# Backport

This will backport the following commits from `main` to `9.2`:
- [Add shared validation runner package
(#258768)](#258768)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Tyler
Smalley","email":"tyler.smalley@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T22:12:20Z","message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","backport:all-open","v9.4.0"],"title":"Add shared validation
runner
package","number":258768,"url":"https://github.com/elastic/kibana/pull/258768","mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258768","number":258768,"mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},{"url":"https://github.com/elastic/kibana/pull/259217","number":259217,"branch":"9.3","state":"OPEN"}]}]
BACKPORT-->
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 3, 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/test 349 366 +17
@kbn/ts-type-check-cli 0 13 +13
total +30

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/test 1 4 +3
Unknown metric groups

API count

id before after diff
@kbn/test 419 439 +20
@kbn/ts-type-check-cli 0 16 +16
total +36

History

@tylersmalley tylersmalley merged commit 3a3c8c5 into elastic:main Apr 4, 2026
19 checks passed
@tylersmalley tylersmalley deleted the moon-check-changes branch April 4, 2026 03:19
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/23970240196

tylersmalley added a commit that referenced this pull request Apr 4, 2026
# Backport

This will backport the following commits from `main` to `9.3`:
- [Add shared validation runner package
(#258768)](#258768)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Tyler
Smalley","email":"tyler.smalley@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T22:12:20Z","message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","backport:all-open","v9.4.0"],"title":"Add shared validation
runner
package","number":258768,"url":"https://github.com/elastic/kibana/pull/258768","mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258768","number":258768,"mergeCommit":{"message":"Add
shared validation runner package (#258768)\n\nPart of #256599 — extracts
the shared validation runner infrastructure into its own package to land
incrementally.\n\n---------\n\nSigned-off-by: Tyler Smalley
<tyler.smalley@elastic.co>","sha":"edea0805670d85d180e4f72a0481adaa68ff909b"}},{"url":"https://github.com/elastic/kibana/pull/259217","number":259217,"branch":"9.3","state":"OPEN"}]}]
BACKPORT-->

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.2:
- [CI] Remove check_oas_snapshot from cancel_on_gate_failure list (#261184)
9.3 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.3:
- [CI] Remove check_oas_snapshot from cancel_on_gate_failure list (#261184)
- [Osquery] Fix prebuilt packs showing numeric Created By on ECH (#261115)

Manual backport

To create the backport manually run:

node scripts/backport --pr 256599

Questions ?

Please refer to the Backport tool documentation

nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Apr 5, 2026
Introduce a new `scripts/check` entrypoint that uses Moon changed-file
resolution to run eslint, jest, and type_check against local, staged, or
branch-scoped changes.

Keep the existing `eslint`, `jest`, and `type_check` commands intact for
their default direct usage, and only route them through the new
validation contract when scoped validation flags are present. This also
adds dedicated contract runners for jest, eslint, and type_check, plus
clearer help and shallow-repo warnings for the new workflow.

Updates elastic#255391

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 6, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 256599 locally
cc: @tylersmalley

3 similar comments
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 256599 locally
cc: @tylersmalley

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 256599 locally
cc: @tylersmalley

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 256599 locally
cc: @tylersmalley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release backport missing Added to PRs automatically when the are determined to be missing a backport. release_note:skip Skip the PR/issue when compiling release notes Team:Operations Kibana-Operations Team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants