From 4a30e1a720437702f686ac8bea7957e74caa5ea3 Mon Sep 17 00:00:00 2001 From: Elena Shostak <165678770+elena-shostak@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:52:39 +0200 Subject: [PATCH] [Spaces] Excluded deprecated features from solution visibility (#230385) ## Summary Excluded deprecated features from solution visibility. ## How to test 1. Change the solution from `classic` to `observability` for the very first time in the default space. Make sure the response of the active space `GET internal/spaces/_active_space` doesn't contain deprecated features. (`siem`, `siemV2`, `securitySolutionCases` and `securitySolutionCasesV2` were deprecated, so only `siemV3` and `securitySolutionCasesV3` should be on the list) ``` { "id": "default", "name": "Default", "description": "This is your default space!", "color": "#00bfb3", "initials": "D", "imageUrl": "", "disabledFeatures": [ "siemV3", "securitySolutionCasesV3", "securitySolutionAssistant", "securitySolutionAttackDiscovery", "securitySolutionTimeline", "securitySolutionNotes", "securitySolutionSiemMigrations" ], "_reserved": true, "solution": "oblt" } ``` 2. Change the solution back to `classic` and enable all security features. Screenshot 2025-08-04 at 12 35 36 3. Update the space and go back to Edit Space page. 3. Make sure the enabled features counter is correctly displayed in the UI. ### Checklist - [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] 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) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. __Fixes: https://github.com/elastic/kibana/issues/220743__ ## Release Note Excluded deprecated features from spaces solution visibility. (cherry picked from commit 81f252c02d076b83d795ffadb9030e43ed09c0fb) # Conflicts: # x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.test.ts # x-pack/test/spaces_api_integration/common/suites/create.ts # x-pack/test/spaces_api_integration/common/suites/get.ts # x-pack/test/spaces_api_integration/common/suites/get_all.ts --- .../utils/space_solution_disabled_features.test.ts | 14 ++++++++++++++ .../lib/utils/space_solution_disabled_features.ts | 3 ++- .../spaces_api_integration/common/suites/create.ts | 5 ----- .../spaces_api_integration/common/suites/get.ts | 5 ----- .../common/suites/get_all.ts | 5 ----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.test.ts b/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.test.ts index f19b4d585dc22..df54365d2c6e4 100644 --- a/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.test.ts +++ b/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.test.ts @@ -13,6 +13,7 @@ const features = [ { id: 'feature2', category: { id: 'enterpriseSearch' } }, { id: 'feature3', category: { id: 'securitySolution' } }, { id: 'feature4', category: { id: 'should_not_be_returned' } }, // not a solution, it should never appeared in the disabled features + { id: 'feature6', category: { id: 'observability' }, deprecated: true }, ] as KibanaFeature[]; describe('#withSpaceSolutionDisabledFeatures', () => { @@ -85,5 +86,18 @@ describe('#withSpaceSolutionDisabledFeatures', () => { expect(result).toEqual(['feature1', 'feature2']); // "baz" from the spaceDisabledFeatures should not be removed }); + + test('it does not include deprecated features in space disabled features', () => { + const spaceDisabledFeatures: string[] = []; + const spaceSolution = 'security'; + + const result = withSpaceSolutionDisabledFeatures( + features, + spaceDisabledFeatures, + spaceSolution + ); + + expect(result).not.toContain('feature6'); + }); }); }); diff --git a/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.ts b/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.ts index 2682daf3a1c54..acef92c1de4cc 100644 --- a/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.ts +++ b/x-pack/platform/plugins/shared/spaces/server/lib/utils/space_solution_disabled_features.ts @@ -15,7 +15,8 @@ const getFeatureIdsForCategories = ( ) => { return features .filter((feature) => - feature.category + // We need to make sure we only reference non-deprecated features + feature.category && !feature.deprecated ? categories.includes( feature.category.id as 'observability' | 'enterpriseSearch' | 'securitySolution' ) diff --git a/x-pack/test/spaces_api_integration/common/suites/create.ts b/x-pack/test/spaces_api_integration/common/suites/create.ts index f319eb50aa9ce..cb9fa66d56c1b 100644 --- a/x-pack/test/spaces_api_integration/common/suites/create.ts +++ b/x-pack/test/spaces_api_integration/common/suites/create.ts @@ -80,18 +80,13 @@ export function createTestSuiteFactory(esArchiver: any, supertest: SuperTest) 'infrastructure', 'inventory', 'logs', - 'observabilityCases', - 'observabilityCasesV2', 'observabilityCasesV3', 'securitySolutionAssistant', 'securitySolutionAttackDiscovery', - 'securitySolutionCases', - 'securitySolutionCasesV2', 'securitySolutionCasesV3', 'securitySolutionNotes', 'securitySolutionSiemMigrations', 'securitySolutionTimeline', - 'siem', 'siemV2', 'slo', 'uptime', diff --git a/x-pack/test/spaces_api_integration/common/suites/get_all.ts b/x-pack/test/spaces_api_integration/common/suites/get_all.ts index d2e9a2b6313e1..a5d03290d54b4 100644 --- a/x-pack/test/spaces_api_integration/common/suites/get_all.ts +++ b/x-pack/test/spaces_api_integration/common/suites/get_all.ts @@ -79,18 +79,13 @@ const ALL_SPACE_RESULTS: Space[] = [ 'infrastructure', 'inventory', 'logs', - 'observabilityCases', - 'observabilityCasesV2', 'observabilityCasesV3', 'securitySolutionAssistant', 'securitySolutionAttackDiscovery', - 'securitySolutionCases', - 'securitySolutionCasesV2', 'securitySolutionCasesV3', 'securitySolutionNotes', 'securitySolutionSiemMigrations', 'securitySolutionTimeline', - 'siem', 'siemV2', 'slo', 'uptime',