Skip to content

Commit 96cd04e

Browse files
authored
Merge branch '8.19' into backport/8.19/pr-223421
2 parents ffdd2f9 + f0b8832 commit 96cd04e

69 files changed

Lines changed: 709 additions & 216 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/ftr_platform_stateful_configs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ disabled:
5151
# Gen AI suites, running with their own pipeline
5252
- x-pack/test/functional_gen_ai/inference/config.ts
5353

54-
# They will be moved to enabled once the first test is added, the first two initial configs are in disabled section
55-
- x-pack/platform/test/functional/config.firefox.ts
56-
- x-pack/platform/test/functional/config_security_basic.ts
5754

5855
defaultQueue: 'n2-4-spot'
5956
enabled:
@@ -250,9 +247,9 @@ enabled:
250247
- x-pack/test/functional/apps/rollup_job/config.ts
251248
- x-pack/test/functional/apps/saved_objects_management/config.ts
252249
- x-pack/test/functional/apps/saved_query_management/config.ts
253-
- x-pack/test/functional/apps/security/config.ts
250+
- x-pack/platform/test/functional/apps/security/config.ts
254251
- x-pack/test/functional/apps/snapshot_restore/config.ts
255-
- x-pack/test/functional/apps/spaces/config.ts
252+
- x-pack/platform/test/functional/apps/spaces/config.ts
256253
- x-pack/test/functional/apps/status_page/config.ts
257254
- x-pack/test/functional/apps/transform/creation/index_pattern/config.ts
258255
- x-pack/test/functional/apps/transform/creation/runtime_mappings_saved_search/config.ts
@@ -264,9 +261,10 @@ enabled:
264261
- x-pack/test/functional/apps/user_profiles/config.ts
265262
- x-pack/test/functional/apps/visualize/config.ts
266263
- x-pack/test/functional/apps/watcher/config.ts
267-
- x-pack/test/functional/config_security_basic.ts
264+
- x-pack/platform/test/functional/config_security_basic.ts
268265
- x-pack/test/functional/config.ccs.ts
269266
- x-pack/test/functional/config.firefox.js
267+
- x-pack/platform/test/functional/config.firefox.ts
270268
- x-pack/test/functional/config.upgrade_assistant.ts
271269
- x-pack/test/functional_cloud/config.ts
272270
- x-pack/test/functional_cloud/saml.config.ts

.github/CODEOWNERS

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql
13761376

