chore: lazy-load server plugin modules (security-solution)#266619
Merged
chore: lazy-load server plugin modules (security-solution)#266619
Conversation
2 tasks
Member
Author
|
@elasticmachine merge upstream |
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]
History
|
szaffarano
approved these changes
May 5, 2026
Contributor
|
Thanks! |
Contributor
|
Starting backport for target branches: 9.4 https://github.com/elastic/kibana/actions/runs/25372993721 |
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
May 5, 2026
…6619) (#267701) # Backport This will backport the following commits from `main` to `9.4`: - [chore: lazy-load server plugin modules (security-solution) (#266619)](#266619) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alejandro Fernández Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2026-05-05T11:12:50Z","message":"chore: lazy-load server plugin modules (security-solution) (#266619)\n\n## Summary\n\nLazy-load server plugin implementations via `await import('./plugin')`\n(and related entrypoint adjustments) from `server/index.ts`, consistent\nwith https://github.com/elastic/kibana/pull/170856.\n\nThe migration in #170856 reduced **startup time by ~4 seconds** in\nmeasured scenarios. **Memory savings were not quantified but are\nexpected.**\n\n## CODEOWNERS\n\n- `indices_metadata` → @elastic/security-solution\n\n## Follow-up\n\n- #171080 — add an ESLint rule\nso new plugins follow this pattern.\n\n---\n\n**Disclaimer:** This PR was prepared with AI assistance (Cursor /\nClaude); please review thoroughly.","sha":"08345467a0ba73065b1722c4badba63a5f6022d0","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","backport:version","v9.4.0","v9.5.0"],"title":"chore: lazy-load server plugin modules (security-solution)","number":266619,"url":"https://github.com/elastic/kibana/pull/266619","mergeCommit":{"message":"chore: lazy-load server plugin modules (security-solution) (#266619)\n\n## Summary\n\nLazy-load server plugin implementations via `await import('./plugin')`\n(and related entrypoint adjustments) from `server/index.ts`, consistent\nwith https://github.com/elastic/kibana/pull/170856.\n\nThe migration in #170856 reduced **startup time by ~4 seconds** in\nmeasured scenarios. **Memory savings were not quantified but are\nexpected.**\n\n## CODEOWNERS\n\n- `indices_metadata` → @elastic/security-solution\n\n## Follow-up\n\n- #171080 — add an ESLint rule\nso new plugins follow this pattern.\n\n---\n\n**Disclaimer:** This PR was prepared with AI assistance (Cursor /\nClaude); please review thoroughly.","sha":"08345467a0ba73065b1722c4badba63a5f6022d0"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/266619","number":266619,"mergeCommit":{"message":"chore: lazy-load server plugin modules (security-solution) (#266619)\n\n## Summary\n\nLazy-load server plugin implementations via `await import('./plugin')`\n(and related entrypoint adjustments) from `server/index.ts`, consistent\nwith https://github.com/elastic/kibana/pull/170856.\n\nThe migration in #170856 reduced **startup time by ~4 seconds** in\nmeasured scenarios. **Memory savings were not quantified but are\nexpected.**\n\n## CODEOWNERS\n\n- `indices_metadata` → @elastic/security-solution\n\n## Follow-up\n\n- #171080 — add an ESLint rule\nso new plugins follow this pattern.\n\n---\n\n**Disclaimer:** This PR was prepared with AI assistance (Cursor /\nClaude); please review thoroughly.","sha":"08345467a0ba73065b1722c4badba63a5f6022d0"}}]}] BACKPORT--> Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
afharo
added a commit
that referenced
this pull request
May 5, 2026
…266636)⚠️ CI is failing until all plugins are migrated (2 tiny PRs pending to be approved). - [x] #266620 - [x] #266619 ## Summary Implements the ESLint rule requested in #171080 to support the plugin server entry pattern from #170856: `server/index.ts` should not synchronously load `./plugin` (value imports, re-exports, side-effect `import './plugin'`, or `require('./plugin')`); `import type` / `export type` and dynamic `import()` are allowed. - New rule: `@kbn/eslint/no_sync_import_from_plugin` in `@kbn/eslint-plugin-eslint` with Jest tests. - `@kbn/eslint-config` override for plugin `server/index.ts` paths: rule is `error` so CI enforces the pattern; the number of violations should decrease as lazy-load `server/index.ts` migrations land. - `AGENTS.md`: document the pattern and the rule. **Closes** #171080 ## Review disclaimer This PR was drafted with AI assistance (Cursor / Composer). Please give it a thorough review—especially rule edge cases and interaction with in-flight migration PRs. Made with [Cursor](https://cursor.com) --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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.
Summary
Lazy-load server plugin implementations via
await import('./plugin')(and related entrypoint adjustments) fromserver/index.ts, consistent with #170856.The migration in #170856 reduced startup time by ~4 seconds in measured scenarios. Memory savings were not quantified but are expected.
CODEOWNERS
indices_metadata→ @elastic/security-solutionFollow-up
Disclaimer: This PR was prepared with AI assistance (Cursor / Claude); please review thoroughly.