summaryrefslogtreecommitdiffhomepage
path: root/src/features/named-agents/ui/NamedAgentsView.test.ts
AgeCommit message (Collapse)Author
2026-08-20fix(named-agents): key editable rows by stable row key for uniqueness + ↵Adam Malczewski
save/remove identity Draft rows (agent === null, id === null) previously keyed the other-names exclusion and the live isNameTaken predicate by their nullable persisted id, so a draft falsely collided with its OWN name (every name reported 'already exists') and saving/removing one of multiple drafts could reconcile all of them (a null agent captured identity matched every draft). Identify rows solely by each Row's stable numeric `key` (already the {#each} key) for: the other-names uniqueness hint, the controller's live isNameTaken predicate, replaceAgent (save reconciliation), and removeRow. A draft excludes itself exactly once; a persisted row keeps reconciling the same row on later edits and no longer self-collides. Add direct component-level regression tests (NamedAgentsView.test.ts) for the self-collision, distinct/same-name multi-draft cases, saving-one- updates-only-that-row, removing-one-removes-only-that-row, and post-persist re-save reconciliation. 5 of 6 tests fail against the previous code (verified). Verification: typecheck 0 errors, biome clean, 1252 tests pass, build ok.