Repository navigation
Conversation
Lint rules and static import walks cannot see dynamic imports that execute during startup, so this adds a runtime check: boot a dev Kibana against a snapshot Elasticsearch with the require-graph preload in a new HEAP_TRACK_REQUIRE_ONLY mode (records require edges and the SIGUSR1 dump, skips V8 allocation tracking so startup stays fast), dump the graph once the server reports available, and fail if any banned browser-only or GenAI-stack package was loaded. - node scripts/check_server_module_graph runs the whole flow and owns process-group teardown; on failure it prints per-package module counts and the exact modules importing into each banned package. - Zero tolerance, no allowlist: @elastic/eui, refractor, prismjs, @elastic/apm-rum*, react-intl, react-use, react-redux, redux, @reduxjs/*, @langchain/*, langsmith, openai, gpt-tokenizer, js-tiktoken, @modelcontextprotocol/*, google-auth-library, zod-to-json-schema. react, react-dom and @emotion/* are deliberately not banned: core's rendering service renders the bootstrap template with React on the server. - Wired as a PR pipeline step (server_module_graph.yml). Verified end to end on this branch: the gate boots, dumps 31,476 modules, reports 17 banned packages with exact counts and import sites, and exits 1. It will stay red until the EUI and GenAI lazy-loading changes and their three flagged follow-ups (fleet react-intl, share react-use, aiops redux) land. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
This was referenced Oct 30, 2026
This branch has not been deployed
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
Adds a CI gate asserting on the Kibana server's runtime module graph: a dev Kibana is booted against a snapshot Elasticsearch with a require-graph preload, and once the server reports available the gate dumps every module in
require.cacheand fails if any banned browser-only or GenAI-stack package was loaded at startup.This is a runtime check on purpose. The lint rule in #300920 catches direct imports, but static analysis cannot see dynamic imports that execute during startup — exactly the failure mode found (empirically) while building #300921, where a lazily-imported module was still loaded during
initializeResources.Pieces
HEAP_TRACK_REQUIRE_ONLY=1mode for the existing@kbn/heap-snapshot-analyzer-clipreload: records require edges + the SIGUSR1 dump, skips V8 allocation tracking so startup stays fast.node scripts/check_server_module_graph: boots ES + Kibana, waits for availability, settles, dumps, asserts, and tears everything down. On failure it prints per-package module counts and the exact modules importing into each banned package — the import sites to fix:server_module_graph.yml, mirrors the OAS-snapshot step).Banlist (zero tolerance, no allowlist)
@elastic/eui,refractor,prismjs,@elastic/apm-rum*,react-intl,react-use,react-redux,redux,@reduxjs/*,@langchain/*,langsmith,openai,gpt-tokenizer,js-tiktoken,@modelcontextprotocol/*,google-auth-library,zod-to-json-schema.react,react-domand@emotion/*are deliberately not banned: core's rendering service legitimately renders the bootstrap HTML template with React on the server.This gate is intentionally strict and will stay red until all of the following land (it must not be merged before them):
agent_policy_settings.tsx(react-intl), shareurl_service(react-useuseMountedState), aiopsstream_reducer(@reduxjs/toolkit)Verification
main, so violations exist by construction): boots, dumps 31,476 modules, reports all 17 banned packages with exact counts and import sites, exits 1.@kbn/heap-snapshot-analyzer-clitype check and lint clean;.buildkiteworkspace typecheck clean.🤖 Generated with Claude Code