Validate all event action names to be lowercase/numbers/underscores
What does this MR do and why?
- Adds regex validation to event actions names (enforced from
event_definition_validate_all_spec.rb
) - Updates regex used in internal events CLI flow for defining events to match
Related issue: Enforce underscores in event names (#434555 - closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Updated error message for example event BAD_EVENT_NAME
:
How to set up and validate locally
Validate existing definitions:
- Modify the action field in any file in
config/events
to include non-lowercase/underscore/number characters - Open
rails c
- Run
Gitlab::Tracking::EventDefinition.definitions.each { puts _1.validation_errors }; 0
to see the error output
Prevent new definitions:
- Run
ruby scripts/internal_events/cli.rb
- Select
New Event
- Input a random description
- Input an invalid action name & see error output