You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(backend): eliminate race condition in feature flag override writes (#839)
## Summary
- Replace read-modify-write pattern with merge patches for ConfigMap
updates, eliminating a race condition that caused 500 errors during
batch saves
- `setFlagOverride`: now uses `MergePatchType` to atomically set a
single key; falls back to `Create` + retry if the ConfigMap doesn't
exist yet
- `DeleteFeatureFlagOverride`: now uses `MergePatchType` with `null`
value to atomically remove a key
- Permission checks changed from `"update"`/`"create"` to `"patch"` to
match the new write method
## Problem
When workspace admins saved multiple feature flag overrides via the
batch save UI, the frontend sent parallel PUT requests. The old
`setFlagOverride` used a GET → modify → Update pattern. All concurrent
requests read the same `resourceVersion`, and every request after the
first failed with a Kubernetes 409 Conflict (surfaced as HTTP 500).
## Test plan
- [x] Existing Ginkgo feature flag admin tests pass (3
previously-failing create-from-scratch tests now pass)
- [ ] Manual: toggle 3+ flags in Workspace Settings and click Save — all
should succeed
Fixes: [RHOAIENG-52262](https://issues.redhat.com/browse/RHOAIENG-52262)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments