Playlist/group rename should reject duplicate names (like create does) — #327 follow-up #458

Closed
opened 2026-07-18 18:28:39 +02:00 by timothy · 1 comment
Owner

Follow-up deferred from #327 (PR #454).

ReplacePlaylistItemsHandler (playlist rename) and RenamePlaylistGroupHandler (group rename) validate name non-empty and length ≤ 50, but neither checks name uniqueness within the group/parent — whereas CreatePlaylistHandler/CreatePlaylistGroupHandler reject a duplicate name on create. So a create is blocked from colliding but a rename can still produce two identically-named playlists/groups.

Low priority: inherited gap, pre-existed the #327 change (which only added the empty/length rules to match create). Fix = mirror create's duplicate-name check in the two rename handlers, mapping to the same 422/409 the create path uses.

Done-when

  • Rename handlers reject a name already used by a sibling playlist/group (matching create's rule + HTTP status)
  • Unit tests for the duplicate-rename reject on both handlers
  • adversarial review passed
Follow-up deferred from #327 (PR #454). `ReplacePlaylistItemsHandler` (playlist rename) and `RenamePlaylistGroupHandler` (group rename) validate name **non-empty** and **length ≤ 50**, but neither checks **name uniqueness** within the group/parent — whereas `CreatePlaylistHandler`/`CreatePlaylistGroupHandler` reject a duplicate name on create. So a create is blocked from colliding but a rename can still produce two identically-named playlists/groups. Low priority: inherited gap, pre-existed the #327 change (which only added the empty/length rules to match create). Fix = mirror create's duplicate-name check in the two rename handlers, mapping to the same 422/409 the create path uses. ## Done-when - [ ] Rename handlers reject a name already used by a sibling playlist/group (matching create's rule + HTTP status) - [ ] Unit tests for the duplicate-rename reject on both handlers - [ ] adversarial review passed
timothy added the priority: low label 2026-07-18 18:28:39 +02:00
Author
Owner

Closing record

Outcome: Merged as 7a7c6112 (PR #576, squash). Rename paths for playlists and playlist-groups now reject duplicate sibling names with a 422, matching the create paths.
Root cause: ReplacePlaylistItemsHandler (playlist rename) and RenamePlaylistGroupHandler (group rename) validated non-empty + length ≤ 50 but never checked uniqueness, so a rename could produce two identically-named siblings.
Decisions/conventions changed: none.
Reusable knowledge: Issue premise was slightly off — only CreatePlaylistHandler has an explicit dup check; CreatePlaylistGroupHandler relied solely on the DB unique index. The group rename fix also upgrades a would-be raw DbUpdateException into a clean 422. EF InMemory does not enforce unique indexes, so the tests exercise the explicit guard, not the DB constraint.
Verification: 72 Playlist-related tests green locally; format + BOM gate clean; independent cold review verdict MERGEABLE; full CI green on head sha d12da836 (runs 1039/1040).
Deferred: none.
Docs updated: none required (behavior fix mirroring an existing convention, no new decision).

## Closing record **Outcome:** Merged as `7a7c6112` (PR #576, squash). Rename paths for playlists and playlist-groups now reject duplicate sibling names with a 422, matching the create paths. **Root cause:** `ReplacePlaylistItemsHandler` (playlist rename) and `RenamePlaylistGroupHandler` (group rename) validated non-empty + length ≤ 50 but never checked uniqueness, so a rename could produce two identically-named siblings. **Decisions/conventions changed:** none. **Reusable knowledge:** Issue premise was slightly off — only `CreatePlaylistHandler` has an explicit dup check; `CreatePlaylistGroupHandler` relied solely on the DB unique index. The group rename fix also upgrades a would-be raw `DbUpdateException` into a clean 422. EF InMemory does not enforce unique indexes, so the tests exercise the explicit guard, not the DB constraint. **Verification:** 72 Playlist-related tests green locally; format + BOM gate clean; independent cold review verdict MERGEABLE; full CI green on head sha d12da836 (runs 1039/1040). **Deferred:** none. **Docs updated:** none required (behavior fix mirroring an existing convention, no new decision).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#458