Wires the Auto-Tune DetailPanel's Content-sources pane to the sources: [{sourceId, weight, excluded}] payload that #425 shipped on POST /api/v1/channels/auto-tune. #386 built the panel but deferred these controls to #425's slice; #425 was scoped backend-only, so the controls were never built.
What changed
WEIGHT_MIN/WEIGHT_MAX = 1..1000 + clampWeight, mirroring the server's MultiCollectionItemWeight validator — the same const pair MultiCollectionsScreen uses (#404).
SourceDraft { weight: string; excluded; addedTitle?; addedArtwork? } on ChannelOverride.sources, keyed by source id. Weight is held as a string per spa-conventions §4a so the field edits smoothly, clamped on blur and again at save.
sourcesRequest() draft→request mapper emits only genuinely customised rows and returns undefined when none — mirroring the server's own customized predicate, so an untouched channel sends no sources key at all. It also feeds overrideEdited, so the "Edited" badge and the §8 dirty guard cover source edits, and a weight set back to 1 correctly stops counting as an edit.
New ContentSourcesSection (members loading lifted out of DetailPanel): per-row weight stepper + include/exclude toggle, an "Added" tag and Remove for out-of-axis sources, an "N customised" tag, and a debounced axis-aware library typeahead (shows vs movies) to add a source. The read-only #425 hint is gone, replaced by copy stating the weight semantics.
The typeahead compiles typed text to title:*<escaped>* rather than forwarding raw Lucene — per docs/e2e-local.md the index's default field does not match bare title words, so a raw forward would silently find nothing.
Verification
npm test 988/988 · npm run lint clean · npm run build ok
npm run check:api not run — no OpenAPI-relevant file touched; v1.d.ts untouched (AutoTuneSourceWeightRequest already existed in the generated types, nothing hand-written).
Live-E2E passed on a fresh config dir with a seeded 2-show library, driven headless through the real SPA: added "Show Beta" via the new typeahead, set its weight to 3, "Edited" badge appeared, Create.
Captured POST body: {"templateId":1,"group":"Auto-Tuned","channels":[{"axis":"TvShow","value":"Show Alpha","name":"Show Alpha","number":"500","sources":[{"sourceId":9,"weight":3,"excluded":false}]}]}
Server built a system-owned MultiCollection: show_title:"Show Alpha" weight 1, show_title:"Show Beta" weight 3, plus the empty remainder at 1.
Built playout, 106,576 items: Show Alpha 26,644 / Show Beta 79,932 = exactly 3.000:1.
Scope limit: this is the happy path only. It does not cover exclusions, multiple customised sources, add-untagged combined with exclude, or out-of-range input — those are covered by unit tests and are a focus of the adversarial review.
Docs (same PR)
docs/spa-conventions.md §11 gains a bullet recording the per-source correction-row convention (string-held bounded weight, only-customised-rows-on-the-wire and its "Edited"/guard tie-in, compiled-not-raw library picker, server-id keying). No decisions.md record: this is the SPA wiring of the already-recorded sched.autotune-per-source-weights, not a new or reversed decision.
fixes #440
Wires the Auto-Tune DetailPanel's Content-sources pane to the `sources: [{sourceId, weight, excluded}]` payload that #425 shipped on `POST /api/v1/channels/auto-tune`. #386 built the panel but deferred these controls to #425's slice; #425 was scoped backend-only, so the controls were never built.
## What changed
- **`WEIGHT_MIN`/`WEIGHT_MAX` = 1..1000 + `clampWeight`**, mirroring the server's `MultiCollectionItemWeight` validator — the same const pair `MultiCollectionsScreen` uses (#404).
- **`SourceDraft { weight: string; excluded; addedTitle?; addedArtwork? }`** on `ChannelOverride.sources`, keyed by source id. Weight is held as a **string** per spa-conventions §4a so the field edits smoothly, clamped on blur **and** again at save.
- **`sourcesRequest()`** draft→request mapper emits only genuinely customised rows and returns `undefined` when none — mirroring the server's own `customized` predicate, so an untouched channel sends no `sources` key at all. It also feeds `overrideEdited`, so the "Edited" badge and the §8 dirty guard cover source edits, and a weight set back to 1 correctly stops counting as an edit.
- **New `ContentSourcesSection`** (members loading lifted out of `DetailPanel`): per-row weight stepper + include/exclude toggle, an "Added" tag and Remove for out-of-axis sources, an "N customised" tag, and a debounced axis-aware library typeahead (shows vs movies) to add a source. The read-only `#425` hint is gone, replaced by copy stating the weight semantics.
- The typeahead compiles typed text to `title:*<escaped>*` rather than forwarding raw Lucene — per `docs/e2e-local.md` the index's default field does not match bare title words, so a raw forward would silently find nothing.
## Verification
- `npm test` 988/988 · `npm run lint` clean · `npm run build` ok
- `npm run check:api` not run — no OpenAPI-relevant file touched; `v1.d.ts` untouched (`AutoTuneSourceWeightRequest` already existed in the generated types, nothing hand-written).
- **Live-E2E passed** on a fresh config dir with a seeded 2-show library, driven headless through the real SPA: added "Show Beta" via the new typeahead, set its weight to 3, "Edited" badge appeared, Create.
- Captured POST body: `{"templateId":1,"group":"Auto-Tuned","channels":[{"axis":"TvShow","value":"Show Alpha","name":"Show Alpha","number":"500","sources":[{"sourceId":9,"weight":3,"excluded":false}]}]}`
- Server built a system-owned MultiCollection: `show_title:"Show Alpha"` weight 1, `show_title:"Show Beta"` weight 3, plus the empty remainder at 1.
- Built playout, 106,576 items: **Show Alpha 26,644 / Show Beta 79,932 = exactly 3.000:1**.
- Scope limit: this is the happy path only. It does not cover exclusions, multiple customised sources, add-untagged combined with exclude, or out-of-range input — those are covered by unit tests and are a focus of the adversarial review.
## Docs (same PR)
`docs/spa-conventions.md` §11 gains a bullet recording the per-source correction-row convention (string-held bounded weight, only-customised-rows-on-the-wire and its "Edited"/guard tie-in, compiled-not-raw library picker, server-id keying). No `decisions.md` record: this is the SPA wiring of the already-recorded `sched.autotune-per-source-weights`, not a new or reversed decision.
Wires the Auto-Tune DetailPanel's Content-sources pane to #425's backend: each
member row gains a 1..1000 weight stepper and an include/exclude toggle, and a
library typeahead adds a source that isn't in the axis's base set. Edits
accumulate in the screen's per-channel draft (the existing §8/§11 guard covers
them) and are flushed as the create request's `sources` array.
- Only genuinely customised rows are sent, mirroring the server's own
`customized` predicate — an all-default array is a backend no-op, so the field
is omitted entirely and the channel keeps the cheaper fair-share shape.
- Weights are clamped to 1..1000 on blur and again at save, so an out-of-range
value never reaches the server as a raw 400 (spa-conventions §4a).
- The add-untagged picker compiles typed text to `title:*…*` rather than
forwarding raw Lucene: the index's default field does not match bare title
words, so a raw forward would silently find nothing.
- Removes the read-only #425 hint.
Docs: spa-conventions.md §11 records the per-source correction-row convention.
fixes#440
Text-only follow-up; no behavior change (14/14 tests, lint clean, tsc clean).
- AutoTuneScreen.tsx: the addSource comment claimed picking a hit that is
already a base member makes "the existing row read as customised". It does
not — patchSource(id, {}) materializes a DEFAULT draft, sourceCustomized is
false for it, and sourcesRequest omits it, so the pick is a payload no-op
whose only visible effect is the query clearing. Comment now states that.
- spa-conventions.md §11: said WEIGHT_MIN/WEIGHT_MAX are "the same const pair
the multi-collection editor uses". Same VALUES, separate screen-local consts
— there is no shared module. The old wording invited a future reader to
assume a shared seam that does not exist.
Both were nits in the independent review of d3c89d87 (verdict
MERGEABLE-WITH-NITS). Fixed rather than deferred because a comment that states
the opposite of the code, and a doc that implies a nonexistent shared const,
are exactly the kind of thing the next session reads and trusts.
Remaining review nits deferred to a follow-up issue: exporting compile.ts's
Lucene escaper instead of duplicating it, an exclude-all warning, and >50-source
axis handling.
Independent adversarial review — cold review-only brief, different model family from the implementer, read-only. Reviewed d3c89d87, then re-verified the fix delta at 22e89fb9.
Highest-consequence path verified against the server, not against the author's comment: sourcesRequest() (AutoTuneScreen.tsx) vs CreateAutoTunedChannelsHandler.cs:203 (sources.Any(s => s.Weight != 1 || s.Excluded || !baseIds.Contains(s.SourceId))). Checked in both directions:
Client drops → server would customise? Impossible. A dropped row is clamped weight 1, not excluded, not added, and every UI-touchable non-added row comes from the members endpoint the server re-enumerates, so its id is always in the server's base set. No user edit can be silently dropped.
Client sends → server no-ops? Only for a >50-source axis where the typeahead picks a base member beyond the preview page — cosmetic "Added" label plus one redundant wire row, semantically correct outcome, never a MultiCollection flip. Deferred to #590.
The client is a strict refinement of the server predicate: it clamps before testing, while the server checks raw Weight != 1 before NormalizeWeight, so a typed 0/-3 can never reach the wire and needlessly flip the channel into MultiCollection shape.
Other confirmed results: weight clamping is total ("", "abc", "-3", "0", "1e3", "1.5", " 7 ", "999999", "Infinity" all land in 1..1000) at both the blur site and the authoritative save site, with a test exercising the never-blurred path; the typeahead escaper is byte-identical to compile.ts's established seam (a duplicate, not a weaker implementation — the &&/|| gap is pre-existing there too, and no clause injection could be constructed); temporal guards use a seq ref plus a same-query render gate, i.e. "still current" not merely "still mounted"; the dirty guard reads a ref at screen level per §8/§11 and covers source edits, with weight-back-to-1 correctly clearing the Edited badge; no multi-channel bleed (drafts keyed by proposal, panel remounts); the 5 new tests assert actual wire payloads and would fail on a mapper regression.
Fix delta d3c89d87..22e89fb9 confirmed genuinely text-only — two hunks, comment block and prose, code line untouched context, nothing undescribed — and both new statements verified accurate against the code (MultiCollectionsScreen.tsx:75-76 does declare its own separate pair).
Deferred, non-blocking, tracked as #590: shared Lucene escaper, exclude-all empty-channel warning, >50-source axis handling.
Independent adversarial review — cold review-only brief, different model family from the implementer, read-only. Reviewed `d3c89d87`, then re-verified the fix delta at `22e89fb9`.
Highest-consequence path verified against the server, not against the author's comment: `sourcesRequest()` (AutoTuneScreen.tsx) vs `CreateAutoTunedChannelsHandler.cs:203` (`sources.Any(s => s.Weight != 1 || s.Excluded || !baseIds.Contains(s.SourceId))`). Checked in both directions:
- Client drops → server would customise? Impossible. A dropped row is clamped weight 1, not excluded, not added, and every UI-touchable non-added row comes from the members endpoint the server re-enumerates, so its id is always in the server's base set. No user edit can be silently dropped.
- Client sends → server no-ops? Only for a >50-source axis where the typeahead picks a base member beyond the preview page — cosmetic "Added" label plus one redundant wire row, semantically correct outcome, never a MultiCollection flip. Deferred to #590.
The client is a strict refinement of the server predicate: it clamps *before* testing, while the server checks raw `Weight != 1` before `NormalizeWeight`, so a typed `0`/`-3` can never reach the wire and needlessly flip the channel into MultiCollection shape.
Other confirmed results: weight clamping is total (`""`, `"abc"`, `"-3"`, `"0"`, `"1e3"`, `"1.5"`, `" 7 "`, `"999999"`, `"Infinity"` all land in 1..1000) at both the blur site and the authoritative save site, with a test exercising the never-blurred path; the typeahead escaper is byte-identical to `compile.ts`'s established seam (a duplicate, not a weaker implementation — the `&&`/`||` gap is pre-existing there too, and no clause injection could be constructed); temporal guards use a seq ref plus a same-query render gate, i.e. "still current" not merely "still mounted"; the dirty guard reads a ref at screen level per §8/§11 and covers source edits, with weight-back-to-1 correctly clearing the Edited badge; no multi-channel bleed (drafts keyed by proposal, panel remounts); the 5 new tests assert actual wire payloads and would fail on a mapper regression.
Fix delta `d3c89d87..22e89fb9` confirmed genuinely text-only — two hunks, comment block and prose, code line untouched context, nothing undescribed — and both new statements verified accurate against the code (`MultiCollectionsScreen.tsx:75-76` does declare its own separate pair).
Deferred, non-blocking, tracked as #590: shared Lucene escaper, exclude-all empty-channel warning, >50-source axis handling.
Review-verdict: MERGEABLE @ 22e89fb9a42467d37df802ddecc5be1c4053832e
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.
fixes #440
Wires the Auto-Tune DetailPanel's Content-sources pane to the
sources: [{sourceId, weight, excluded}]payload that #425 shipped onPOST /api/v1/channels/auto-tune. #386 built the panel but deferred these controls to #425's slice; #425 was scoped backend-only, so the controls were never built.What changed
WEIGHT_MIN/WEIGHT_MAX= 1..1000 +clampWeight, mirroring the server'sMultiCollectionItemWeightvalidator — the same const pairMultiCollectionsScreenuses (#404).SourceDraft { weight: string; excluded; addedTitle?; addedArtwork? }onChannelOverride.sources, keyed by source id. Weight is held as a string per spa-conventions §4a so the field edits smoothly, clamped on blur and again at save.sourcesRequest()draft→request mapper emits only genuinely customised rows and returnsundefinedwhen none — mirroring the server's owncustomizedpredicate, so an untouched channel sends nosourceskey at all. It also feedsoverrideEdited, so the "Edited" badge and the §8 dirty guard cover source edits, and a weight set back to 1 correctly stops counting as an edit.ContentSourcesSection(members loading lifted out ofDetailPanel): per-row weight stepper + include/exclude toggle, an "Added" tag and Remove for out-of-axis sources, an "N customised" tag, and a debounced axis-aware library typeahead (shows vs movies) to add a source. The read-only#425hint is gone, replaced by copy stating the weight semantics.title:*<escaped>*rather than forwarding raw Lucene — perdocs/e2e-local.mdthe index's default field does not match bare title words, so a raw forward would silently find nothing.Verification
npm test988/988 ·npm run lintclean ·npm run buildoknpm run check:apinot run — no OpenAPI-relevant file touched;v1.d.tsuntouched (AutoTuneSourceWeightRequestalready existed in the generated types, nothing hand-written).{"templateId":1,"group":"Auto-Tuned","channels":[{"axis":"TvShow","value":"Show Alpha","name":"Show Alpha","number":"500","sources":[{"sourceId":9,"weight":3,"excluded":false}]}]}show_title:"Show Alpha"weight 1,show_title:"Show Beta"weight 3, plus the empty remainder at 1.Docs (same PR)
docs/spa-conventions.md§11 gains a bullet recording the per-source correction-row convention (string-held bounded weight, only-customised-rows-on-the-wire and its "Edited"/guard tie-in, compiled-not-raw library picker, server-id keying). Nodecisions.mdrecord: this is the SPA wiring of the already-recordedsched.autotune-per-source-weights, not a new or reversed decision.Text-only follow-up; no behavior change (14/14 tests, lint clean, tsc clean). - AutoTuneScreen.tsx: the addSource comment claimed picking a hit that is already a base member makes "the existing row read as customised". It does not — patchSource(id, {}) materializes a DEFAULT draft, sourceCustomized is false for it, and sourcesRequest omits it, so the pick is a payload no-op whose only visible effect is the query clearing. Comment now states that. - spa-conventions.md §11: said WEIGHT_MIN/WEIGHT_MAX are "the same const pair the multi-collection editor uses". Same VALUES, separate screen-local consts — there is no shared module. The old wording invited a future reader to assume a shared seam that does not exist. Both were nits in the independent review ofd3c89d87(verdict MERGEABLE-WITH-NITS). Fixed rather than deferred because a comment that states the opposite of the code, and a doc that implies a nonexistent shared const, are exactly the kind of thing the next session reads and trusts. Remaining review nits deferred to a follow-up issue: exporting compile.ts's Lucene escaper instead of duplicating it, an exclude-all warning, and >50-source axis handling.Independent adversarial review — cold review-only brief, different model family from the implementer, read-only. Reviewed
d3c89d87, then re-verified the fix delta at22e89fb9.Highest-consequence path verified against the server, not against the author's comment:
sourcesRequest()(AutoTuneScreen.tsx) vsCreateAutoTunedChannelsHandler.cs:203(sources.Any(s => s.Weight != 1 || s.Excluded || !baseIds.Contains(s.SourceId))). Checked in both directions:The client is a strict refinement of the server predicate: it clamps before testing, while the server checks raw
Weight != 1beforeNormalizeWeight, so a typed0/-3can never reach the wire and needlessly flip the channel into MultiCollection shape.Other confirmed results: weight clamping is total (
"","abc","-3","0","1e3","1.5"," 7 ","999999","Infinity"all land in 1..1000) at both the blur site and the authoritative save site, with a test exercising the never-blurred path; the typeahead escaper is byte-identical tocompile.ts's established seam (a duplicate, not a weaker implementation — the&&/||gap is pre-existing there too, and no clause injection could be constructed); temporal guards use a seq ref plus a same-query render gate, i.e. "still current" not merely "still mounted"; the dirty guard reads a ref at screen level per §8/§11 and covers source edits, with weight-back-to-1 correctly clearing the Edited badge; no multi-channel bleed (drafts keyed by proposal, panel remounts); the 5 new tests assert actual wire payloads and would fail on a mapper regression.Fix delta
d3c89d87..22e89fb9confirmed genuinely text-only — two hunks, comment block and prose, code line untouched context, nothing undescribed — and both new statements verified accurate against the code (MultiCollectionsScreen.tsx:75-76does declare its own separate pair).Deferred, non-blocking, tracked as #590: shared Lucene escaper, exclude-all empty-channel warning, >50-source axis handling.
Review-verdict: MERGEABLE @
22e89fb9a4