[Alerting v2] Compose Discover follow-up: post-merge review fixes#269011
Merged
Conversation
- revert metadata.tags ?? [] — API rejects empty array; omit the key entirely when tags is absent or empty (tags only valid with ≥1 item) - merge duplicate @kbn/code-editor imports in child and query_summary - use paths.ruleCreate constant instead of inline URL string in rules_list_page (consistent with rest of plugin) - replace inline AstNode interface with isOptionNode type guard from @elastic/esql, eliminating the unsafe cast Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
isOptionNode's input type (ESQLAstNode) differs from ESQLAstItem, so .filter(isOptionNode) on statsCmd.args doesn't narrow the type. Revert to a local CmdOption alias + explicit cast — same approach that passed CI in the merged PR. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
The CI failure is a breaking test in Fix: --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/utils/rule_request_mappers.test.ts
+++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/utils/rule_request_mappers.test.ts
@@ -268,9 +268,31 @@ describe('rule_request_mappers', () => {
name: 'My Rule',
description: 'A description',
owner: 'owner',
- tags: [],
});
expect(result.metadata).not.toHaveProperty('enabled');
+ expect(result.metadata).not.toHaveProperty('tags');
+ });
+
+ it('omits tags from metadata when tags array is empty', () => {
+ const formValues: FormValues = {
+ ...baseFormValues,
+ metadata: { ...baseFormValues.metadata, tags: [] },
+ };
+
+ const result = mapFormValuesToRuleRequest(formValues);
+
+ expect(result.metadata).not.toHaveProperty('tags');
+ });
+
+ it('omits tags from metadata when tags is undefined', () => {
+ const formValues: FormValues = {
+ ...baseFormValues,
+ metadata: { ...baseFormValues.metadata, tags: undefined },
+ };
+
+ const result = mapFormValuesToRuleRequest(formValues);
+
+ expect(result.metadata).not.toHaveProperty('tags');
}); |
yiannisnikolopoulos
approved these changes
May 13, 2026
Contributor
yiannisnikolopoulos
left a comment
There was a problem hiding this comment.
Lgtm 👍 , posted a comment for the failing test
Empty tags array should produce no tags key in the output (per API schema which rejects empty arrays). Update test to assert tags is absent rather than expecting tags: []. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
💛 Build succeeded, but was flaky
Failed CI Steps
Test Failures
Metrics [docs]Async chunks
History
|
This was referenced May 13, 2026
DennisKo
pushed a commit
to DennisKo/kibana
that referenced
this pull request
May 13, 2026
…astic#269011) ## Summary Follow-up to elastic#268774 addressing feedback from Bailey and Yiannis left after merge. ## Changes **Bug fix (Yiannis):** `metadata.tags ?? []` revert — the API schema marks `tags` as optional but requires `.min(1)` if present, so sending `[]` is rejected. The key is now omitted entirely when tags is absent or empty. **Nits (Bailey):** - Merge duplicate `@kbn/code-editor` imports in `compose_discover_child.tsx` and `query_summary.tsx` - Use `paths.ruleCreate` constant in `rules_list_page.tsx` instead of the inline URL string (consistent with the rest of the plugin) - Replace the inline `AstNode` interface + unsafe cast in `compose_discover_form.tsx` with `isOptionNode` type guard from `@elastic/esql` ## Scout test tracking The deleted `quick_edit_rule.spec.ts` tests are tracked in elastic#268958 (child of M2 epic rna-program#482). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kelvtanv
pushed a commit
to kelvtanv/kibana
that referenced
this pull request
May 14, 2026
…astic#269011) ## Summary Follow-up to elastic#268774 addressing feedback from Bailey and Yiannis left after merge. ## Changes **Bug fix (Yiannis):** `metadata.tags ?? []` revert — the API schema marks `tags` as optional but requires `.min(1)` if present, so sending `[]` is rejected. The key is now omitted entirely when tags is absent or empty. **Nits (Bailey):** - Merge duplicate `@kbn/code-editor` imports in `compose_discover_child.tsx` and `query_summary.tsx` - Use `paths.ruleCreate` constant in `rules_list_page.tsx` instead of the inline URL string (consistent with the rest of the plugin) - Replace the inline `AstNode` interface + unsafe cast in `compose_discover_form.tsx` with `isOptionNode` type guard from `@elastic/esql` ## Scout test tracking The deleted `quick_edit_rule.spec.ts` tests are tracked in elastic#268958 (child of M2 epic rna-program#482). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: kibanamachine <42973632+kibanamachine@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
Follow-up to #268774 addressing feedback from Bailey and Yiannis left after merge.
Changes
Bug fix (Yiannis):
metadata.tags ?? []revert — the API schema markstagsas optional but requires.min(1)if present, so sending[]is rejected. The key is now omitted entirely when tags is absent or empty.Nits (Bailey):
@kbn/code-editorimports incompose_discover_child.tsxandquery_summary.tsxpaths.ruleCreateconstant inrules_list_page.tsxinstead of the inline URL string (consistent with the rest of the plugin)AstNodeinterface + unsafe cast incompose_discover_form.tsxwithisOptionNodetype guard from@elastic/esqlScout test tracking
The deleted
quick_edit_rule.spec.tstests are tracked in #268958 (child of M2 epic rna-program#482).🤖 Generated with Claude Code