ReplacePlaylistItemsHandler (playlist rename) and RenamePlaylistGroupHandler (group rename) validated name non-empty + length ≤ 50 but never checked uniqueness, whereas the create paths reject a duplicate. So a rename could produce two identically-named sibling playlists/groups.
Fix
Mirror the existing rename-with-dedup sibling pattern (ReplaceBlockItemsHandler.BlockNameMustBeValid, ReplaceTemplateItemsHandler.ValidateTemplateName): a final async .BindT uniqueness step that
Playlist — scopes by the loadedplaylist.PlaylistGroupId (rename can't move groups; the command carries no group field), matching (PlaylistGroupId, Name)'s unique index and CreatePlaylistHandler's scoping.
Group — global scope, matching PlaylistGroup.Name's unique index.
Self-excludes by Id, so a no-op rename to its own name still succeeds.
Returns BaseError → 422, the same status create uses (both PUT endpoints already declare 422).
For groups this also upgrades a would-be raw DbUpdateException (create-group has no explicit guard — it leans on the DB index) into a clean 422.
Note on the issue premise
The issue said both create handlers reject duplicates; in fact only CreatePlaylistHandler has an explicit check — CreatePlaylistGroupHandler relies solely on the DB unique index. The fix is unchanged (add an explicit guard to both renames) and additionally makes the group path's error clean.
Tests
Extended the two existing handler fixtures (EF InMemory does not enforce unique indexes, so these exercise the explicit check, not the DB constraint):
duplicate-in-same-group rejected + not mutated (playlist)
duplicate group name rejected; duplicate onto a system group's name rejected
same-name (no-op) rename succeeds (both)
duplicate in a different group allowed (playlist — scoping guard)
72 Playlist-related tests green locally; format + BOM gate clean.
Closes #458.
## Problem
`ReplacePlaylistItemsHandler` (playlist rename) and `RenamePlaylistGroupHandler` (group rename) validated name **non-empty** + **length ≤ 50** but never checked **uniqueness**, whereas the create paths reject a duplicate. So a rename could produce two identically-named sibling playlists/groups.
## Fix
Mirror the existing rename-with-dedup sibling pattern (`ReplaceBlockItemsHandler.BlockNameMustBeValid`, `ReplaceTemplateItemsHandler.ValidateTemplateName`): a final async `.BindT` uniqueness step that
- **Playlist** — scopes by the *loaded* `playlist.PlaylistGroupId` (rename can't move groups; the command carries no group field), matching `(PlaylistGroupId, Name)`'s unique index and `CreatePlaylistHandler`'s scoping.
- **Group** — global scope, matching `PlaylistGroup.Name`'s unique index.
- Self-excludes by `Id`, so a no-op rename to its own name still succeeds.
- Returns `BaseError` → **422**, the same status create uses (both PUT endpoints already declare 422).
For groups this also upgrades a would-be raw `DbUpdateException` (create-group has no explicit guard — it leans on the DB index) into a clean 422.
## Note on the issue premise
The issue said *both* create handlers reject duplicates; in fact only `CreatePlaylistHandler` has an explicit check — `CreatePlaylistGroupHandler` relies solely on the DB unique index. The fix is unchanged (add an explicit guard to both renames) and additionally makes the group path's error clean.
## Tests
Extended the two existing handler fixtures (EF InMemory does **not** enforce unique indexes, so these exercise the explicit check, not the DB constraint):
- duplicate-in-same-group rejected + not mutated (playlist)
- duplicate group name rejected; duplicate onto a **system** group's name rejected
- same-name (no-op) rename succeeds (both)
- duplicate in a **different** group allowed (playlist — scoping guard)
72 Playlist-related tests green locally; format + BOM gate clean.
## Review
Independent cold review: **MERGEABLE** — correct scoping/self-exclusion/pipeline placement, non-vacuous tests, no blockers/highs/mediums.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
ReplacePlaylistItemsHandler (playlist rename) and RenamePlaylistGroupHandler
(group rename) validated name non-empty/length but not uniqueness, so a rename
could produce two identically-named siblings even though the create paths reject
duplicates. Mirror the existing ReplaceBlockItems/ReplaceTemplate sibling
pattern: an async BindT step scoped to the group (playlist) or global (group,
matching PlaylistGroup.Name's unique index), self-excluded so a no-op rename to
its own name still succeeds, returning BaseError -> 422 like create.
For groups this also upgrades a would-be raw DbUpdateException (create-group has
no explicit guard, only the DB index) into a clean 422.
Closes#458.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Independent cold review (fresh agent, no implementation role) over the full diff: correct group-vs-global scoping, self-exclusion (no-op rename to own name succeeds), correct .BindT pipeline placement (422 after the 404 existence / 422 system-group checks), non-vacuous tests. No blockers/highs/mediums.
The only change after that review was one additive regression test the reviewer itself suggested (Rename_Should_Reject_Name_Taken_By_System_Group) — production code is byte-identical to what was reviewed, so the verdict carries to the current head.
`Review-verdict: MERGEABLE @ d12da836`
Independent cold review (fresh agent, no implementation role) over the full diff: correct group-vs-global scoping, self-exclusion (no-op rename to own name succeeds), correct `.BindT` pipeline placement (422 after the 404 existence / 422 system-group checks), non-vacuous tests. No blockers/highs/mediums.
The only change after that review was one **additive** regression test the reviewer itself suggested (`Rename_Should_Reject_Name_Taken_By_System_Group`) — production code is byte-identical to what was reviewed, so the verdict carries to the current head.
timothy
merged commit 7a7c611267 into main2026-07-23 20:07:43 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #458.
Problem
ReplacePlaylistItemsHandler(playlist rename) andRenamePlaylistGroupHandler(group rename) validated name non-empty + length ≤ 50 but never checked uniqueness, whereas the create paths reject a duplicate. So a rename could produce two identically-named sibling playlists/groups.Fix
Mirror the existing rename-with-dedup sibling pattern (
ReplaceBlockItemsHandler.BlockNameMustBeValid,ReplaceTemplateItemsHandler.ValidateTemplateName): a final async.BindTuniqueness step thatplaylist.PlaylistGroupId(rename can't move groups; the command carries no group field), matching(PlaylistGroupId, Name)'s unique index andCreatePlaylistHandler's scoping.PlaylistGroup.Name's unique index.Id, so a no-op rename to its own name still succeeds.BaseError→ 422, the same status create uses (both PUT endpoints already declare 422).For groups this also upgrades a would-be raw
DbUpdateException(create-group has no explicit guard — it leans on the DB index) into a clean 422.Note on the issue premise
The issue said both create handlers reject duplicates; in fact only
CreatePlaylistHandlerhas an explicit check —CreatePlaylistGroupHandlerrelies solely on the DB unique index. The fix is unchanged (add an explicit guard to both renames) and additionally makes the group path's error clean.Tests
Extended the two existing handler fixtures (EF InMemory does not enforce unique indexes, so these exercise the explicit check, not the DB constraint):
72 Playlist-related tests green locally; format + BOM gate clean.
Review
Independent cold review: MERGEABLE — correct scoping/self-exclusion/pipeline placement, non-vacuous tests, no blockers/highs/mediums.
🤖 Generated with Claude Code
Review-verdict: MERGEABLE @ d12da836Independent cold review (fresh agent, no implementation role) over the full diff: correct group-vs-global scoping, self-exclusion (no-op rename to own name succeeds), correct
.BindTpipeline placement (422 after the 404 existence / 422 system-group checks), non-vacuous tests. No blockers/highs/mediums.The only change after that review was one additive regression test the reviewer itself suggested (
Rename_Should_Reject_Name_Taken_By_System_Group) — production code is byte-identical to what was reviewed, so the verdict carries to the current head.