mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
851 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
52dd7e17c4
|
[Authz] Operator privileges (#196583)
## Summary
This PR adds support for explicit indication whether endpoint is
restricted to operator only users.
### Context
1. If user has [all operator
privileges](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/operator/DefaultOperatorOnlyRegistry.java#L35-#L53)
granted, but is not listed as operator in `operator_users.yml`, ES would
throw an unauthorized error.
2. If user is listed as operator in `operator_users.yml`, but doesn't
have necessary privileges granted, ES would throw an unauthorized error.
3. It’s not possible to determine if a user is operator via any ES API,
i.e. `_has_privileges`.
4. If operator privileges are disabled we skip the the check for it,
that's why we require to explicitly specify additional privileges to
ensure that the route is protected even when operator privileges are
disabled.
### Checklist
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
__Relates: https://github.com/elastic/kibana/issues/196271__
### How to test
1. Add your user to the operators list
|
||
|
749eeec4cc
|
[Cloud Security] Show graph visualization in expanded flyout (#198240)
## Summary Added graph tab to the flyout visualization of alerts and events. **A couple of included changes:** - Added technical preview badge - ~Feature is now toggled using `securitySolution:enableVisualizationsInFlyout` advanced setting~ reverted back to use the experimental feature flag - Added node popover to expand the graph - Expanding a graph adds relevant filters - Added e2e tests for both alerts flyout and events flyout (through network page) **List of known issues:** - The graph API works queries `logs-*` while the filters bar works with sourcerer current dataview Id - I'm not sure how to write a UT for GraphVisualization / Popover which uses ReactPortal that makes it tricky to test (I covered most scenarios using E2E test) - Expanding graph more than once adds another filter **How to test this PR:** - Enable the feature flag `kibana.dev.yml`: ```yaml uiSettings.overrides.securitySolution:enableVisualizationsInFlyout: true xpack.securitySolution.enableExperimental: ['graphVisualizationInFlyoutEnabled'] ``` - Load mocked data: ```bash node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` - Make sure you include data from Oct 13 2024. (in the video I use Last 90 days) https://github.com/user-attachments/assets/12e19ac7-0f61-4c0a-ac11-e304dfcc83d4 ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
5dee9994c9
|
Sustainable Kibana Architecture: Move modules owned by @elastic/obs-ux-management-team (#202832)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > This PR has been auto-generated. > Do not attempt to push any changes unless you know what you are doing. > Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 8 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/exploratory-view-plugin` | `x-pack/solutions/observability/plugins/exploratory_view` | | `@kbn/investigate-app-plugin` | `x-pack/solutions/observability/plugins/investigate_app` | | `@kbn/investigate-plugin` | `x-pack/solutions/observability/plugins/investigate` | | `@kbn/observability-plugin` | `x-pack/solutions/observability/plugins/observability` | | `@kbn/serverless-observability` | `x-pack/solutions/observability/plugins/serverless_observability` | | `@kbn/slo-plugin` | `x-pack/solutions/observability/plugins/slo` | | `@kbn/synthetics-plugin` | `x-pack/solutions/observability/plugins/synthetics` | | `@kbn/uptime-plugin` | `x-pack/solutions/observability/plugins/uptime` | #### 10 package(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/data-forge` | `x-pack/platform/packages/shared/kbn-data-forge` | | `@kbn/deeplinks-observability` | `src/platform/packages/shared/deeplinks/observability` | | `@kbn/infra-forge` | `x-pack/platform/packages/private/kbn-infra-forge` | | `@kbn/investigation-shared` | `x-pack/solutions/observability/packages/kbn-investigation-shared` | | `@kbn/observability-alert-details` | `x-pack/solutions/observability/packages/alert_details` | | `@kbn/observability-alerting-rule-utils` | `x-pack/platform/packages/shared/observability/alerting_rule_utils` | | `@kbn/observability-alerting-test-data` | `x-pack/solutions/observability/packages/alerting_test_data` | | `@kbn/observability-get-padded-alert-time-range-util` | `x-pack/solutions/observability/packages/get_padded_alert_time_range_util` | | `@kbn/observability-synthetics-test-data` | `x-pack/solutions/observability/packages/synthetics_test_data` | | `@kbn/slo-schema` | `x-pack/platform/packages/shared/kbn-slo-schema` | <details> <summary>Updated references</summary> ``` ./.buildkite/ftr_oblt_stateful_configs.yml ./.buildkite/pipelines/on_merge_unsupported_ftrs.yml ./.buildkite/pipelines/pull_request/exploratory_view_plugin.yml ./.buildkite/pipelines/pull_request/slo_plugin_e2e.yml ./.buildkite/pipelines/pull_request/synthetics_plugin.yml ./.buildkite/pipelines/pull_request/uptime_plugin.yml ./.buildkite/scripts/steps/functional/exploratory_view_plugin.sh ./.buildkite/scripts/steps/functional/slo_plugin_e2e.sh ./.buildkite/scripts/steps/functional/synthetics.sh ./.buildkite/scripts/steps/functional/synthetics_plugin.sh ./.buildkite/scripts/steps/functional/uptime_plugin.sh ./.eslintrc.js ./.github/paths-labeller.yml ./.i18nrc.json ./docs/developer/plugin-list.asciidoc ./oas_docs/overlays/alerting.overlays.yaml ./oas_docs/scripts/merge_ess_oas.js ./oas_docs/scripts/merge_serverless_oas.js ./package.json ./packages/kbn-eslint-plugin-i18n/helpers/get_i18n_identifier_from_file_path.test.ts ./packages/kbn-eslint-plugin-i18n/rules/formatted_message_should_start_with_the_right_id.test.ts ./packages/kbn-eslint-plugin-i18n/rules/i18n_translate_should_start_with_the_right_id.test.ts ./packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_formatted_message.test.ts ./packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_i18n.test.ts ./packages/kbn-eslint-plugin-telemetry/helpers/get_app_name.test.ts ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./src/dev/storybook/aliases.ts ./src/platform/packages/shared/deeplinks/observability/jest.config.js ./src/plugins/guided_onboarding/README.md ./tsconfig.base.json ./x-pack/.i18nrc.json ./x-pack/platform/packages/private/kbn-infra-forge/jest.config.js ./x-pack/platform/packages/shared/kbn-data-forge/jest.config.js ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_hosts/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_logs/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/admin_console/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/heartbeat/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/message_processor/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/mongodb/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/nginx_proxy/ecs/generate.sh ./x-pack/platform/packages/shared/kbn-slo-schema/jest.config.js ./x-pack/platform/packages/shared/observability/alerting_rule_utils/jest.config.js ./x-pack/plugins/observability_solution/observability/dev_docs/custom_threshold.md ./x-pack/plugins/observability_solution/slo/dev_docs/slo.md ./x-pack/plugins/observability_solution/uptime/.buildkite/pipelines/flaky.sh ./x-pack/plugins/observability_solution/uptime/README.md ./x-pack/plugins/observability_solution/uptime/e2e/README.md ./x-pack/solutions/observability/packages/alert_details/jest.config.js ./x-pack/solutions/observability/packages/alerting_test_data/jest.config.js ./x-pack/solutions/observability/packages/get_padded_alert_time_range_util/jest.config.js ./x-pack/solutions/observability/packages/kbn-investigation-shared/jest.config.js ./x-pack/solutions/observability/packages/synthetics_test_data/jest.config.js ./x-pack/solutions/observability/plugins/exploratory_view/README.md ./x-pack/solutions/observability/plugins/exploratory_view/e2e/README.md ./x-pack/solutions/observability/plugins/exploratory_view/jest.config.js ./x-pack/solutions/observability/plugins/investigate/jest.config.js ./x-pack/solutions/observability/plugins/investigate_app/jest.config.js ./x-pack/solutions/observability/plugins/observability/jest.config.js ./x-pack/solutions/observability/plugins/slo/docs/openapi/slo/README.md ./x-pack/solutions/observability/plugins/slo/jest.config.js ./x-pack/solutions/observability/plugins/synthetics/.buildkite/pipelines/flaky.sh ./x-pack/solutions/observability/plugins/synthetics/README.md ./x-pack/solutions/observability/plugins/synthetics/e2e/README.md ./x-pack/solutions/observability/plugins/synthetics/jest.config.js ./x-pack/solutions/observability/plugins/uptime/e2e/README.md ./x-pack/solutions/observability/plugins/uptime/jest.config.js ./yarn.lock ``` </details> <details> <summary>Updated relative paths</summary> ``` src/platform/packages/shared/deeplinks/observability/jest.config.js:12 src/platform/packages/shared/deeplinks/observability/tsconfig.json:2 x-pack/platform/packages/private/kbn-infra-forge/jest.config.js:10 x-pack/platform/packages/private/kbn-infra-forge/tsconfig.json:2 x-pack/platform/packages/shared/kbn-data-forge/jest.config.js:10 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_hosts/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_logs/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/admin_console/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/heartbeat/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/message_processor/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/mongodb/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/src/data_sources/fake_stack/nginx_proxy/ecs/generate.sh:3 x-pack/platform/packages/shared/kbn-data-forge/tsconfig.json:2 x-pack/platform/packages/shared/kbn-slo-schema/jest.config.js:10 x-pack/platform/packages/shared/kbn-slo-schema/tsconfig.json:2 x-pack/platform/packages/shared/observability/alerting_rule_utils/jest.config.js:10 x-pack/platform/packages/shared/observability/alerting_rule_utils/tsconfig.json:2 x-pack/solutions/observability/packages/alert_details/jest.config.js:10 x-pack/solutions/observability/packages/alert_details/tsconfig.json:2 x-pack/solutions/observability/packages/alerting_test_data/jest.config.js:10 x-pack/solutions/observability/packages/alerting_test_data/tsconfig.json:2 x-pack/solutions/observability/packages/get_padded_alert_time_range_util/jest.config.js:10 x-pack/solutions/observability/packages/get_padded_alert_time_range_util/tsconfig.json:2 x-pack/solutions/observability/packages/kbn-investigation-shared/jest.config.js:12 x-pack/solutions/observability/packages/kbn-investigation-shared/tsconfig.json:2 x-pack/solutions/observability/packages/synthetics_test_data/jest.config.js:10 x-pack/solutions/observability/packages/synthetics_test_data/tsconfig.json:2 x-pack/solutions/observability/plugins/exploratory_view/e2e/README.md:13 x-pack/solutions/observability/plugins/exploratory_view/e2e/synthetics_run.ts:28 x-pack/solutions/observability/plugins/exploratory_view/e2e/synthetics_run.ts:33 x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:19 x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:27 x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:34 x-pack/solutions/observability/plugins/exploratory_view/e2e/tsconfig.json:2 x-pack/solutions/observability/plugins/exploratory_view/jest.config.js:10 x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/README.md:116 x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/README.md:156 x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/README.md:161 x-pack/solutions/observability/plugins/exploratory_view/tsconfig.json:2 x-pack/solutions/observability/plugins/exploratory_view/tsconfig.json:6 x-pack/solutions/observability/plugins/investigate/jest.config.js:10 x-pack/solutions/observability/plugins/investigate/tsconfig.json:2 x-pack/solutions/observability/plugins/investigate/tsconfig.json:7 x-pack/solutions/observability/plugins/investigate_app/jest.config.js:10 x-pack/solutions/observability/plugins/investigate_app/tsconfig.json:2 x-pack/solutions/observability/plugins/investigate_app/tsconfig.json:7 x-pack/solutions/observability/plugins/observability/dev_docs/custom_threshold.md:10 x-pack/solutions/observability/plugins/observability/dev_docs/custom_threshold.md:36 x-pack/solutions/observability/plugins/observability/dev_docs/feature_flags.md:14 x-pack/solutions/observability/plugins/observability/jest.config.js:10 x-pack/solutions/observability/plugins/observability/tsconfig.json:12 x-pack/solutions/observability/plugins/observability/tsconfig.json:2 x-pack/solutions/observability/plugins/serverless_observability/package.json:8 x-pack/solutions/observability/plugins/serverless_observability/package.json:9 x-pack/solutions/observability/plugins/serverless_observability/tsconfig.json:12 x-pack/solutions/observability/plugins/serverless_observability/tsconfig.json:2 x-pack/solutions/observability/plugins/slo/dev_docs/slo.md:11 x-pack/solutions/observability/plugins/slo/e2e/tsconfig.json:2 x-pack/solutions/observability/plugins/slo/jest.config.js:10 x-pack/solutions/observability/plugins/slo/tsconfig.json:10 x-pack/solutions/observability/plugins/slo/tsconfig.json:2 x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:19 x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:27 x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:34 x-pack/solutions/observability/plugins/synthetics/e2e/tsconfig.json:2 x-pack/solutions/observability/plugins/synthetics/jest.config.js:10 x-pack/solutions/observability/plugins/synthetics/tsconfig.json:12 x-pack/solutions/observability/plugins/synthetics/tsconfig.json:2 x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:19 x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:27 x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:34 x-pack/solutions/observability/plugins/uptime/e2e/tasks/read_kibana_config.ts:15 x-pack/solutions/observability/plugins/uptime/e2e/tsconfig.json:2 x-pack/solutions/observability/plugins/uptime/jest.config.js:10 x-pack/solutions/observability/plugins/uptime/tsconfig.json:13 x-pack/solutions/observability/plugins/uptime/tsconfig.json:2 ``` </details> <details> <summary>Script errors</summary> ``` Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:19 Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:27 Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/exploratory_view/e2e/tasks/es_archiver.ts:34 Cannot replace multiple occurrences of "../../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/observability/dev_docs/feature_flags.md:14 Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:19 Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:27 Cannot replace multiple occurrences of "../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/synthetics/e2e/tasks/es_archiver.ts:34 Cannot replace multiple occurrences of "../../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:19 Cannot replace multiple occurrences of "../../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:27 Cannot replace multiple occurrences of "../../../.." in the same line, please fix manually: /Users/gsoldevila/Work/kibana-tertiary/x-pack/solutions/observability/plugins/uptime/e2e/tasks/es_archiver.ts:34 ``` </details> --------- Co-authored-by: shahzad31 <shahzad31comp@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
231f1b3fca
|
[Cloud Security] CDR Graph - fix labels overlap when there are multiple labels (#204020) | ||
|
bffd4e14e7
|
[Security team] Update components for EUI visual refresh (#201795)
Closes https://github.com/elastic/kibana/issues/200005 ## Summary Integrate changes from the Borealis theme to components owned by @elastic/kibana-security team. ### Notes There are no visual changes in this PR. However: - Switch from using `success` to `accentSecondary` where needed - Switched from 'colors.disabled` to `colors.textDisabled` ### Screenshots There isn't much to add but adding a few before/after screenshots of the changes made | Usage | Before | After | |--------|--------|--------| | API Key token field | <img width="446" alt="image" src="https://github.com/user-attachments/assets/0167671c-b9e8-4493-88d9-514c524ccd06"> | <img width="469" alt="image" src="https://github.com/user-attachments/assets/bde7f308-1ba4-4a92-bb27-e5875357ba49"> | | User profile page | <img width="271" alt="image" src="https://github.com/user-attachments/assets/668a66df-949a-4ce6-a390-d5ea2dd3489c"> | <img width="271" alt="image" src="https://github.com/user-attachments/assets/a3965279-6f64-407c-923c-f7a07f474a14"> | | Copy SO to space counter | <img width="991" alt="image" src="https://github.com/user-attachments/assets/87a2cf3c-6b1f-4cf0-b818-03ed59133598"> | <img width="1161" alt="image" src="https://github.com/user-attachments/assets/549648f1-297b-434d-b61b-d2761bc5d641"> | | Space listing | <img width="604" alt="image" src="https://github.com/user-attachments/assets/6db8f9df-4059-4a06-b49f-e48dd910277a" /> |  | ### How to test 1. Start ES and KIB as: ``` yarn es snapshot --license trial KBN_OPTIMIZER_THEMES=experimental yarn start --no-base-path ``` 2. Navigate to `Stack Management > Advance Setting` and change the theme to Borealis. 3. Verify the different screens as seen in the screenshots to see if they render correctly with no visual regression ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
50068fd9ba
|
Sustainable Kibana Architecture: Move modules under x-pack/packages/security-solution (#203522)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > This PR has been auto-generated. > Do not attempt to push any changes unless you know what you are doing. > Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 7 package(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/ecs-data-quality-dashboard` | `x-pack/solutions/security/packages/ecs_data_quality_dashboard` | | `@kbn/security-solution-distribution-bar` | `x-pack/solutions/security/packages/distribution_bar` | | `@kbn/security-solution-features` | `x-pack/solutions/security/packages/features` | | `@kbn/security-solution-navigation` | `x-pack/solutions/security/packages/navigation` | | `@kbn/security-solution-side-nav` | `x-pack/solutions/security/packages/side_nav` | | `@kbn/security-solution-upselling` | `x-pack/solutions/security/packages/upselling` | | `@kbn/securitysolution-data-table` | `x-pack/solutions/security/packages/data_table` | <details> <summary>Updated references</summary> ``` ./.eslintrc.js ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./tsconfig.base.json ./tsconfig.base.type_check.json ./tsconfig.refs.json ./x-pack/solutions/security/packages/data_table/jest.config.js ./x-pack/solutions/security/packages/distribution_bar/jest.config.js ./x-pack/solutions/security/packages/ecs_data_quality_dashboard/jest.config.js ./x-pack/solutions/security/packages/features/jest.config.js ./x-pack/solutions/security/packages/navigation/jest.config.js ./x-pack/solutions/security/packages/side_nav/jest.config.js ./x-pack/solutions/security/packages/upselling/jest.config.js ./x-pack/solutions/security/plugins/security_solution_serverless/tsconfig.type_check.json ./yarn.lock ``` </details> <details> <summary>Updated relative paths</summary> ``` x-pack/solutions/security/packages/data_table/jest.config.js:11 x-pack/solutions/security/packages/data_table/tsconfig.json:2 x-pack/solutions/security/packages/distribution_bar/jest.config.js:11 x-pack/solutions/security/packages/distribution_bar/tsconfig.json:2 x-pack/solutions/security/packages/ecs_data_quality_dashboard/jest.config.js:21 x-pack/solutions/security/packages/ecs_data_quality_dashboard/tsconfig.json:2 x-pack/solutions/security/packages/features/jest.config.js:10 x-pack/solutions/security/packages/features/tsconfig.json:2 x-pack/solutions/security/packages/navigation/jest.config.js:10 x-pack/solutions/security/packages/navigation/tsconfig.json:2 x-pack/solutions/security/packages/side_nav/jest.config.js:10 x-pack/solutions/security/packages/side_nav/src/solution_side_nav.stories.tsx:11 x-pack/solutions/security/packages/side_nav/tsconfig.json:2 x-pack/solutions/security/packages/upselling/jest.config.js:10 x-pack/solutions/security/packages/upselling/tsconfig.json:2 ``` </details> <details> <summary>Script errors</summary> ``` ``` </details> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Angela Chuang <yi-chun.chuang@elastic.co> Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co> |
||
|
84b19ec3ea
|
Sustainable Kibana Architecture: Move modules owned by @elastic/obs-ai-assistant (#202763)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > * This PR has been auto-generated. > * Any manual contributions will be lost if the 'relocate' script is re-run. > * Try to obtain the missing reviews / approvals before applying manual fixes, and/or keep your changes in a .patch / git stash. > * Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 5 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/ai-assistant-management-plugin` | `src/platform/plugins/shared/ai_assistant_management/selection` | | `@kbn/data-usage-plugin` | `x-pack/platform/plugins/private/data_usage` | | `@kbn/observability-ai-assistant-app-plugin` | `x-pack/solutions/observability/plugins/observability_ai_assistant_app` | | `@kbn/observability-ai-assistant-management-plugin` | `x-pack/solutions/observability/plugins/observability_ai_assistant_management` | | `@kbn/observability-ai-assistant-plugin` | `x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant` | #### 2 packages(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/observability-ai-common` | `x-pack/solutions/observability/packages/observability_ai/observability_ai_common` | | `@kbn/observability-ai-server` | `x-pack/solutions/observability/packages/observability_ai/observability_ai_server` | <details > <summary>Updated references</summary> ``` ./.github/paths-labeller.yml ./.i18nrc.json ./docs/developer/plugin-list.asciidoc ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./src/dev/storybook/aliases.ts ./src/platform/plugins/shared/ai_assistant_management/selection/jest.config.js ./src/platform/plugins/shared/discover/tsconfig.type_check.json ./tsconfig.base.json ./tsconfig.base.type_check.json ./tsconfig.refs.json ./x-pack/.i18nrc.json ./x-pack/platform/plugins/private/data_usage/jest.config.js ./x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/jest.config.js ./x-pack/plugins/enterprise_search/kibana.jsonc ./x-pack/plugins/observability_solution/observability_ai_assistant/server/functions/index.ts ./x-pack/plugins/observability_solution/observability_ai_assistant_app/tsconfig.type_check.json ./x-pack/plugins/search_connectors/kibana.jsonc ./x-pack/solutions/observability/packages/observability_ai/observability_ai_common/jest.config.js ./x-pack/solutions/observability/packages/observability_ai/observability_ai_server/jest.config.js ./x-pack/solutions/observability/plugins/observability_ai_assistant_app/jest.config.js ./x-pack/solutions/observability/plugins/observability_ai_assistant_app/scripts/evaluation/README.md ./x-pack/solutions/observability/plugins/observability_ai_assistant_management/jest.config.js ./x-pack/test/tsconfig.type_check.json ./x-pack/test_serverless/tsconfig.type_check.json ./yarn.lock ``` </details><details > <summary>Updated relative paths</summary> ``` src/platform/plugins/shared/ai_assistant_management/selection/jest.config.js:12 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.json:2 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:18 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:2 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:21 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:24 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:27 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:30 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:33 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:36 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:39 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:42 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:45 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:48 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:51 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:54 src/platform/plugins/shared/ai_assistant_management/selection/tsconfig.type_check.json:57 x-pack/platform/plugins/private/data_usage/jest.config.js:10 x-pack/platform/plugins/private/data_usage/tsconfig.json:11 x-pack/platform/plugins/private/data_usage/tsconfig.json:2 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/jest.config.js:10 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.json:2 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.json:7 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:100 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:103 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:2 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:22 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:25 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:28 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:31 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:34 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:37 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:40 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:43 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:46 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:49 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:52 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:55 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:58 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:61 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:64 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:67 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:70 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:73 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:76 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:79 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:82 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:85 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:88 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:9 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:91 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:94 x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant/tsconfig.type_check.json:97 x-pack/solutions/observability/packages/observability_ai/observability_ai_common/jest.config.js:10 x-pack/solutions/observability/packages/observability_ai/observability_ai_common/tsconfig.json:2 x-pack/solutions/observability/packages/observability_ai/observability_ai_server/jest.config.js:10 x-pack/solutions/observability/packages/observability_ai/observability_ai_server/tsconfig.json:2 x-pack/solutions/observability/plugins/observability_ai_assistant_app/jest.config.js:10 x-pack/solutions/observability/plugins/observability_ai_assistant_app/scripts/evaluation/read_kibana_config.ts:16 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.json:2 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.json:7 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:100 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:103 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:106 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:109 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:112 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:118 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:121 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:124 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:127 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:130 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:133 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:136 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:139 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:142 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:145 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:148 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:151 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:154 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:157 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:160 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:163 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:166 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:169 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:172 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:175 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:178 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:181 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:184 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:190 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:193 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:2 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:22 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:28 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:31 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:34 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:37 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:40 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:43 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:46 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:49 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:52 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:55 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:58 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:61 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:64 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:67 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:70 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:73 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:76 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:79 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:82 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:85 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:88 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:9 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:91 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:94 x-pack/solutions/observability/plugins/observability_ai_assistant_app/tsconfig.type_check.json:97 x-pack/solutions/observability/plugins/observability_ai_assistant_management/jest.config.js:10 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json:2 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:18 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:2 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:21 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:24 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:27 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:30 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:33 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:36 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:39 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:45 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:48 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:51 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:54 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:60 x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.type_check.json:63 ``` </details> |
||
|
0203bba44f
|
[Synthetics] Clean up e2e test helpers !! (#203812)
## Summary Clean up e2e test helpers |
||
|
6ece92e9e1
|
[React18] Migrate test suites to account for testing library upgrades security-generative-ai (#201160)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
b4ccb0c205
|
[Synthetics] Improve overview page performance !! (#201275)
## Summary Improve overview page performance !! Right now UI works for few hundred to 1000 monitors, but it starts degrading after that, this PR makes sure, we refactor queries in such a way that it scale up to 10k-20k monitors easily. ### Queries before Before this PR, we were doing 2 steps queries, first fetch all saved objects and the fetch all summary documents by passings all ids from first phase. This meant that let's say if we have 20k saved objects, first we will need to page through all of them to even start fetching summaries. To fetch summary documents, we were using `top_hits` query which can be memory expensive. ### Queries now In this PR we fetch summaries and saved objects in parallel, since we have space id on documents as well, there was no need to do 2 step queries. Now we fetch both things in parallel and then we hydrate saved object data from summary data. In this PR now we are using top_metrics query to fetch each monitor status instead of `top_hits` I tested on about 20k monitors, app performs reasoably well after the PR <img width="1920" alt="image" src="https://github.com/user-attachments/assets/c143e196-59a4-45b4-86b7-bd22ac4c5d4b"> On a very slow cluster on which kibana is local against a remote cluster ### After <img width="1920" alt="image" src="https://github.com/user-attachments/assets/540d0cdf-2f8c-44d1-af76-81953d9ca0ff"> ### Before <img width="1918" alt="image" src="https://github.com/user-attachments/assets/5fdc314d-bb59-4137-9397-d8aee6bd4806"> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
fa1998ce92
|
[RCA] AI-assisted root cause analysis (#197200)
Implements an LLM-based root cause analysis process. At a high level, it works by investigating entities - which means pulling in alerts, SLOs, and log patterns. From there, it can inspect related entities to get to the root cause. The backend implementation lives in `x-pack/packages/observability_utils-*` (`service_rca`). It can be imported into any server-side plugin and executed from there. The UI changes are mostly contained to `x-pack/plugins/observability_solution/observabillity_ai_assistant_app`. This plugin now exports a `RootCauseAnalysisContainer` which takes a stream of data that is returned by the root cause analysis process. The current implementation lives in the Investigate app. There, it calls its own endpoint that kicks off the RCA process, and feeds it into the `RootCauseAnalysisContainer` exposed by the Observability AI Assistant app plugin. I've left it in a route there so the investigation itself can be updated as the process runs - this would allow the user to close the browser and come back later, and see a full investigation. > [!NOTE] > Notes for reviewing teams > > @kbn/es-types: > - support both types and typesWithBodyKey > - simplify KeysOfSources type > > @kbn/server-route-repository: > - abortable streamed responses > > @kbn/sse-utils*: > - abortable streamed responses > - serialize errors in specific format for more reliable re-hydration of errors > - keep connection open with SSE comments > > @kbn/inference-*: > - export *Of variants of types, for easier manual inference > - add automated retries for `output` API > - add `name` to tool responses for type inference (get type of tool response via tool name) > - add `data` to tool responses for transporting internal data (not sent to the LLM) > - simplify `chunksIntoMessage` > - allow consumers of nlToEsql task to add to `system` prompt > - add toolCallId to validation error message > > @kbn/aiops*: > - export `categorizationAnalyzer` for use in observability-ai* > > @kbn/observability-ai-assistant* > - configurable limit (tokens or doc count) for knowledge base recall > > @kbn/slo*: > - export client that returns summary indices --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Maryam Saeidi <maryam.saeidi@elastic.co> Co-authored-by: Bena Kansara <bena.kansara@elastic.co> |
||
|
f1f3a4fddd
|
Fix Custom Threshold Rule ViewInAppUrl does not honor space (#201793)
## Summary Close https://github.com/elastic/kibana/issues/201378 Fix https://github.com/elastic/kibana/issues/201333 - [Share] Allow to pass `spaceId` to `getRedirectUrl` to build a URL with a specific `spaceId` - Fix Custom Threshold Rule ViewInAppUrl does not honor Space --------- Co-authored-by: Maryam Saeidi <maryam.saeidi@elastic.co> |
||
|
35aeac1043
|
[Security Solution] Fixes exception item comment validation on newline chars \n (#202063)
## Summary Fixes: https://github.com/elastic/kibana/issues/201820 Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
2818a7cc5a
|
[Security Assistant] Fix animation border color of security AI assistant (#202319)
## Summary **Resolves: https://github.com/elastic/kibana/issues/186135** Changes: - Update border color of animated border of the security AI assistance icon from `euiColorPrimary` to `euiBorderColor`. Old border color: <img width="182" alt="image" src="https://github.com/user-attachments/assets/a41a7859-3f9a-488c-bd4f-2ed25a52a481"> New border color: <img width="169" alt="image" src="https://github.com/user-attachments/assets/c7e1fa13-adb0-4014-950f-ae643e4e1d6d"> <img width="347" alt="image" src="https://github.com/user-attachments/assets/8fba05e2-2a5b-48b2-b367-a58162cdaa9e"> New animated:  ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. No Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [X] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
a0f5a7f3fc
|
Sustainable Kibana Architecture: Move modules owned by @elastic/appex-ai-infra (#202410)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > This PR has been auto-generated. > Do not attempt to push any changes unless you know what you are doing. > Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 3 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/inference-plugin` | `x-pack/platform/plugins/shared/inference` | | `@kbn/llm-tasks-plugin` | `x-pack/platform/plugins/shared/ai_infra/llm_tasks` | | `@kbn/product-doc-base-plugin` | `x-pack/platform/plugins/shared/ai_infra/product_doc_base` | #### 2 package(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/inference-common` | `x-pack/platform/packages/shared/ai-infra/inference-common` | | `@kbn/product-doc-common` | `x-pack/platform/packages/shared/ai-infra/product-doc-common` | <details> <summary>Updated references</summary> ``` ./docs/developer/plugin-list.asciidoc ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./tsconfig.base.json ./x-pack/.i18nrc.json ./x-pack/platform/packages/shared/ai-infra/inference-common/jest.config.js ./x-pack/platform/packages/shared/ai-infra/product-doc-common/jest.config.js ./x-pack/platform/plugins/shared/ai_infra/llm_tasks/jest.config.js ./x-pack/platform/plugins/shared/ai_infra/product_doc_base/jest.config.js ./x-pack/platform/plugins/shared/inference/jest.config.js ./x-pack/platform/plugins/shared/inference/scripts/evaluation/README.md ./yarn.lock ``` </details> <details> <summary>Updated relative paths</summary> ``` x-pack/platform/packages/shared/ai-infra/inference-common/jest.config.js:10 x-pack/platform/packages/shared/ai-infra/inference-common/tsconfig.json:2 x-pack/platform/packages/shared/ai-infra/product-doc-common/jest.config.js:10 x-pack/platform/packages/shared/ai-infra/product-doc-common/tsconfig.json:2 x-pack/platform/plugins/shared/ai_infra/llm_tasks/jest.config.js:10 x-pack/platform/plugins/shared/ai_infra/llm_tasks/tsconfig.json:2 x-pack/platform/plugins/shared/ai_infra/llm_tasks/tsconfig.json:7 x-pack/platform/plugins/shared/ai_infra/product_doc_base/jest.config.js:10 x-pack/platform/plugins/shared/ai_infra/product_doc_base/tsconfig.json:2 x-pack/platform/plugins/shared/ai_infra/product_doc_base/tsconfig.json:7 x-pack/platform/plugins/shared/inference/jest.config.js:10 x-pack/platform/plugins/shared/inference/scripts/util/read_kibana_config.ts:16 x-pack/platform/plugins/shared/inference/tsconfig.json:2 x-pack/platform/plugins/shared/inference/tsconfig.json:7 ``` </details> <details> <summary>Script errors</summary> ``` ``` </details> --------- Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co> |
||
|
58b8b47928
|
Sustainable Kibana Architecture: Move modules owned by @elastic/ml-ui (#202764)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > This PR has been auto-generated. > Do not attempt to push any changes unless you know what you are doing. > Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 4 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/aiops-plugin` | `x-pack/platform/plugins/shared/aiops` | | `@kbn/data-visualizer-plugin` | `x-pack/platform/plugins/private/data_visualizer` | | `@kbn/ml-plugin` | `x-pack/platform/plugins/shared/ml` | | `@kbn/transform-plugin` | `x-pack/platform/plugins/private/transform` | #### 42 package(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/aiops-change-point-detection` | `x-pack/platform/packages/private/ml/aiops_change_point_detection` | | `@kbn/aiops-common` | `x-pack/platform/packages/shared/ml/aiops_common` | | `@kbn/aiops-components` | `x-pack/platform/packages/private/ml/aiops_components` | | `@kbn/aiops-log-pattern-analysis` | `x-pack/platform/packages/shared/ml/aiops_log_pattern_analysis` | | `@kbn/aiops-log-rate-analysis` | `x-pack/platform/packages/shared/ml/aiops_log_rate_analysis` | | `@kbn/aiops-test-utils` | `x-pack/platform/packages/private/ml/aiops_test_utils` | | `@kbn/deeplinks-ml` | `src/platform/packages/shared/deeplinks/ml` | | `@kbn/default-nav-ml` | `src/platform/packages/private/default-nav/ml` | | `@kbn/inference_integration_flyout` | `x-pack/platform/packages/private/ml/inference_integration_flyout` | | `@kbn/json-schemas` | `x-pack/platform/packages/private/ml/json_schemas` | | `@kbn/ml-agg-utils` | `x-pack/platform/packages/private/ml/agg_utils` | | `@kbn/ml-anomaly-utils` | `x-pack/platform/packages/shared/ml/anomaly_utils` | | `@kbn/ml-cancellable-search` | `x-pack/platform/packages/private/ml/cancellable_search` | | `@kbn/ml-category-validator` | `x-pack/platform/packages/private/ml/category_validator` | | `@kbn/ml-chi2test` | `x-pack/platform/packages/shared/ml/chi2test` | | `@kbn/ml-creation-wizard-utils` | `x-pack/platform/packages/private/ml/creation_wizard_utils` | | `@kbn/ml-data-frame-analytics-utils` | `x-pack/platform/packages/private/ml/data_frame_analytics_utils` | | `@kbn/ml-data-grid` | `x-pack/platform/packages/private/ml/data_grid` | | `@kbn/ml-data-view-utils` | `x-pack/platform/packages/private/ml/data_view_utils` | | `@kbn/ml-date-picker` | `x-pack/platform/packages/private/ml/date_picker` | | `@kbn/ml-date-utils` | `x-pack/platform/packages/private/ml/date_utils` | | `@kbn/ml-error-utils` | `x-pack/platform/packages/shared/ml/error_utils` | | `@kbn/ml-field-stats-flyout` | `x-pack/platform/packages/private/ml/field_stats_flyout` | | `@kbn/ml-in-memory-table` | `x-pack/platform/packages/private/ml/in_memory_table` | | `@kbn/ml-is-defined` | `x-pack/platform/packages/private/ml/is_defined` | | `@kbn/ml-is-populated-object` | `x-pack/platform/packages/private/ml/is_populated_object` | | `@kbn/ml-kibana-theme` | `x-pack/platform/packages/private/ml/kibana_theme` | | `@kbn/ml-local-storage` | `x-pack/platform/packages/private/ml/local_storage` | | `@kbn/ml-nested-property` | `x-pack/platform/packages/private/ml/nested_property` | | `@kbn/ml-number-utils` | `x-pack/platform/packages/private/ml/number_utils` | | `@kbn/ml-parse-interval` | `x-pack/platform/packages/private/ml/parse_interval` | | `@kbn/ml-query-utils` | `x-pack/platform/packages/private/ml/query_utils` | | `@kbn/ml-random-sampler-utils` | `x-pack/platform/packages/shared/ml/random_sampler_utils` | | `@kbn/ml-response-stream` | `x-pack/platform/packages/shared/ml/response_stream` | | `@kbn/ml-route-utils` | `x-pack/platform/packages/private/ml/route_utils` | | `@kbn/ml-runtime-field-utils` | `x-pack/platform/packages/shared/ml/runtime_field_utils` | | `@kbn/ml-string-hash` | `x-pack/platform/packages/private/ml/string_hash` | | `@kbn/ml-time-buckets` | `x-pack/platform/packages/private/ml/time_buckets` | | `@kbn/ml-trained-models-utils` | `x-pack/platform/packages/shared/ml/trained_models_utils` | | `@kbn/ml-ui-actions` | `x-pack/platform/packages/private/ml/ui_actions` | | `@kbn/ml-url-state` | `x-pack/platform/packages/private/ml/url_state` | | `@kbn/ml-validators` | `x-pack/platform/packages/private/ml/validators` | <details> <summary>Updated references</summary> ``` ./.eslintrc.js ./docs/developer/plugin-list.asciidoc ./docs/redirects.asciidoc ./oas_docs/scripts/merge_ess_oas.js ./oas_docs/scripts/merge_serverless_oas.js ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-synthetic-package-map/synthetic-packages.json ./packages/kbn-ts-projects/config-paths.json ./src/platform/packages/private/default-nav/ml/jest.config.js ./src/platform/packages/shared/deeplinks/ml/jest.config.js ./tsconfig.base.json ./tsconfig.refs.json ./x-pack/.i18nrc.json ./x-pack/packages/security-solution/navigation/src/constants.ts ./x-pack/platform/packages/private/ml/agg_utils/jest.config.js ./x-pack/platform/packages/private/ml/aiops_change_point_detection/jest.config.js ./x-pack/platform/packages/private/ml/aiops_components/jest.config.js ./x-pack/platform/packages/private/ml/aiops_test_utils/jest.config.js ./x-pack/platform/packages/private/ml/cancellable_search/jest.config.js ./x-pack/platform/packages/private/ml/category_validator/jest.config.js ./x-pack/platform/packages/private/ml/creation_wizard_utils/jest.config.js ./x-pack/platform/packages/private/ml/data_frame_analytics_utils/jest.config.js ./x-pack/platform/packages/private/ml/data_grid/jest.config.js ./x-pack/platform/packages/private/ml/data_view_utils/jest.config.js ./x-pack/platform/packages/private/ml/date_picker/jest.config.js ./x-pack/platform/packages/private/ml/date_utils/jest.config.js ./x-pack/platform/packages/private/ml/field_stats_flyout/jest.config.js ./x-pack/platform/packages/private/ml/in_memory_table/jest.config.js ./x-pack/platform/packages/private/ml/inference_integration_flyout/jest.config.js ./x-pack/platform/packages/private/ml/is_defined/jest.config.js ./x-pack/platform/packages/private/ml/is_populated_object/jest.config.js ./x-pack/platform/packages/private/ml/json_schemas/jest.config.js ./x-pack/platform/packages/private/ml/kibana_theme/jest.config.js ./x-pack/platform/packages/private/ml/local_storage/jest.config.js ./x-pack/platform/packages/private/ml/nested_property/jest.config.js ./x-pack/platform/packages/private/ml/number_utils/jest.config.js ./x-pack/platform/packages/private/ml/parse_interval/jest.config.js ./x-pack/platform/packages/private/ml/query_utils/jest.config.js ./x-pack/platform/packages/private/ml/route_utils/jest.config.js ./x-pack/platform/packages/private/ml/string_hash/jest.config.js ./x-pack/platform/packages/private/ml/time_buckets/jest.config.js ./x-pack/platform/packages/private/ml/ui_actions/jest.config.js ./x-pack/platform/packages/private/ml/url_state/jest.config.js ./x-pack/platform/packages/private/ml/validators/jest.config.js ./x-pack/platform/packages/shared/ml/aiops_common/jest.config.js ./x-pack/platform/packages/shared/ml/aiops_log_pattern_analysis/jest.config.js ./x-pack/platform/packages/shared/ml/aiops_log_rate_analysis/jest.config.js ./x-pack/platform/packages/shared/ml/anomaly_utils/jest.config.js ./x-pack/platform/packages/shared/ml/chi2test/jest.config.js ./x-pack/platform/packages/shared/ml/error_utils/jest.config.js ./x-pack/platform/packages/shared/ml/random_sampler_utils/jest.config.js ./x-pack/platform/packages/shared/ml/response_stream/jest.config.js ./x-pack/platform/packages/shared/ml/runtime_field_utils/jest.config.js ./x-pack/platform/packages/shared/ml/trained_models_utils/jest.config.js ./x-pack/platform/plugins/private/data_visualizer/jest.config.js ./x-pack/platform/plugins/private/transform/jest.config.js ./x-pack/platform/plugins/private/transform/readme.md ./x-pack/platform/plugins/shared/aiops/README.md ./x-pack/platform/plugins/shared/aiops/jest.config.js ./x-pack/platform/plugins/shared/aiops/public/application/utils/build_extended_base_filter_criteria.ts ./x-pack/platform/plugins/shared/aiops/public/application/utils/search_utils.ts ./x-pack/platform/plugins/shared/ml/jest.config.js ./x-pack/platform/plugins/shared/ml/readme.md ./x-pack/plugins/aiops/README.md ./x-pack/plugins/security_solution/common/machine_learning/affected_job_ids.ts ./x-pack/plugins/security_solution/common/machine_learning/helpers.ts ./yarn.lock ``` </details> <details> <summary>Updated relative paths</summary> ``` src/platform/packages/private/default-nav/ml/jest.config.js:12 src/platform/packages/private/default-nav/ml/tsconfig.json:2 src/platform/packages/shared/deeplinks/ml/jest.config.js:12 src/platform/packages/shared/deeplinks/ml/tsconfig.json:2 x-pack/platform/packages/private/ml/agg_utils/jest.config.js:10 x-pack/platform/packages/private/ml/agg_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/aiops_change_point_detection/jest.config.js:10 x-pack/platform/packages/private/ml/aiops_change_point_detection/tsconfig.json:2 x-pack/platform/packages/private/ml/aiops_components/jest.config.js:10 x-pack/platform/packages/private/ml/aiops_components/tsconfig.json:2 x-pack/platform/packages/private/ml/aiops_test_utils/jest.config.js:10 x-pack/platform/packages/private/ml/aiops_test_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/cancellable_search/jest.config.js:10 x-pack/platform/packages/private/ml/cancellable_search/tsconfig.json:2 x-pack/platform/packages/private/ml/category_validator/jest.config.js:10 x-pack/platform/packages/private/ml/category_validator/tsconfig.json:2 x-pack/platform/packages/private/ml/creation_wizard_utils/jest.config.js:10 x-pack/platform/packages/private/ml/creation_wizard_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/data_frame_analytics_utils/jest.config.js:10 x-pack/platform/packages/private/ml/data_frame_analytics_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/data_grid/jest.config.js:10 x-pack/platform/packages/private/ml/data_grid/tsconfig.json:2 x-pack/platform/packages/private/ml/data_view_utils/jest.config.js:10 x-pack/platform/packages/private/ml/data_view_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/date_picker/jest.config.js:10 x-pack/platform/packages/private/ml/date_picker/tsconfig.json:2 x-pack/platform/packages/private/ml/date_utils/jest.config.js:10 x-pack/platform/packages/private/ml/date_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/field_stats_flyout/jest.config.js:10 x-pack/platform/packages/private/ml/field_stats_flyout/tsconfig.json:2 x-pack/platform/packages/private/ml/in_memory_table/jest.config.js:10 x-pack/platform/packages/private/ml/in_memory_table/tsconfig.json:2 x-pack/platform/packages/private/ml/inference_integration_flyout/jest.config.js:10 x-pack/platform/packages/private/ml/inference_integration_flyout/tsconfig.json:2 x-pack/platform/packages/private/ml/is_defined/jest.config.js:10 x-pack/platform/packages/private/ml/is_defined/tsconfig.json:2 x-pack/platform/packages/private/ml/is_populated_object/jest.config.js:10 x-pack/platform/packages/private/ml/is_populated_object/tsconfig.json:2 x-pack/platform/packages/private/ml/json_schemas/jest.config.js:10 x-pack/platform/packages/private/ml/json_schemas/package.json:7 x-pack/platform/packages/private/ml/json_schemas/tsconfig.json:2 x-pack/platform/packages/private/ml/kibana_theme/jest.config.js:10 x-pack/platform/packages/private/ml/kibana_theme/tsconfig.json:2 x-pack/platform/packages/private/ml/local_storage/jest.config.js:10 x-pack/platform/packages/private/ml/local_storage/tsconfig.json:2 x-pack/platform/packages/private/ml/nested_property/jest.config.js:10 x-pack/platform/packages/private/ml/nested_property/tsconfig.json:2 x-pack/platform/packages/private/ml/number_utils/jest.config.js:10 x-pack/platform/packages/private/ml/number_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/parse_interval/jest.config.js:10 x-pack/platform/packages/private/ml/parse_interval/tsconfig.json:2 x-pack/platform/packages/private/ml/query_utils/jest.config.js:10 x-pack/platform/packages/private/ml/query_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/route_utils/jest.config.js:10 x-pack/platform/packages/private/ml/route_utils/tsconfig.json:2 x-pack/platform/packages/private/ml/string_hash/jest.config.js:10 x-pack/platform/packages/private/ml/string_hash/tsconfig.json:2 x-pack/platform/packages/private/ml/time_buckets/jest.config.js:10 x-pack/platform/packages/private/ml/time_buckets/tsconfig.json:2 x-pack/platform/packages/private/ml/ui_actions/jest.config.js:10 x-pack/platform/packages/private/ml/ui_actions/tsconfig.json:2 x-pack/platform/packages/private/ml/url_state/jest.config.js:10 x-pack/platform/packages/private/ml/url_state/tsconfig.json:2 x-pack/platform/packages/private/ml/validators/jest.config.js:10 x-pack/platform/packages/private/ml/validators/tsconfig.json:2 x-pack/platform/packages/shared/ml/aiops_common/jest.config.js:10 x-pack/platform/packages/shared/ml/aiops_common/tsconfig.json:2 x-pack/platform/packages/shared/ml/aiops_log_pattern_analysis/jest.config.js:10 x-pack/platform/packages/shared/ml/aiops_log_pattern_analysis/tsconfig.json:2 x-pack/platform/packages/shared/ml/aiops_log_rate_analysis/jest.config.js:10 x-pack/platform/packages/shared/ml/aiops_log_rate_analysis/tsconfig.json:2 x-pack/platform/packages/shared/ml/anomaly_utils/jest.config.js:10 x-pack/platform/packages/shared/ml/anomaly_utils/tsconfig.json:2 x-pack/platform/packages/shared/ml/chi2test/jest.config.js:10 x-pack/platform/packages/shared/ml/chi2test/tsconfig.json:2 x-pack/platform/packages/shared/ml/error_utils/jest.config.js:10 x-pack/platform/packages/shared/ml/error_utils/tsconfig.json:2 x-pack/platform/packages/shared/ml/random_sampler_utils/jest.config.js:10 x-pack/platform/packages/shared/ml/random_sampler_utils/tsconfig.json:2 x-pack/platform/packages/shared/ml/response_stream/jest.config.js:10 x-pack/platform/packages/shared/ml/response_stream/tsconfig.json:2 x-pack/platform/packages/shared/ml/runtime_field_utils/jest.config.js:10 x-pack/platform/packages/shared/ml/runtime_field_utils/tsconfig.json:2 x-pack/platform/packages/shared/ml/trained_models_utils/jest.config.js:10 x-pack/platform/packages/shared/ml/trained_models_utils/tsconfig.json:2 x-pack/platform/plugins/private/data_visualizer/jest.config.js:10 x-pack/platform/plugins/private/data_visualizer/tsconfig.json:2 x-pack/platform/plugins/private/data_visualizer/tsconfig.json:7 x-pack/platform/plugins/private/transform/jest.config.js:10 x-pack/platform/plugins/private/transform/tsconfig.json:10 x-pack/platform/plugins/private/transform/tsconfig.json:2 x-pack/platform/plugins/shared/aiops/jest.config.js:10 x-pack/platform/plugins/shared/aiops/tsconfig.json:2 x-pack/platform/plugins/shared/aiops/tsconfig.json:7 x-pack/platform/plugins/shared/ml/jest.config.js:10 x-pack/platform/plugins/shared/ml/readme.md:186 x-pack/platform/plugins/shared/ml/readme.md:192 x-pack/platform/plugins/shared/ml/tsconfig.json:12 x-pack/platform/plugins/shared/ml/tsconfig.json:2 x-pack/platform/plugins/shared/ml/tsconfig.json:24 ``` </details> <details> <summary>Script errors</summary> ``` ``` </details> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co> |
||
|
1d9ca1ebf6
|
[Obs AI Assistant] Fix null pointer in function definition (#203344)
Closes #201713 |
||
|
7f1d436681
|
[React18] Migrate test suites to account for testing library upgrades obs-ux-management-team (#201164)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
df3b18214f
|
Sustainable Kibana Architecture: Move modules owned by @elastic/obs-entities (#202713)
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > This PR has been auto-generated. > Do not attempt to push any changes unless you know what you are doing. > Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. #### 3 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/entities-data-access-plugin` | `x-pack/solutions/observability/plugins/observability_solution/entities_data_access` | | `@kbn/entityManager-app-plugin` | `x-pack/solutions/observability/plugins/observability_solution/entity_manager_app` | | `@kbn/entityManager-plugin` | `x-pack/platform/plugins/shared/entity_manager` | #### 1 package(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/entities-schema` | `x-pack/platform/packages/shared/kbn-entities-schema` | <details> <summary>Updated references</summary> ``` ./docs/developer/plugin-list.asciidoc ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./tsconfig.base.json ./x-pack/platform/packages/shared/kbn-entities-schema/jest.config.js ./x-pack/platform/plugins/shared/entity_manager/jest.config.js ./x-pack/plugins/entity_manager/docs/entity_definitions.md ./x-pack/solutions/observability/plugins/observability_solution/entities_data_access/jest.config.js ./x-pack/solutions/observability/plugins/observability_solution/entity_manager_app/jest.config.js ./yarn.lock ``` </details> <details> <summary>Updated relative paths</summary> ``` x-pack/platform/packages/shared/kbn-entities-schema/jest.config.js:10 x-pack/platform/packages/shared/kbn-entities-schema/scripts/generate.js:8 x-pack/platform/packages/shared/kbn-entities-schema/scripts/generate_oas.js:65 x-pack/platform/packages/shared/kbn-entities-schema/scripts/generate_oas.js:8 x-pack/platform/packages/shared/kbn-entities-schema/scripts/serve_oas_ui.js:8 x-pack/platform/packages/shared/kbn-entities-schema/tsconfig.json:2 x-pack/platform/plugins/shared/entity_manager/jest.config.js:10 x-pack/platform/plugins/shared/entity_manager/tsconfig.json:2 x-pack/platform/plugins/shared/entity_manager/tsconfig.json:7 x-pack/solutions/observability/plugins/observability_solution/entities_data_access/jest.config.js:12 x-pack/solutions/observability/plugins/observability_solution/entities_data_access/tsconfig.json:2 x-pack/solutions/observability/plugins/observability_solution/entity_manager_app/jest.config.js:12 x-pack/solutions/observability/plugins/observability_solution/entity_manager_app/tsconfig.json:2 x-pack/solutions/observability/plugins/observability_solution/entity_manager_app/tsconfig.json:7 ``` </details> <details> <summary>Script errors</summary> ``` ``` </details> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Rudolf Meijering <skaapgif@gmail.com> |
||
|
b3b2c1745a
|
[Security Assistant] Abort signal fix (#203041) | ||
|
7806861c5f
|
feat(slo): SLO grouping values selector (#202364) | ||
|
c5cc1532d7
|
make emotion typing global (#200958)
## Summary Informed by https://github.com/elastic/eui/discussions/6828#discussioncomment-11247425, closes https://github.com/elastic/kibana-team/issues/1299 This PR consolidates typings to provide adequate typing for the `css` prop EUI components accept. Placing the required typing file in the typing directory means that all other plugins that already reference this directory in their `tsconfig.json` would get this improvement by default. <!-- ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --> |
||
|
5c6c4f44d3
|
[ML] Improve some TS. (#202314)
## Summary - Follow up to #175178 to fix some breaking TS changes after the TS `v4.9.5` upgrade. - Follow up to #182344 to replace `any` in `useCallback` with proper types. - Fixes #176123. ### Checklist - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. |
||
|
51e63eeacc
|
[SLOs] Added $state into filters schema !! (#202887)
## Summary fixes https://github.com/elastic/kibana/issues/202999 Added $state into filters schema !! |
||
|
329d3c51f3
|
Adding Tech Preview badge for Reranker (#202561)
## Summary Adding a `Tech Preview` badge for `reranker` model.  ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [X] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
da2ede4839
|
[React18] Migrate test suites to account for testing library upgrades security-threat-hunting-explore (#201142)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
a3496c9ca6
|
[ResponseOps][Alerting] Decouple feature IDs from consumers (#183756)
## Summary This PR aims to decouple the feature IDs from the `consumer` attribute of rules and alerts. Towards: https://github.com/elastic/kibana/issues/187202 Fixes: https://github.com/elastic/kibana/issues/181559 Fixes: https://github.com/elastic/kibana/issues/182435 > [!NOTE] > Unfortunately, I could not break the PR into smaller pieces. The APIs could not work anymore with feature IDs and had to convert them to use rule type IDs. Also, I took the chance and refactored crucial parts of the authorization class that in turn affected a lot of files. Most of the changes in the files are minimal and easy to review. The crucial changes are in the authorization class and some alerting APIs. ## Architecture ### Alerting RBAC model The Kibana security uses Elasticsearch's [application privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html#security-api-put-privileges). This way Kibana can represent and store its privilege models within Elasticsearch roles. To do that, Kibana security creates actions that are granted by a specific privilege. Alerting uses its own RBAC model and is built on top of the existing Kibana security model. The Alerting RBAC uses the `rule_type_id` and `consumer` attributes to define who owns the rule and the alerts procured by the rule. To connect the `rule_type_id` and `consumer` with the Kibana security actions the Alerting RBAC registers its custom actions. They are constructed as `alerting:<rule-type-id>/<feature-id>/<alerting-entity>/<operation>`. Because to authorizate a resource an action has to be generated and because the action needs a valid feature ID the value of the `consumer` should be a valid feature ID. For example, the `alerting:siem.esqlRule/siem/rule/get` action, means that a user with a role that grants this action can get a rule of type `siem.esqlRule` with consumer `siem`. ### Problem statement At the moment the `consumer` attribute should be a valid feature ID. Though this approach worked well so far it has its limitation. Specifically: - Rule types cannot support more than one consumer. - To associate old rules with a new feature ID required a migration on the rule's SOs and the alerts documents. - The API calls are feature ID-oriented and not rule-type-oriented. - The framework has to be aware of the values of the `consumer` attribute. - Feature IDs are tightly coupled with the alerting indices leading to [bugs](https://github.com/elastic/kibana/issues/179082). - Legacy consumers that are not a valid feature anymore can cause [bugs](https://github.com/elastic/kibana/issues/184595). - The framework has to be aware of legacy consumers to handle edge cases. - The framework has to be aware of specific consumers to handle edge cases. ### Proposed solution This PR aims to decouple the feature IDs from consumers. It achieves that a) by changing the way solutions configure the alerting privileges when registering a feature and b) by changing the alerting actions. The schema changes as: ``` // Old formatting id: 'siem', <--- feature ID alerting:['siem.queryRule'] // New formatting id: 'siem', <--- feature ID alerting: [{ ruleTypeId: 'siem.queryRule', consumers: ['siem'] }] <-- consumer same as the feature ID in the old formatting ``` The new actions are constructed as `alerting:<rule-type-id>/<consumer>/<alerting-entity>/<operation>`. For example `alerting:rule-type-id/my-consumer/rule/get`. The new action means that a user with a role that grants this action can get a rule of type `rule-type` with consumer `my-consumer`. Changing the action strings is not considered a breaking change as long as the user's permission works as before. In our case, this is true because the consumer will be the same as before (feature ID), and the alerting security actions will be the same. For example: **Old formatting** Schema: ``` id: 'logs', <--- feature ID alerting:['.es-query'] <-- rule type ID ``` Generated action: ``` alerting:.es-query/logs/rule/get ``` **New formatting** Schema: ``` id: 'siem', <--- feature ID alerting: [{ ruleTypeId: '.es-query', consumers: ['logs'] }] <-- consumer same as the feature ID in the old formatting ``` Generated action: ``` alerting:.es-query/logs/rule/get <--- consumer is set as logs and the action is the same as before ``` In both formating the actions are the same thus breaking changes are avoided. ### Alerting authorization class The alerting plugin uses and exports the alerting authorization class (`AlertingAuthorization`). The class is responsible for handling all authorization actions related to rules and alerts. The class changed to handle the new actions as described in the above sections. A lot of methods were renamed, removed, and cleaned up, all method arguments converted to be an object, and the response signature of some methods changed. These changes affected various pieces of the code. The changes in this class are the most important in this PR especially the `_getAuthorizedRuleTypesWithAuthorizedConsumers` method which is the cornerstone of the alerting RBAC. Please review carefully. ### Instantiation of the alerting authorization class The `AlertingAuthorizationClientFactory` is used to create instances of the `AlertingAuthorization` class. The `AlertingAuthorization` class needs to perform async operations upon instantiation. Because JS, at the moment, does not support async instantiation of classes the `AlertingAuthorization` class was assigning `Promise` objects to variables that could be resolved later in other phases of the lifecycle of the class. To improve readability and make the lifecycle of the class clearer, I separated the construction of the class (initialization) from the bootstrap process. As a result, getting the `AlertingAuthorization` class or any client that depends on it (`getRulesClient` for example) is an async operation. ### Filtering A lot of routes use the authorization class to get the authorization filter (`getFindAuthorizationFilter`), a filter that, if applied, returns only the rule types and consumers the user is authorized to. The method that returns the filter was built in a way to also support filtering on top of the authorization filter thus coupling the authorized filter with router filtering. I believe these two operations should be decoupled and the filter method should return a filter that gives you all the authorized rule types. It is the responsibility of the consumer, router in our case, to apply extra filters on top of the authorization filter. For that reason, I made all the necessary changes to decouple them. ### Legacy consumers & producer A lot of rules and alerts have been created and are still being created from observability with the `alerts` consumer. When the Alerting RBAC encounters a rule or alert with `alerts` as a consumer it falls back to the `producer` of the rule type ID to construct the actions. For example if a rule with `ruleTypeId: .es-query` and `consumer: alerts` the alerting action will be constructed as `alerting:.es-query/stackAlerts/rule/get` where `stackRules` is the producer of the `.es-query` rule type. The `producer` is used to be used in alerting authorization but due to its complexity, it was deprecated and only used as a fallback for the `alerts` consumer. To avoid breaking changes all feature privileges that specify access to rule types add the `alerts` consumer when configuring their alerting privileges. By moving the `alerts` consumer to the registration of the feature we can stop relying on the `producer`. The `producer` is not used anymore in the authorization class. In the next PRs the `producer` will removed entirely. ### Routes The following changes were introduced to the alerting routes: - All related routes changed to be rule-type oriented and not feature ID oriented. - All related routes support the `ruleTypeIds` and the `consumers` parameters for filtering. In all routes, the filters are constructed as `ruleTypeIds: ['foo'] AND consumers: ['bar'] AND authorizationFilter`. Filtering by consumers is important. In o11y for example, we do not want to show ES rule types with the `stackAlerts` consumer even if the user has access to them. - The `/internal/rac/alerts/_feature_ids` route got deleted as it was not used anywhere in the codebase and it was internal. All the changes in the routes are related to internal routes and no breaking changes are introduced. ### Constants I moved the o11y and stack rule type IDs to `kbn-rule-data-utils` and exported all security solution rule type IDs from `kbn-securitysolution-rules`. I am not a fan of having a centralized place for the rule type IDs. Ideally, consumers of the framework should specify keywords like `observablility` (category or subcategory) or even `apm.*` and the framework should know which rule type IDs to pick up. I think it is out of the scope of the PR, and at the moment it seems the most straightforward way to move forward. I will try to clean up as much as possible in further iterations. If you are interested in the upcoming work follow this issue https://github.com/elastic/kibana/issues/187202. ### Other notable code changes - Change all instances of feature IDs to rule type IDs. - `isSiemRuleType`: This is a temporary helper function that is needed in places where we handle edge cases related to security solution rule types. Ideally, the framework should be agnostic to the rule types or consumers. The plan is to be removed entirely in further iterations. - Rename alerting `PluginSetupContract` and `PluginStartContract` to `AlertingServerSetup` and `AlertingServerStart`. This made me touch a lot of files but I could not resist. - `filter_consumers` was mistakenly exposed to a public API. It was undocumented. - Files or functions that were not used anywhere in the codebase got deleted. - Change the returned type of the `list` method of the `RuleTypeRegistry` from `Set<RegistryRuleType>` to `Map<string, RegistryRuleType>`. - Assertion of `KueryNode` in tests changed to an assertion of KQL using `toKqlExpression`. - Removal of `useRuleAADFields` as it is not used anywhere. ## Testing > [!CAUTION] > It is very important to test all the areas of the application where rules or alerts are being used directly or indirectly. Scenarios to consider: > - The correct rules, alerts, and aggregations on top of them are being shown as expected as a superuser. > - The correct rules, alerts, and aggregations on top of them are being shown as expected by a user with limited access to certain features. > - The changes in this PR are backward compatible with the previous users' permissions. ### Solutions Please test and verify that: - All the rule types you own with all possible combinations of permissions both in ESS and in Serverless. - The consumers and rule types make sense when registering the features. - The consumers and rule types that are passed to the components are the intended ones. ### ResponseOps The most important changes are in the alerting authorization class, the search strategy, and the routes. Please test: - The rules we own with all possible combinations of permissions. - The stack alerts page and its solution filtering. - The categories filtering in the maintenance window UI. ## Risks > [!WARNING] > The risks involved in this PR are related to privileges. Specifically: > - Users with no privileges can access rules and alerts they do not have access to. > - Users with privileges cannot access rules and alerts they have access to. > > An excessive list of integration tests is in place to ensure that the above scenarios will not occur. In the case of a bug, we could a) release an energy release for serverless and b) backport the fix in ESS. Given that this PR is intended to be merged in 8.17 we have plenty of time to test and to minimize the chances of risks. ## FQA - I noticed that a lot of routes support the `filter` parameter where we can pass an arbitrary KQL filter. Why we do not use this to filter by the rule type IDs and the consumers and instead we introduce new dedicated parameters? The `filter` parameter should not be exposed in the first place. It assumes that the consumer of the API knows the underlying structure and implementation details of the persisted storage API (SavedObject client API). For example, a valid filter would be `alerting.attributes.rule_type_id`. In this filter the consumer should know a) the name of the SO b) the keyword `attributes` (storage implementation detail) and c) the name of the attribute as it is persisted in ES (snake case instead of camel case as it is returned by the APIs). As there is no abstraction layer between the SO and the API, it makes it very difficult to make changes in the persistent schema or the APIs. For all the above I decided to introduce new query parameters where the alerting framework has total control over it. - I noticed in the code a lot of instances where the consumer is used. Should not remove any logic around consumers? This PR is a step forward making the framework as agnostic as possible. I had to keep the scope of the PR as contained as possible. We will get there. It needs time :). - I noticed a lot of hacks like checking if the rule type is `siem`. Should not remove the hacks? This PR is a step forward making the framework as agnostic as possible. I had to keep the scope of the PR as contained as possible. We will get there. It needs time :). - I hate the "Role visibility" dropdown. Can we remove it? I also do not like it. The goal is to remove it. Follow https://github.com/elastic/kibana/issues/189997. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co> Co-authored-by: Paula Borgonovi <159723434+pborgonovi@users.noreply.github.com> |
||
|
8fe4c44192
|
feat(slo): allow configuration of advanced settings from UI (#200822) | ||
|
697af576d8
|
[eem] _search sort_by and display_name (#202361)
- allow optional `entity_source.display_name` setting. `entity.display_name` will always be set on the entities, falling back to `entity.id` if provided field is not set - allow `sort_by` parameter to `_search` API - removed the `metadata.` prefix in the query aggregation. metadata will now be set at the root of the document (eg for metadata `host.name` entity = `{ entity.id: 'foo', host.name: 'bar' }` - timestamp_field is now optional --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
a32d9c782c
|
Replace style with css prop in CSP package (#202013)
## Summary Part of the resolution of this issue: - https://github.com/elastic/kibana/issues/149246 Removes the `style` prop in React components and elements to avoid using inline styles. Instead, it uses now the `emotion.css` prop to dynamically attach all styles to the native `class` attribute. ### Motivation Using inline styles at scale causes a performance penalty at rendering time. It's way more efficient to attach styles to a single or several classnames instead. ### Screenshots <details><summary>Default Edge</summary> <img width="1028" alt="Screenshot 2024-12-02 at 16 27 47" src="https://github.com/user-attachments/assets/4c913a69-ee26-4cda-829c-2b26799ead81"> </details> <details><summary>Graph Popovers</summary> <img width="175" alt="Screenshot 2024-12-02 at 16 27 57" src="https://github.com/user-attachments/assets/55054b05-9cb4-4ca7-a19a-319277d7961d"> </details> <details><summary>Graph Stacked Edge Cases</summary> <img width="1319" alt="Screenshot 2024-12-02 at 16 28 03" src="https://github.com/user-attachments/assets/11ec7a03-e8cf-4090-9443-56288bf78a2c"> </details> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks - Minor risk with low impact and severity: - Only risk is CSP graph nodes showing with a different background and border |
||
|
2f62cdebfc
|
[Cloud Security] Filters for Contextual Flyout Datagrid (#201708)
## Summary https://github.com/user-attachments/assets/59ace35f-62b8-4c08-bf2c-eed200db791d This PR is for adding Filters for Contextual Flytout Datagrid |
||
|
aa4c39c119
|
[ML] Adds action to add log rate analysis to a case (#201549)
## Summary Follow up to [#197247](https://github.com/elastic/kibana/issues/197247) Adds action to add Log Rate Analysis Embeddable to a case. https://github.com/user-attachments/assets/f45554e1-cef7-4c54-bea5-c509f236a956 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
b0122f547d
|
[Discover / Logs] Add new "Saved Search component" (#199787)
## Summary Implements https://github.com/elastic/logs-dev/issues/111#issuecomment-2446470635. This adds a new "Saved Search component". The component is a wrapper around the current Saved Search Embeddable, but uses `ReactEmbeddableRenderer` directly to render the embeddable outside of Dashboard contexts. It monitors changes to things like `index`, `filters` etc and communicates these changes through the embeddable API. For this PoC two locations were changed to use this component 1) Logs Overview flyout 2) APM Logs tab (when the Logs Overview isn't enabled via advanced settings). The component itself is technically beyond a PoC, and resides in it's own package. ~I'd like to get eyes from the Discover folks etc on the approach, and if we're happy I can fix the remaining known issues (apart from the mixing of columns point as I believe this exists on the roadmap anyway) and we can merge this for the initial two replacement points.~ [Thanks Davis 👌](https://github.com/elastic/logs-dev/issues/111#issuecomment-2475350199). `nonPersistedDisplayOptions` is added to facilitate some configurable options via runtime state, but without the complexity of altering the actual saved search saved object. On the whole I've tried to keep this as clean as possible whilst working within the embeddable framework, outside of a dashboard context. ## Known issues - ~"Flyout on flyout" in the logs overview flyout (e.g. triggering the table's flyout in this context).~ Fixed with `enableFlyout` option. - ~Filter buttons should be disabled via pills (e.g. in Summary column).~ Fixed with `enableFilters` option. - Summary (`_source`) column cannot be used alongside other columns, e.g. log level, so column customisation isn't currently enabled. You'll just get timestamp and summary. This requires changes in the Unified Data Table. **Won't be fixed in this PR** - We are left with this panel button that technically doesn't do anything outside of a dashboard. I don't *think* there's an easy way to disable this. **Won't be fixed in this PR**  ## Followups - ~The Logs Overview details state machine can be cleaned up (it doesn't need to fetch documents etc anymore).~ The state machine no longer fetches it's own documents. Some scaffolding is left in place as it'll be needed for showing category details anyway. ## Example   --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
50a2ffa7f2
|
Set min-width for DistributionBar and added README for storybook (#202247)
## Summary - This pull request resolves [elastic/kibana#200881](https://github.com/elastic/kibana/issues/200881) by setting a min-width of 10px for the DistributionBar component to prevent it from shrinking too small, ensuring a consistent and readable visual representation for better usability. - Additionally, added a README file with instructions for running Storybook to visually inspect the DistributionBar, as the folder had no documentation before, improving the developer experience. ## Screenshots: **Before** - The min-width of 10px was set, but small segments were not visible in the DistributionBar.  - The original mockStatsFindings with 'passed' set to 90 and 'failed' set to 10 did not visually reflect the min-width of 10px in the DistributionBar. The smallest segment was still not visible.  **After**: - Temporarily modified the `mockStatsFindings` in `distribution_bar.stories.tsx` to simulate the DistributionBar with extreme values by setting the count for 'passed' to 9000 (highest) and 'failed' to 1 (lowest):  - After the modification, the DistributionBar displayed correctly with even the smallest segments visible, confirming that the min-width is working as expected.  - These results were captured in a screenshot for the PR, and no changes were saved to the `distribution_bar.stories.tsx` file. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) |
||
|
52fa276661
|
[Obs AI Assistant] Remove the navigate-to-conversation button when there are initial messages but no conversationId (#202243)
Closes https://github.com/elastic/kibana/issues/198379 ## Summary ### Problem When a conversation is started from contextual insights, `initialMessages` are set and displayed on the `ChatFlyout`. However, when the user clicks on "Navigate to conversations` from the Chat flyout header, a new conversation opens in the `ai_assistant_app`. This is because, even though there are initial messages set, there is no conversation ID until the user interacts with the AI Assistant for the conversation started from contextual insights. In order to navigate to a conversation (to the `ai_assistant_app`), a conversationID is required, if not a new conversation opens up. This behaviour seems a little inconsistent, because the expectation is to have the initial messages displayed on the AI Assistant app too. ### Solution Since we do not have a way to persist these initial messages from contextual insights when navigating to the conversations view (`ai_assistant_app`), the navigate to conversations button is removed. If the user interacts with this conversation, since the conversation will be persisted with a conversationId, "navigate to conversations" will be available. ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) |
||
|
d5cf0a6be4
|
[product documentation] Fix index names (#202265)
## Summary Follow-up of https://github.com/elastic/kibana/pull/194379. Turns out, the prefix for kibana system indices is `.kibana_*`, so our indices were not considered as kibana system indices and causing warnings when created, such as ``` Elasticsearch deprecation: 299 Elasticsearch-6db572c986d7e114b8b46f1d6f4169bed06717c5 "index name [.kibana-ai-product-doc-kibana] starts with a dot '.', in the next major version, index names starting with a dot are reserved for hidden indices and system indices" Origin:kibana ``` This PR addresses it, by changing the product doc index names to follow our system index pattern. |
||
|
d0794de945
|
[Stateful sidenav] Fix highlight colours (#201823) | ||
|
28905708d4
|
[EDR Workflows] Endpoint Insights UI - Connector selection (#201109)
 This is the first part of the UI changes related to [the epic](https://github.com/elastic/security-team/issues/10730). This PR introduces a new “Issues” section on the endpoint details flyout and focuses specifically on the “Scan” subsection. The “Scan” subsection focuses on connector selection and adding new connectors. A stub for the results has been added, but implementing the results is out of scope for the ticket addressed in this PR. Testing should be covered in the follow up PR's. https://github.com/user-attachments/assets/400a71e2-8a39-4916-b539-6f1bf3293cbf --------- Co-authored-by: Tomasz Ciecierski <tomasz.ciecierski@elastic.co> |
||
|
f0540977af
|
[React18] Migrate test suites to account for testing library upgrades kibana-security (#201151)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
a800360ac3
|
[Obs AI Assistant] Borealis theme integration (#200814)
## Summary Integrates changes from the Borealis theme to the components owned by `obs-ai-assistant`, `obs-knowledge` teams and for files related to `kbn-ai-assistant`. ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
a92103b2a9
|
[SLO] Exclude stale slos from healthy count on overview (#201027)
## Summary Resolves #198911. The result is achieved by nesting a new filter agg inside the existing `HEALTHY` agg to remove any stale SLOs from the ultimate result. This required a modification of the parsing code on the ES response to include a new `not_stale` key. The original `success` total is preserved in the `doc_count` of that agg, but is no longer referenced. The filter for the `not_stale` agg I have added is the logical inverse of the filter we're using to determine stale SLOs: ```json { "range": { "summaryUpdatedAt": { "gte": "now-48h" } } } ``` _Reviewer note: I also changed the spelling of a UI component, should be a completely transparent change._ ## Example ### Before This is my local running on `main`: <img width="1116" alt="image" src="https://github.com/user-attachments/assets/80f86426-c7f1-4847-830f-a311c865a225"> ### After This is my local running on this PR branch: <img width="1120" alt="image" src="https://github.com/user-attachments/assets/2c4c4f26-2407-41ca-bf01-9ca730bbfab2"> ### Proof query works You can replicate these results by including a similar agg on a query against SLO data. I added a terms agg to the `stale` agg to determine how many SLOs I need to remove. The number of `HEALTHY` SLOs showing up in `stale` should match the difference between the total `doc_count` from `healthy` and the `doc_count` in the `not_stale` sub-aggregation. #### Query You can run this example aggs: ```json { "aggs": { "stale": { "filter": { "range": { "summaryUpdatedAt": { "lt": "now-48h" } } }, "aggs": { "by_status": { "terms": { "field": "status" } } } }, "healthy": { "filter": { "term": { "status": "HEALTHY" } }, "aggs": { "not_stale": { "filter": { "range": { "summaryUpdatedAt": { "gte": "now-48h" } } } } } } } } ``` #### Relevant output Here's a subset of my example query output. You can see that `stale.by_status.buckets[1]` contains a total of 2 docs, which is the difference between `healthy.doc_count` and `healthy.not_stale.doc_count`. ```json { "stale": { "doc_count": 7, "by_status": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": "VIOLATED", "doc_count": 5 }, { "key": "HEALTHY", "doc_count": 2 } ] } }, "healthy": { "doc_count": 9, "not_stale": { "doc_count": 7 } } } ``` |
||
|
63da7701e7
|
[Streams] App plugin (#200060)
Creates the Streams app plugin, which renders UI for managing streams (see https://github.com/elastic/kibana/pull/198713). Additional changes in this PR: - The menus were updated to conditionally add a link to the Streams app. The Streams plugin itself returns a status$ observable which signals if Streams have been enabled. This value is used to conditionally render the link in the various flavors of menus. - There's a small change in the ES types to allow for ordered params in ES|QL (vs named params) - `@kbn/server-route-repository` was updated to be able to override `access` (instead of only inferring it from the endpoint name). Additionally, we now allow all route options by default. - `@kbn/typed-react-router-config` now also exports a `useBreadcrumbs`. This was copied over from the APM implementation. - the signature of the `esql` method in `ObservabilityElasticsearchClient` was updated to separate processing options from options that are sent over to the _query endpoint. --------- Co-authored-by: Chris Cowan <chris@elastic.co> Co-authored-by: Joe Reuter <johannes.reuter@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
0b3f4fbd3c
|
[eem] _search endpoint / initial entity manager UI (#199609)
## Summary - create `_search` endpoint to discover entities with esql queries. It currently reads sources of the provided `type` from `kibana_entity_definitions` index. Run this query to insert a definition: ``` POST kibana_entity_definitions/_doc { "entity_type": "service", "index_patterns": ["remote_cluster:logs-*"], "metadata_fields": [], "identity_fields": ["service.name"], "filters": [], "timestamp_field": "@timestamp" } ``` By default `_search` will look at data in the last 5m. The lookup period can be overriden by providing `start`/`end` parameters in ISO format. It also accepts a `limit` to specify the number of entities returned which defaults to 10 ``` POST kbn:/internal/entities/v2/_search { "type": "service", "start": "2024-11-19T20:40:00.000Z", "end": "2024-11-19T20:50:00.000Z", "limit": 20 } ``` - create `_search/preview` endpoint to preview output of entity sources without persisting them - create UI to preview results of an entity definition at `/app/entity_manager`. The application is living in its own plugin at `observability_solution/entity_manager_app`  --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Milton Hultgren <miltonhultgren@gmail.com> |
||
|
855e03e0b6
|
[Security solution] Fix gemini streaming (#201299)
## Summary Fixes streaming for Gemini in Security Assistant. Content can appear in the `finishReason` block. I'm not sure when this started happening. Updates our streaming logic to support content being in the `finishReason` block. Example of `finishReason` block with content: ``` `data: {"candidates": [{"content": {"role": "model","parts": [{"text": " are 170 critical and 20 high open alerts."}]},"finishReason": "STOP","safetyRatings": [{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE","probabilityScore": 0.060086742,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.17106095},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE","probabilityScore": 0.16776322,"severity": "HARM_SEVERITY_LOW","severityScore": 0.37113687},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE","probabilityScore": 0.124212936,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.17441037},{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE","probabilityScore": 0.05419875,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.03461887}]}],"usageMetadata": {"promptTokenCount": 1062,"candidatesTokenCount": 15,"totalTokenCount": 1077},"modelVersion": "gemini-1.5-pro-002"}` ``` ## To test 1. Have alerts 2. Have a Gemini connector (`gemini-1.5-pro-002`) 3. Have streaming on in the assistant with the Gemini connector selected 4. Ask the assistant: "How many open alerts do I have?" ### Previously A response begin to streams and then the response gets cut off. <img width="963" alt="Screenshot 2024-11-21 at 4 18 06 PM" src="https://github.com/user-attachments/assets/3f25b682-64ea-4878-83de-17180886eb84"> ### Now The response streams in full as expected. <img width="965" alt="Screenshot 2024-11-21 at 4 25 13 PM" src="https://github.com/user-attachments/assets/162a6ccc-08c5-4108-bb1e-5df2b37ce554"> --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
|
9ad5576d07
|
[React18] Migrate test suites to account for testing library upgrades ml-ui (#201161)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. |
||
|
b1d3de2bfa
|
[ML] Removing use of ignore_throttled (#199107)
`ignore_throttled` is being removed, we can remove it from the various searches we run. I'm leaving it in the schema for the datafeed config for now, just in case we have a situation where a very old job is used in the UI with an endpoint which validates the datafeed config. Even though the setting would be ignored, we don't want the route to reject the datafeed because it doesn't know what `ignore_throttled` is. When cloning very old jobs jobs, I'm removing `ignore_throttled` from the `indices_options` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
b24fdf5d3f
|
Sustainable Kibana Architecture: Categorise straightforward packages (#199630)
## Summary This PR is part of the Kibana Sustainable Architecture effort. The goal is to start categorising Kibana packages into _generic platform_ (`group: "platform"`) vs _solution-specific_. ``` group?: 'search' | 'security' | 'observability' | 'platform' visibility?: 'private' | 'shared' ``` Uncategorised modules are considered to be `group: 'common', visibility: 'shared'` by default. We want to prevent code from solution A to depend on code from solution B. Thus, the rules are pretty simple: * Modules can only depend on: * Modules in the same group * OR modules with 'shared' visibility * Modules in `'observability', 'security', 'search'` groups are mandatorily `visibility: "private"`. Long term, the goal is to re-organise packages into dedicated folders, e.g.: ``` x-pack/platform/plugins/private x-pack/observability/packages ``` For this first wave, we have categorised packages that seem "straightforward": * Any packages that have: * at least one dependant module * all dependants belong to the same group * Categorise all Core packages: * `@kbn/core-...-internal` => _platform/private_ * everything else => _platform/shared_ * Categorise as _platform/shared_ those packages that: * Have at least one dependant in the _platform_ group. * Don't have any `devOnly: true` dependants. ### What we ask from you, as CODEOWNERS of the _package manifests_, is that you confirm that the categorisation is correct: * `group: "platform", visibility: "private"` if it's a package that should only be used from platform code, not from any solution code. It will be loaded systematically in all serverless flavors, but solution plugins and packages won't be able to `import` from it. * `group: "platform", visibility: "shared"` if it's a package that can be consumed by both platform and solutions code. It will be loaded systematically in all serverless flavors, and anybody can import / use code from it. * `group: "observability" | "security" | "search", visibility: "private"` if it's a package that is intented to be used exclusively from a given solution. It won't be accessible nor loaded from other solutions nor platform code. Please refer to [#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E) for any related questions. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
|
b1eae2deed
|
[React18] Migrate test suites to account for testing library upgrades kibana-cloud-security-posture (#201159)
This PR migrates test suites that use `renderHook` from the library `@testing-library/react-hooks` to adopt the equivalent and replacement of `renderHook` from the export that is now available from `@testing-library/react`. This work is required for the planned migration to react18. ## Context In this PR, usages of `waitForNextUpdate` that previously could have been destructured from `renderHook` are now been replaced with `waitFor` exported from `@testing-library/react`, furthermore `waitFor` that would also have been destructured from the same renderHook result is now been replaced with `waitFor` from the export of `@testing-library/react`. ***Why is `waitFor` a sufficient enough replacement for `waitForNextUpdate`, and better for testing values subject to async computations?*** WaitFor will retry the provided callback if an error is returned, till the configured timeout elapses. By default the retry interval is `50ms` with a timeout value of `1000ms` that effectively translates to at least 20 retries for assertions placed within waitFor. See https://testing-library.com/docs/dom-testing-library/api-async/#waitfor for more information. This however means that for person's writing tests, said person has to be explicit about expectations that describe the internal state of the hook being tested. This implies checking for instance when a react query hook is being rendered, there's an assertion that said hook isn't loading anymore. In this PR you'd notice that this pattern has been adopted, with most existing assertions following an invocation of `waitForNextUpdate` being placed within a `waitFor` invocation. In some cases the replacement is simply a `waitFor(() => new Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for point out exactly why this works), where this suffices the assertions that follow aren't placed within a waitFor so this PR doesn't get larger than it needs to be. It's also worth pointing out this PR might also contain changes to test and application code to improve said existing test. ### What to do next? 1. Review the changes in this PR. 2. If you think the changes are correct, approve the PR. ## Any questions? If you have any questions or need help with this PR, please leave comments in this PR. |
||
|
e92ef08689
|
[Security solution] Use BedrockRuntimeClient to interact with converse APIs (#201046)
|
||
|
c842db549a
|
[Cloud Security] Refactor Contextual Flyout (#200291)
## Summary This PR is for reducing code duplication by Encapsulating Hooks, Functions, constants that are used multiple times in a same manner accross multiple files --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Maxim Kholod <maxim.kholod@elastic.co> |