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 emit UndetectableDelimiter
  • Skip blank rows manually in the loop so lineNumber matches 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 parseOverridesCsvRow return { override } or { error } so cap is 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) ✅ Merged
BE: username on BudgetCapUserOverrideInput https://gitlab.com/gitlab-org/gitlab/-/work_items/630983 !258407 (merged) ✅ Merged
FE: bulk update overrides modal https://gitlab.com/gitlab-org/gitlab/-/work_items/630982 !257948 (merged) ✅ Merged
FE: CSV parser https://gitlab.com/gitlab-org/gitlab/-/work_items/630984 !258244 (merged) ✅ Merged
FE: integrate modal with BE https://gitlab.com/gitlab-org/gitlab/-/work_items/630985 !258465 (merged) ✅ Merged
FE: CSV parser improvements (follow-up) https://gitlab.com/gitlab-org/gitlab/-/work_items/631895 !259381 (merged) ⬅️ Current
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

How to set up and validate locally

  1. In rails console enable the feature flag

    Feature.enable(:credit_caps_bulk_update)
  2. Visit admin area

  3. Then GitLab Credits page

  4. Click on Credit caps, leading to http://localhost:3000/admin/gitlab_credits_dashboard/credit_caps

  5. Click on Bulk update button

  6. Fill csv input and submit

  7. 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,false

Case-insensitive enabled — all of these should parse successfully:

alice,100,True
bob,50,FALSE
carol,0,TRUE

Invalid — enabled value that is not a boolean variant (should error):

alice,100,yes

Semi-colon separated — delimiter is pinned to ,, so this is rejected outright:

alice;100;true
bob;50;false

MR 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.

Edited by Kos Palchyk

Merge request reports

Loading
Loading