13771377
# Elastic Stack Monitoring
13781378
/x-pack/platform/test/monitoring_api_integration @elastic/stack-monitoring
1379-
/x-pack/test/functional/page_objects/monitoring_page.ts @elastic/stack-monitoring
1379+
/x-pack/platform/test/functional/page_objects/monitoring_page.ts @elastic/stack-monitoring
13801380
/x-pack/test/functional/es_archives/monitoring @elastic/stack-monitoring
13811381
/x-pack/test/functional/services/monitoring @elastic/stack-monitoring
13821382
/x-pack/test/functional/apps/monitoring @elastic/stack-monitoring
@@ -1928,15 +1928,14 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi
19281928
^/src/platform/test/plugin_functional/snapshots/baseline/hardening @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/190716
19291929
^/src/platform/test/functional/page_objects/login_page.ts @elastic/kibana-security
19301930
/x-pack/test_serverless/functional/test_suites/observability/role_management @elastic/kibana-security
1931-
/x-pack/test/functional/config_security_basic.ts @elastic/kibana-security
19321931
/x-pack/platform/test/functional/config_security_basic.ts @elastic/kibana-security
19331932
/x-pack/test/functional/page_objects/user_profile_page.ts @elastic/kibana-security
1934-
/x-pack/test/functional/page_objects/space_selector_page.ts @elastic/kibana-security
1935-
/x-pack/test/functional/page_objects/security_page.ts @elastic/kibana-security
1936-
/x-pack/test/functional/page_objects/role_mappings_page.ts @elastic/kibana-security
1937-
/x-pack/test/functional/page_objects/copy_saved_objects_to_space_page.ts @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/39002
1933+
/x-pack/platform/test/functional/page_objects/space_selector_page.ts @elastic/kibana-security
1934+
/x-pack/platform/test/functional/page_objects/security_page.ts @elastic/kibana-security
1935+
/x-pack/platform/test/functional/page_objects/role_mappings_page.ts @elastic/kibana-security
1936+
/x-pack/platform/test/functional/page_objects/copy_saved_objects_to_space_page.ts @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/39002
19381937
/x-pack/test/functional/page_objects/api_keys_page.ts @elastic/kibana-security
1939-
/x-pack/test/functional/page_objects/account_settings_page.ts @elastic/kibana-security
1938+
/x-pack/platform/test/functional/page_objects/account_settings_page.ts @elastic/kibana-security
19401939
/x-pack/test/functional/apps/user_profiles @elastic/kibana-security
19411940
/x-pack/test/common/services/spaces.ts @elastic/kibana-security
19421941
/x-pack/test/api_integration/config_security_*.ts @elastic/kibana-security
@@ -1974,8 +1973,8 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi
19741973
/x-pack/platform/test/api_integration_basic/apis/security/ @elastic/kibana-security
19751974
/x-pack/test/ui_capabilities/ @elastic/kibana-security
19761975
/x-pack/platform/test/encrypted_saved_objects_api_integration/ @elastic/kibana-security
1977-
/x-pack/test/functional/apps/security/ @elastic/kibana-security
1978-
/x-pack/test/functional/apps/spaces/ @elastic/kibana-security
1976+
/x-pack/platform/test/functional/apps/security/ @elastic/kibana-security
1977+
/x-pack/platform/test/functional/apps/spaces/ @elastic/kibana-security
19791978
/x-pack/test/security_api_integration/ @elastic/kibana-security
19801979
/x-pack/test/security_functional/ @elastic/kibana-security
19811980
/x-pack/test/spaces_api_integration/ @elastic/kibana-security
@@ -2093,8 +2092,8 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi
20932092
# Management Experience - Deployment Management
20942093
^/src/platform/test/functional/fixtures/kbn_archiver/management.json @elastic/kibana-management @elastic/kibana-data-discovery # Assigned per 2 uses: test/functional/apps/management/_import_objects.ts && test/functional/apps/management/data_views/_scripted_fields_filter.ts
20952094
/x-pack/test/functional/fixtures/kbn_archiver/home/feature_controls/security/security.json @elastic/kibana-management
2096-
/x-pack/test/functional/es_archives/upgrade_assistant @elastic/kibana-core
2097-
/x-pack/test/functional/services/ace_editor.js @elastic/kibana-management
2095+
/x-pack/test/functional/es_archives/upgrade_assistant @elastic/kibana-management
2096+
/x-pack/platform/test/functional/services/ace_editor.ts @elastic/kibana-management
20982097
/x-pack/test/functional/page_objects/remote_clusters_page.ts @elastic/kibana-management
20992098
/x-pack/test/stack_functional_integration/apps/ccs @elastic/kibana-management
21002099
/x-pack/test/functional/services/data_stream.ts @elastic/kibana-management
@@ -2688,11 +2687,11 @@ x-pack/solutions/observability/plugins/observability_shared/public/components/pr
26882687
/src/platform/test/api_integration/apis/unused_urls_task/**/*.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/220138
26892688
/src/platform/test/functional/page_objects/share_page.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200209/files#r1846648444
26902689
/src/platform/test/accessibility/apps/kibana_overview_* @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200209/files/cab99bce5ac2082fa77222beebe3b61ff836b94b#r1846659920
2691-
/x-pack/test/functional/services/sample_data @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200142#discussion_r1846512756
2692-
^/src/platform/test/functional/page_objects/files_management.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200017#discussion_r1840477291
2693-
^/src/platform/test/accessibility/apps/home.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840077237
2694-
^/src/platform/test/api_integration/apis/home/*.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840077065
2695-
^/src/platform/test/functional/apps/home @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840075278
2690+
/x-pack/platform/test/functional/services/sample_data @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200142#discussion_r1846512756
2691+
/src/platform/test/functional/page_objects/files_management.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200017#discussion_r1840477291
2692+
/src/platform/test/accessibility/apps/home.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840077237
2693+
/src/platform/test/api_integration/apis/home/*.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840077065
2694+
/src/platform/test/functional/apps/home @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/199771/files#r1840075278
26962695
/x-pack/test/plugin_functional/plugins/global_search_test @elastic/appex-sharedux
26972696
^/src/platform/test/functional/services/saved_objects_finder.ts @elastic/appex-sharedux
26982697
^/src/platform/test/functional/apps/kibana_overview @elastic/appex-sharedux
@@ -2701,8 +2700,8 @@ x-pack/solutions/observability/plugins/observability_shared/public/components/pr
27012700
/x-pack/test/functional_solution_sidenav/services.ts @elastic/appex-sharedux
27022701
/x-pack/test/functional_solution_sidenav/index.ts @elastic/appex-sharedux
27032702
/x-pack/test/functional_cloud @elastic/appex-sharedux
2704-
/x-pack/test/functional/services/user_menu.js @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/179270
27052703
/x-pack/test/functional/page_objects/reporting_page.ts @elastic/appex-sharedux
2704+
/x-pack/platform/test/functional/services/user_menu.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/179270
27062705
/x-pack/test/accessibility/apps/**/config.ts @elastic/appex-sharedux
27072706
/x-pack/test/accessibility/apps/**/index.ts @elastic/appex-sharedux
27082707
/x-pack/test/upgrade/apps/reporting @elastic/appex-sharedux

