Validate VSA stream has unique stage names pre-save
What does this MR do and why?
Currently associated record uniqueness cannot be enforced by ActiveRecord when a record is saved via accepts_nested_attributes_for
. This is a known bug in ActiveRecord/Rails
When we save a value stream with two or more duplicate stage name, return a meaningful error when saving.
The frontend doing its own duplicate validation and displaying the proper errors are scoped in VSA: Value stream errors are not shown (#415512 - closed) and VSA: Add duplicate stage name validation on val... (#415513 - closed)
Screenshots or screen recordings
Before
The button swirls forever, with a hidden 500 response in the backend. User can take no actions and must reload.
After
The backend returns 422 with the validation errors, ready for the frontend to display.
The "create value stream" button becomes active again. No error is shown, but the user can rename the duplicate stage names and re-submit.
How to set up and validate locally
- Go to
Analytics -> Value Stream Analytics
in the left hand menu for some group or project for which you have appropriate access - Select
New value stream
at the top, and select "No template" - Add a name for your stream and at least two stages with duplicate names.
e.g.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #415404 (closed)