Follow-up from "Audit Events for ai catalog agents"
The following discussions from !212259 (merged) should be addressed:
-
@.luke started a discussion: (+1 comment) Thought
For these, and
#disable_messages, I can imagine we could pass through something in theparamsto know the scope, and so say either"project"or"group"in the audit event.This is probably a very fiddly nice-to-have - so if you like this idea, let's only do in after our more important work has all been completed, in a week or so.
-
@.luke started a discussion: Thought
We print an empty tool array
[]if an agent is created with no tools - but that seems like a good audit because it shows there were no tools.
If we wanted to get fancy we could improve this just a bit to something like:
messages << "Created a new #{visibility} AI agent with tools: #{tools_list}" if tools_list.present? messages << "Created a new #{visibility} AI agent with no tools" if tools_list.blank?
There was an undercoverage failure https://gitlab.com/gitlab-org/gitlab/-/jobs/12071393825 that shows we never entered the else branch - we could add a test for that.
undercover: 👮♂️ some methods have no test coverage! Please add specs for methods listed below
🚨 1) node `messages` type: instance method,
loc: ee/app/services/ai/catalog/agents/audit_event_message_service.rb:15:30, coverage: 85.71%
15: def messages hits: n/a
16: case event_type hits: 109
17: when 'create_ai_catalog_agent' hits: n/a
18: create_messages hits: 21
19: when 'update_ai_catalog_agent' hits: n/a
20: update_messages hits: 30
21: when 'delete_ai_catalog_agent' hits: n/a
22: delete_messages hits: 34
23: when 'enable_ai_catalog_agent' hits: n/a
24: enable_messages hits: 7
25: when 'disable_ai_catalog_agent' hits: n/a
26: disable_messages hits: 17
27: else hits: n/a
28: [] hits: 0
29: end hits: n/a
30: end hits: n/a