Fix KVEditor duplicate key rename validation

Prevent users from renaming a KVEditor entry to an existing key and show inline validation errors.
This commit is contained in:
2026-04-19 19:59:13 +02:00
parent 082dcc7ee1
commit c58eb240b1
4 changed files with 110 additions and 11 deletions

View File

@@ -73,9 +73,9 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr
---
### TASK-004 — `KVEditor` key rename silently overwrites duplicate keys
### TASK-004 — `KVEditor` key rename silently overwrites duplicate keys (done)
**Where found:** `frontend/src/components/config/KVEditor.tsx`, `handleKeyChange` function (lines 1420).
**Where fixed:** `frontend/src/components/config/KVEditor.tsx`, `frontend/src/components/config/configStyles.ts`, `frontend/src/components/config/__tests__/KVEditor.test.tsx`
**Goal:** Before applying a key rename, check whether `newKey` already exists in `entries`. If it does, show a validation error inline (a `MessageBar` beneath the affected input row or a red border via `validationState="error"` on the Fluent UI `Input`). Block the `onChange` call until the conflict is resolved.