fix(69): auto-tune review fixes — null channels, orphaned SmartCollection, oversized preview names, doc drift

- CreateAutoTunedChannelsRequest.ToCommand(): guard null Channels (was NREing on
  a request body that omits "channels", causing HTTP 500).
- CreateAutoTunedChannelsHandler.CreateOne: when CreateChannelFromLineup returns
  Left (Skipped/Failed), roll back the just-created SmartCollection via
  DeleteSmartCollection so retries don't fail on SmartCollection-name uniqueness.
  Best-effort; the delete result does not change the outcome.
- PreviewAutoTuneChannelsHandler: filter out proposals whose generated name
  exceeds the 50-char Channel.Name limit before number allocation, so numbers
  aren't wasted on proposals that can never be created.
- docs/superpowers/specs/2026-07-16-auto-tuning-design.md: fix field-name drift
  in JSON examples (proposedNumber -> number, error -> reason) to match the
  actual AutoTuneProposal/AutoTuneChannelOutcome DTOs.

Refs #69
This commit is contained in:
2026-07-16 22:18:52 +02:00
parent 0320735f47
commit f31476e012
6 changed files with 57 additions and 10 deletions
@@ -87,9 +87,9 @@ Response — a list of proposed channels:
```
[
{ "axis": "TvShow", "value": "The Office", "name": "The Office",
"proposedNumber": 500, "itemCount": 201, "alreadyExists": false },
"number": 500, "itemCount": 201, "alreadyExists": false },
{ "axis": "MovieGenre", "value": "Action", "name": "Action Movies",
"proposedNumber": 501, "itemCount": 42, "alreadyExists": false },
"number": 501, "itemCount": 42, "alreadyExists": false },
...
]
```
@@ -117,7 +117,7 @@ Response — partial-success list, mirroring the existing `ResetAllPlayoutsResul
"results": [
{ "name": "The Office", "status": "Created", "channelId": 88 },
{ "name": "Action Movies", "status": "Skipped", "reason": "number 501 already taken" },
{ "name": "Sci-Fi", "status": "Failed", "error": "…" }
{ "name": "Sci-Fi", "status": "Failed", "reason": "…" }
],
"createdCount": 1, "skippedCount": 1, "failedCount": 1
}