fix: use underscores in ES connector filenames to avoid build exclusion#245326
Merged
Kiryous merged 9 commits intoelastic:mainfrom Dec 5, 2025
Merged
fix: use underscores in ES connector filenames to avoid build exclusion#245326Kiryous merged 9 commits intoelastic:mainfrom
Kiryous merged 9 commits intoelastic:mainfrom
Conversation
Files with '.test.' in the name are excluded from production builds. The elasticsearch.query_rules.test API endpoint was being excluded because its generated filename contained '.test.' which triggered the exclusion rule. This changes the generator to use underscores instead of dots in filenames (e.g., elasticsearch.query_rules_test.gen.ts instead of elasticsearch.query_rules.test.gen.ts) while keeping the runtime 'type' field unchanged for compatibility.
Contributor
💔 Build Failed
Failed CI StepsHistory
|
VladimirFilonov
approved these changes
Dec 5, 2025
wildemat
pushed a commit
to wildemat/kibana
that referenced
this pull request
Dec 5, 2025
…on (elastic#245326) close elastic/security-team#14960 ## Summary Fixes a runtime error on Kibana Serverless where the `@kbn/workflows` module fails to load due to a missing file. ## Problem Files with `.test.` in their filename are excluded from production builds by the `excludeFileByTags` function in `build_packages_task.ts`. The Elasticsearch `query_rules.test` API endpoint was being excluded because its generated filename (`elasticsearch.query_rules.test.gen.ts`) contained `.test.`, which triggered the build exclusion rule. This caused the following runtime error on Serverless: ``` Error: Cannot find module './elasticsearch.query_rules.test.gen' Require stack: - /usr/share/kibana/node_modules/@kbn/workflows/spec/elasticsearch/generated/index.js ``` ## Solution Updated the ES connector generator to use underscores instead of dots in filenames while keeping the runtime `type` field unchanged for compatibility. | Before | After | |--------|-------| | `elasticsearch.query_rules.test.gen.ts` | `elasticsearch.query_rules_test.gen.ts` | | ❌ Excluded by build | ✅ Included in build | The `type` field inside each contract (e.g., `'elasticsearch.query_rules.test'`) remains unchanged, so all runtime lookups continue to work correctly. ## Testing - [x] Built Kibana locally with `yarn build --skip-os-packages` - [x] Verified the file exists in the serverless build output - [x] Verified the `@kbn/workflows` module loads successfully from the built distribution ## Changes - Modified `generate_es_connectors.ts` to use underscores in generated filenames - Regenerated all ES connector files with the new naming convention ## Risk Low - This is a filename-only change. The runtime behavior and API contracts remain identical. --------- Co-authored-by: Kirill Chernakov <kirill.chernakov@elastic.co> Co-authored-by: Kirill Chernakov <yakiryous@gmail.com>
This was referenced Dec 5, 2025
JordanSh
pushed a commit
to JordanSh/kibana
that referenced
this pull request
Dec 9, 2025
…on (elastic#245326) close elastic/security-team#14960 ## Summary Fixes a runtime error on Kibana Serverless where the `@kbn/workflows` module fails to load due to a missing file. ## Problem Files with `.test.` in their filename are excluded from production builds by the `excludeFileByTags` function in `build_packages_task.ts`. The Elasticsearch `query_rules.test` API endpoint was being excluded because its generated filename (`elasticsearch.query_rules.test.gen.ts`) contained `.test.`, which triggered the build exclusion rule. This caused the following runtime error on Serverless: ``` Error: Cannot find module './elasticsearch.query_rules.test.gen' Require stack: - /usr/share/kibana/node_modules/@kbn/workflows/spec/elasticsearch/generated/index.js ``` ## Solution Updated the ES connector generator to use underscores instead of dots in filenames while keeping the runtime `type` field unchanged for compatibility. | Before | After | |--------|-------| | `elasticsearch.query_rules.test.gen.ts` | `elasticsearch.query_rules_test.gen.ts` | | ❌ Excluded by build | ✅ Included in build | The `type` field inside each contract (e.g., `'elasticsearch.query_rules.test'`) remains unchanged, so all runtime lookups continue to work correctly. ## Testing - [x] Built Kibana locally with `yarn build --skip-os-packages` - [x] Verified the file exists in the serverless build output - [x] Verified the `@kbn/workflows` module loads successfully from the built distribution ## Changes - Modified `generate_es_connectors.ts` to use underscores in generated filenames - Regenerated all ES connector files with the new naming convention ## Risk Low - This is a filename-only change. The runtime behavior and API contracts remain identical. --------- Co-authored-by: Kirill Chernakov <kirill.chernakov@elastic.co> Co-authored-by: Kirill Chernakov <yakiryous@gmail.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.
close https://github.com/elastic/security-team/issues/14960
Summary
Fixes a runtime error on Kibana Serverless where the
@kbn/workflowsmodule fails to load due to a missing file.Problem
Files with
.test.in their filename are excluded from production builds by theexcludeFileByTagsfunction inbuild_packages_task.ts. The Elasticsearchquery_rules.testAPI endpoint was being excluded because its generated filename (elasticsearch.query_rules.test.gen.ts) contained.test., which triggered the build exclusion rule.This caused the following runtime error on Serverless:
Solution
Updated the ES connector generator to use underscores instead of dots in filenames while keeping the runtime
typefield unchanged for compatibility.elasticsearch.query_rules.test.gen.tselasticsearch.query_rules_test.gen.tsThe
typefield inside each contract (e.g.,'elasticsearch.query_rules.test') remains unchanged, so all runtime lookups continue to work correctly.Testing
yarn build --skip-os-packages@kbn/workflowsmodule loads successfully from the built distributionChanges
generate_es_connectors.tsto use underscores in generated filenamesRisk
Low - This is a filename-only change. The runtime behavior and API contracts remain identical.