Send Duo availability params only when changed

What does this MR do and why?

Every _availability= setter on NamespaceSetting writes both the cascading attribute and its lock_* column. Submitting one that an ancestor group (or the instance) has locked failed the whole group settings PUT with a 400, even though the value was unchanged and its input is read-only:

{"message":{"namespace_settings.lock_duo_foundational_flows_enabled":["cannot be changed because it is locked by an ancestor"]}}

submitForm now sends the seven availability params only when the user actually changed them, so an untouched locked param is never submitted.

References

This is the frontend half. Direct API callers still hit the 400, so the backend guard is still needed.

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Create a parent group and a child group.
  2. As owner of the parent, go to Settings > GitLab Duo > Flows and uncheck Allow foundational flows. Save.
  3. As owner of the child, open Settings > GitLab Duo. The checkbox shows as locked by an ancestor.
  4. Change any unrelated Duo setting and click Save changes.
  5. Before: 400 with the error above, nothing saved. After: saves successfully.
  6. Confirm in devtools that the PUT body omits duo_foundational_flows_availability.

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 Justin Ho Tuan Duong

Merge request reports

Loading
Loading