Credit caps overrides bulk update parser improvements
What does this MR do and why?
Addresses review feedback from !258244 (merged) to harden the CSV parser and improve error reporting.
- Pin delimiter to
,so Papa Parse doesn't auto-detect and emitUndetectableDelimiter - Skip blank rows manually in the loop so
lineNumbermatches the textarea line the user sees - Require at least one entry — submitting empty input now shows a validation error instead of a parse error
- Have
parseOverridesCsvRowreturn{ override }or{ error }socapis computed once
Implementation status
Part of https://gitlab.com/gitlab-org/gitlab/-/work_items/630981
| Piece | Work item | MR | Status |
|---|---|---|---|
Feature flag credit_caps_bulk_update + scaffold button |
https://gitlab.com/gitlab-org/gitlab/-/work_items/630982 | !257651 (merged) | |
BE: username on BudgetCapUserOverrideInput |
https://gitlab.com/gitlab-org/gitlab/-/work_items/630983 | !258407 (merged) | |
| FE: bulk update overrides modal | https://gitlab.com/gitlab-org/gitlab/-/work_items/630982 | !257948 (merged) | |
| FE: CSV parser | https://gitlab.com/gitlab-org/gitlab/-/work_items/630984 | !258244 (merged) | |
| FE: integrate modal with BE | https://gitlab.com/gitlab-org/gitlab/-/work_items/630985 | !258465 (merged) | |
| FE: CSV parser improvements (follow-up) | https://gitlab.com/gitlab-org/gitlab/-/work_items/631895 | !259381 (merged) | |
| Documentation update | https://gitlab.com/gitlab-org/gitlab/-/work_items/632125 | !259654 (merged) | |
| Feature flag rollout | https://gitlab.com/gitlab-org/gitlab/-/work_items/631018 |
References
- Addresses part of https://gitlab.com/gitlab-org/gitlab/-/issues/631895
- Part of https://gitlab.com/gitlab-org/gitlab/-/work_items/630981
- Follow-up to !258244 (merged)
How to set up and validate locally
-
In rails console enable the feature flag
Feature.enable(:credit_caps_bulk_update) -
Visit admin area
-
Then
GitLab Creditspage -
Click on
Credit caps, leading to http://localhost:3000/admin/gitlab_credits_dashboard/credit_caps -
Click on
Bulk updatebutton -
Fill csv input and submit
-
See either parsed values or input errors
A few cases for testing:
Empty input — submitting with nothing (or only blank lines) should show "No overrides to save":
Blank lines are ignored — line numbers in errors still match the textarea (line 2 is blank, error should say "Line 3"):
alice,100,true
bob,notanumber,falseCase-insensitive enabled — all of these should parse successfully:
alice,100,True
bob,50,FALSE
carol,0,TRUEInvalid — enabled value that is not a boolean variant (should error):
alice,100,yesSemi-colon separated — delimiter is pinned to ,, so this is rejected outright:
alice;100;true
bob;50;falseMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.