Skip to content

Conversation

@angorayc
Copy link
Contributor

@angorayc angorayc commented Jun 24, 2025

Summary

#224127
Steps to reproduce: (env)

  1. Visit app/management/kibana/securityAiAssistantManagement?tab=knowledge_base
  2. Observe that the knowledge base is not showed due to a client side error:
Screenshot 2025-06-24 at 09 56 13

Expected: https://www.elastic.co/docs/solutions/security/ai/ai-assistant-knowledge-base#_option_2_enable_knowledge_base_from_the_security_ai_settings

Screenshot 2025-06-24 at 11 15 23

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

@angorayc angorayc added bug Fixes for quality problems that affect the customer experience Team:Security Generative AI Security Generative AI v9.0.3 labels Jun 24, 2025
@angorayc angorayc marked this pull request as ready for review June 24, 2025 10:22
@angorayc angorayc requested a review from kibanamachine as a code owner June 24, 2025 10:22
@angorayc angorayc added the backport This PR is a backport of another PR label Jun 24, 2025
jest.mock('../../common/lib/kibana', () => ({
useKibana: jest.fn(),
}));
jest.mock('../../common/hooks/use_space_id', () => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to modify this test file so that it does not mock AssistantSettingsManagement? Alternatively, it would be great if we could add a test that would fail if is removed by accident in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could try to do that by wrapping assistant settings management component into the AssistantSpaceIdProvider within the plugin setup if we have access to active space id from there https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/plugin.tsx#L214. This way we would avoid using useSpaceId hook completely.

But if that is too much work (+ I guess this is an urgent fix), I think we can also go with the current solution and update it later if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the implementation on the main branch:

AssistantSpaceIdProvider was introduced but was accidentally dropped during its 9.0 backport
x-pack/solutions/security/plugins/security_solution/public/assistant/stack_management/management_settings.tsx:

https://github.com/elastic/kibana/pull/221566/files#diff-09e012f07b9ef5bd3559d3e05261436872407428a0fa8d1e2b4651b8f887cabc

I applied the same fix for its test file but some tests failed, I'm still trying to figure out:
x-pack/solutions/security/plugins/security_solution/public/assistant/stack_management/management_settings.test.tsx:
https://github.com/elastic/kibana/pull/221566/files#diff-14290c240aafc6f614c221dbde3b575f627f0ab8484b7186ed4d8e029fc9c3b7

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Thank you for the fix - tested locally and it worked. Will leave approval to @KDKHD

Copy link
Contributor Author

@angorayc angorayc Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found another line dropped during the backport: https://github.com/elastic/kibana/pull/221566/files#diff-09e012f07b9ef5bd3559d3e05261436872407428a0fa8d1e2b4651b8f887cabcR16

I'd keep AssistantSettingsManagement to align with the code with the main branch:
https://github.com/elastic/kibana/pull/221566/files#diff-14290c240aafc6f614c221dbde3b575f627f0ab8484b7186ed4d8e029fc9c3b7

and added scenarios for both space id is available and unavailable.

I'll also re-think the error display for the AssistantSpaceIdProvider and try not to let it blocks the UI (I'll do the enhancement in a new PR and do the code change from the main branch).

@angorayc angorayc enabled auto-merge (squash) June 25, 2025 12:10
@angorayc angorayc merged commit 18d8355 into elastic:9.0 Jun 25, 2025
9 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 8.9MB 8.9MB +295.0B

@spong spong added v9.0.4 and removed v9.0.3 labels Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR bug Fixes for quality problems that affect the customer experience Team:Security Generative AI Security Generative AI v9.0.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants