Skip to content

[ML] @kbn/ml-common-types & @kbn/ml-server-schemas#238060

Merged
rbrtj merged 51 commits into
elastic:mainfrom
walterra:237808-ml-common-types
Apr 28, 2026
Merged

[ML] @kbn/ml-common-types & @kbn/ml-server-schemas#238060
rbrtj merged 51 commits into
elastic:mainfrom
walterra:237808-ml-common-types

Conversation

@walterra
Copy link
Copy Markdown
Contributor

@walterra walterra commented Oct 8, 2025

Summary

Part of #237808 and #189755.
Related to #197967.

  • This PR moves ML type definitions from the ML plugin (plugins/ml/common/types/*) to a new package @kbn/ml-common-types. This refactoring is part of a larger effort to remove loading async bundles on page loads.
  • This means for solutions importing this code will now import from @kbn/ml-common-types/... instead of @kbn/ml-plugin/....
  • Some barrel files/export (export * from ...) were removed and replaced with deep imports to reduce the risk of running into circular dependencies and bundle size explosion.
  • Some consts (or our variants of enums with as const) were moved to this package to avoid future circular dependency risk regarding the upcoming @kbn/ml-common-constants package.
  • Moves API schemas to a new ml-server-schemas package. This is a shared-server package, meaning that any common and public packages/plugins can import types from it, but no runtime code. It's convenient to expose types from the schemas, so I had to make ml-common-types depend on this new package.

Review hint for teams being triggered for code owners review: Sorry this touches a lot of files but code touched outside the scope of ML should be just updated imports.

Checklist

  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@walterra walterra self-assigned this Oct 8, 2025
@walterra walterra force-pushed the 237808-ml-common-types branch 3 times, most recently from 18c299c to 3bf9a7f Compare October 9, 2025 11:09
@walterra walterra added :ml release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.2.0 labels Oct 9, 2025
@walterra walterra force-pushed the 237808-ml-common-types branch 3 times, most recently from 4a1d243 to f23e9f9 Compare October 10, 2025 08:37
@walterra walterra force-pushed the 237808-ml-common-types branch from f23e9f9 to 794e223 Compare October 10, 2025 12:37
@walterra walterra marked this pull request as ready for review October 13, 2025 06:18
@walterra walterra requested review from a team as code owners October 13, 2025 06:18
@rbrtj rbrtj requested review from a team as code owners April 27, 2026 08:25
Copy link
Copy Markdown
Contributor

@macroscopeapp macroscopeapp Bot left a comment

Choose a reason for hiding this comment

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

Scout Test Review: found 1 issue. See inline comments for details.

Share feedback in the #appex-qa channel.

Posted via Macroscope — Scout Test Review

Copy link
Copy Markdown
Contributor

@MadameSheema MadameSheema left a comment

Choose a reason for hiding this comment

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

sec-eng-prod changes LGTM!

Copy link
Copy Markdown
Contributor

@tcalopes tcalopes left a comment

Choose a reason for hiding this comment

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

entity-analytics changes LGTM

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
indexManagement 781 782 +1
ml 4229 4231 +2
securitySolution 9360 9364 +4
total +7

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
ml 78 56 -22

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
ml 3 1 -2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 5.8MB 5.8MB +5.3KB
securitySolution 12.0MB 12.0MB +1.2KB
total +6.5KB

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/ml-common-types - 74 +74
ml 109 38 -71
total +3

Page load bundle

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

id before after diff
ml 90.6KB 88.6KB -2.0KB
securitySolution 152.0KB 151.8KB -132.0B
total -2.1KB
Unknown metric groups

API count

id before after diff
ml 165 88 -77

ESLint disabled line counts

id before after diff
@kbn/ml-common-types - 1 +1
ml 551 550 -1
total -0

References to deprecated APIs

id before after diff
@kbn/ml-common-types - 2 +2
ml 56 54 -2
total -0

Total ESLint disabled count

id before after diff
@kbn/ml-common-types - 1 +1
ml 554 553 -1
total -0

Unreferenced deprecated APIs

id before after diff
@kbn/ml-common-types - 2 +2
ml 56 54 -2
total -0

History

cc @walterra @rbrtj

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

Labels

backport:skip This PR does not require backporting ci:use-selective-testing Turns on selective testing features for the PR CI run :ml release_note:skip Skip the PR/issue when compiling release notes v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.