Merge pull request 'feat(440): per-source weight steppers + exclude/add-untagged in the Auto-Tune DetailPanel' (#589) from feat/440-autotune-weights into main
Build ErsatzTV Image / Build & test (.NET) (push) Has started running
Build ErsatzTV Image / Build & push image (amd64) (push) Has been cancelled
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been cancelled
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been cancelled
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Has been cancelled
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Has been cancelled

This commit was merged in pull request #589.
This commit is contained in:
2026-07-25 10:06:02 +00:00
4 changed files with 587 additions and 84 deletions
+23
View File
@@ -457,6 +457,29 @@ string-keyed dispatcher, or generic screen-action framework participates in norm
bulk-create), closing the panel does **not** lose data (it's still in screen state) — so the
`window.confirm` guard belongs on *screen navigation / unload* while any uncommitted edit exists,
not on panel close. Show an "Edited" badge on customised rows so the pending edits are visible.
- **Per-source correction rows: weight stepper + include/exclude toggle, keyed by the server's source id**
(#440 wiring #425's backend into the Auto-Tune DetailPanel's Content-sources pane). The row model is
reusable wherever an item list carries per-item rotation weights:
- The row's draft (`SourceDraft` in `AutoTuneScreen.tsx`) holds `weight` as a **string** per §4a, plus a
boolean `excluded`; the bound `WEIGHT_MIN`/`WEIGHT_MAX` = 1..1000 mirrors the server's
`MultiCollectionItemWeight` validator — the same 1..1000 the multi-collection editor enforces (#404), but
via its **own screen-local pair**: same values, separate consts, not a shared module. It is clamped on
`onBlur` **and** again in the draft→request mapping.
- **Only genuinely customised rows go on the wire.** The draft→request mapper (`sourcesRequest`) drops any
row that is still fair-share (weight 1, not excluded, not added) and returns `undefined` when nothing is
left, so the field is **omitted** rather than sent as an all-default array. That predicate mirrors the
server's own `customized` check exactly — an all-default array is a documented no-op there, and omitting
it keeps the channel on the cheaper single-SmartCollection shape. The same predicate drives the row's
"Edited" badge and the §8 dirty guard, so a value touched and set back to the default is correctly *not*
an edit (same rule as a name cleared back to empty).
- **A library picker compiles typed text; it never forwards raw Lucene.** The "add a source not in the
base set" typeahead sends `title:*<escaped>*` (`titleContainsQuery`), not the user's literal text: the
search index's default field does **not** match bare title words (`Alpha` finds nothing for "Show Alpha"
— see `e2e-local.md`), so a raw forward like `SearchScreen`'s (where the box is explicitly a query box)
would look broken in a *name* picker. Escape every Lucene special + whitespace so the boundary stars are
the only live wildcards — the same shape `builder/rules/compile.ts` emits for `contains`.
- Rows are read-keyed by the **server's** id (`GET /api/v1/channels/auto-tune/members`), and an added id
that turns out to already be a base member patches the existing row instead of appending a duplicate.
- **Advanced channel-options overrides are shared, not duplicated** (`web/src/builder/advancedOptions.tsx`).
The `CreateChannelFromLineupAdvancedOptionsRequest` override model — the enum catalogs,
`ADVANCED_KEYS`, `effectiveValue`, and the field adapters (`useAdvancedOverrides`) — is one module