src/platform/packages/shared/kbn-esql-ast/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export { Builder, type AstNodeParserFields, type AstNodeTemplate } from './src/b
5252
export {
5353
createParser,
5454
parse,
55+
Parser,
5556
parseErrors,
5657
type ParseOptions,
5758
type ParseResult,

src/platform/packages/shared/kbn-esql-ast/src/parser/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
export { createParser, parse, parseErrors, type ParseOptions, type ParseResult } from './parser';
10+
export {
11+
createParser,
12+
parse,
13+
parseErrors,
14+
Parser,
15+
type ParseOptions,
16+
type ParseResult,
17+
} from './parser';
1118

1219
export { ESQLErrorListener } from './esql_error_listener';

src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/autocomplete.command.fork.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
getFunctionSignaturesByReturnType,
2424
setup,
2525
lookupIndexFields,
26+
policies,
2627
} from './helpers';
2728

2829
describe('autocomplete.suggest', () => {
@@ -62,6 +63,7 @@ describe('autocomplete.suggest', () => {
6263
'COMPLETION ',
6364
'MV_EXPAND ',
6465
'DROP ',
66+
'ENRICH ',
6567
'KEEP ',
6668
'RENAME ',
6769
'SAMPLE ',
@@ -187,6 +189,18 @@ describe('autocomplete.suggest', () => {
187189
expect(labels).toEqual(expected);
188190
});
189191

192+
test('enrich', async () => {
193+
const expectedPolicyNameSuggestions = policies
194+
.map(({ name, suggestedAs }) => suggestedAs || name)
195+
.map((name) => `${name} `);
196+
197+
await assertSuggestions(`FROM a | FORK (ENRICH /)`, expectedPolicyNameSuggestions);
198+
await assertSuggestions(
199+
`FROM a | FORK (ENRICH policy ON /)`,
200+
getFieldNamesByType('any').map((v) => `${v} `)
201+
);
202+
});
203+
190204
describe('stats', () => {
191205
it('suggests for empty expression', async () => {
192206
await assertSuggestions('FROM a | FORK (STATS /)', EXPECTED_FOR_EMPTY_EXPRESSION);

src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/fork/suggest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const FORK_AVAILABLE_COMMANDS = [
3636
'rename',
3737
'sample',
3838
'join',
39-
// 'enrich', // not suggesting enrich for now, there are client side validation issues
39+
'enrich',
4040
];
4141

4242
export async function suggest(
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
import { Parser } from '@kbn/esql-ast';
10+
import { getEnrichCommands } from './helpers';
11+
12+
describe('getEnrichCommands', () => {
13+
test('should return the command in case of an enrich command', async () => {
14+
const { root } = Parser.parse('FROM index | ENRICH policy ON field');
15+
expect(getEnrichCommands(root.commands).length).toBe(1);
16+
});
17+
18+
test('should return empty array if enrich is not present', async () => {
19+
const { root } = Parser.parse('FROM index | STATS COUNT() BY field');
20+
expect(getEnrichCommands(root.commands)).toStrictEqual([]);
21+
});
22+
23+
test('should return the command in case of an enrich command inside a fork branch', async () => {
24+
const { root } = Parser.parse(
25+
'FROM index | FORK (ENRICH policy ON @timestamp WITH col0 = bikes_count) (DROP @timestamp) '
26+
);
27+
expect(getEnrichCommands(root.commands).length).toBe(1);
28+
});
29+
30+
test('should return empty array in case of forck branches without enrich', async () => {
31+
const { root } = Parser.parse('FROM index | FORK (STATS COUNT()) (DROP @timestamp) ');
32+
expect(getEnrichCommands(root.commands)).toStrictEqual([]);
33+
});
34+
});

src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/helpers.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import type {
11-
ESQLAst,
12-
ESQLAstItem,
13-
ESQLAstTimeseriesCommand,
14-
ESQLAstQueryExpression,
15-
ESQLColumn,
16-
ESQLMessage,
17-
ESQLSingleAstItem,
18-
ESQLSource,
10+
import {
11+
type ESQLAst,
12+
type ESQLAstItem,
13+
type ESQLAstTimeseriesCommand,
14+
type ESQLAstQueryExpression,
15+
type ESQLColumn,
16+
type ESQLMessage,
17+
type ESQLSingleAstItem,
18+
type ESQLSource,
19+
type ESQLCommand,
20+
Walker,
1921
} from '@kbn/esql-ast';
2022
import { mutate, synth } from '@kbn/esql-ast';
2123
import { FunctionDefinition } from '../definitions/types';
@@ -140,3 +142,12 @@ export function collapseWrongArgumentTypeMessages(
140142

141143
return messages;
142144
}
145+
146+
/**
147+
* Collects all 'enrich' commands from a list of ESQL commands.
148+
* @param commands - The list of ESQL commands to search through.
149+
* This function traverses the provided ESQL commands and collects all commands with the name 'enrich'.
150+
* @returns {ESQLCommand[]} - An array of ESQLCommand objects that represent the 'enrich' commands found in the input.
151+
*/
152+
export const getEnrichCommands = (commands: ESQLCommand[]): ESQLCommand[] =>
153+
Walker.matchAll(commands, { type: 'command', name: 'enrich' }) as ESQLCommand[];

src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/resources.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
buildQueryForFieldsForStringSources,
2020
buildQueryForFieldsFromSource,
2121
buildQueryForFieldsInPolicies,
22+
getEnrichCommands,
2223
} from './helpers';
2324
import type { ESQLFieldWithMetadata, ESQLPolicy } from './types';
2425

@@ -52,7 +53,8 @@ export async function retrievePolicies(
5253
commands: ESQLCommand[],
5354
callbacks?: ESQLCallbacks
5455
): Promise<Map<string, ESQLPolicy>> {
55-
if (!callbacks || commands.every(({ name }) => name !== 'enrich')) {
56+
const enrichCommands = getEnrichCommands(commands);
57+
if (!callbacks || !enrichCommands.length) {
5658
return new Map();
5759
}
5860

@@ -82,7 +84,7 @@ export async function retrievePoliciesFields(
8284
if (!callbacks) {
8385
return new Map();
8486
}
85-
const enrichCommands = commands.filter(({ name }) => name === 'enrich');
87+
const enrichCommands = getEnrichCommands(commands);
8688
if (!enrichCommands.length) {
8789
return new Map();
8890
}

x-pack/platform/plugins/shared/fleet/server/tasks/delete_unenrolled_agents_task.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export class DeleteUnenrolledAgentsTask {
117117
active: false,
118118
},
119119
},
120-
{ exists: { field: 'unenrolled_at' } },
121120
],
122121
},
123122
},

0 commit comments

Comments
 (0)