SPA: per-source weight inputs + fair-share toggle in the schedule editor (#70 UI) #404

Closed
opened 2026-07-17 12:59:29 +02:00 by timothy · 2 comments
Owner

The UI half of #70, split out of PR #402 (backend + API only).

Context

#70 shipped PlaybackOrder.WeightedShuffle and a per-source int Weight (default 1) on MultiCollectionItem / MultiCollectionSmartItem, exposed on the multi-collection API (weight, optional, on both request and response). There is no UI for it yet — weights are only settable via the API.

Scope

Per the UI redesign spec (docs/superpowers/specs/2026-07-01-chicorytv-ui-redesign-design.md:101): "per-show weight inputs (sliders or percentages) when a schedule item mixes multiple shows ('Show A 70% / Show B 30%'), plus a fair-share toggle."

  • Weight input per source in the multi-collection editor (/app/multi-collections).
  • WeightedShuffle selectable as a Playback Order on classic schedule items (/app/schedules) — and only there: it is rejected at the write path for playlist and block items, so the SPA must not offer it on those surfaces.
  • "Fair-share" is not a separate mode — it is WeightedShuffle with all weights left at 1. A toggle, if built, should just reset weights to 1 rather than write a different order (decisions.md 2026-07-17).
  • Percentages are a display concern; the wire format is integer relative shares. 3:1 displays as 75%/25%.
  • Weight has a validation floor/ceiling at the API — mirror it in the input rather than letting a 400 surface raw.

Gotcha worth knowing

The multi-collection update replaces the item list, so the editor must round-trip weight from the GET or it will silently reset every weight to 1 on save. The API returns it for exactly this reason.

Blocked-by

#388 (design-system sync) — same gating as #77's convenience toggle.

Done-when

  • Weight input per source, honoring the API's validation bounds
  • WeightedShuffle offered on classic schedule items only
  • Round-trips weight on save (no silent reset)
  • Live-E2E: set weights, build a playout, confirm the rundown matches the ratio
  • spa-conventions.md / domain-model.md updated
  • Adversarial review passed
The UI half of #70, split out of PR #402 (backend + API only). ## Context #70 shipped `PlaybackOrder.WeightedShuffle` and a per-source `int Weight` (default 1) on `MultiCollectionItem` / `MultiCollectionSmartItem`, exposed on the multi-collection API (`weight`, optional, on both request and response). **There is no UI for it yet** — weights are only settable via the API. ## Scope Per the UI redesign spec (`docs/superpowers/specs/2026-07-01-chicorytv-ui-redesign-design.md:101`): *"per-show weight inputs (sliders or percentages) when a schedule item mixes multiple shows ('Show A 70% / Show B 30%'), plus a fair-share toggle."* - Weight input per source in the multi-collection editor (`/app/multi-collections`). - `WeightedShuffle` selectable as a Playback Order on classic schedule items (`/app/schedules`) — **and only there**: it is rejected at the write path for playlist and block items, so the SPA must not offer it on those surfaces. - **"Fair-share" is not a separate mode** — it is `WeightedShuffle` with all weights left at 1. A toggle, if built, should just reset weights to 1 rather than write a different order (`decisions.md` 2026-07-17). - Percentages are a **display** concern; the wire format is integer relative shares. `3:1` displays as 75%/25%. - Weight has a validation floor/ceiling at the API — mirror it in the input rather than letting a 400 surface raw. ## Gotcha worth knowing The multi-collection update **replaces** the item list, so the editor must round-trip `weight` from the GET or it will silently reset every weight to 1 on save. The API returns it for exactly this reason. ## Blocked-by #388 (design-system sync) — same gating as #77's convenience toggle. ## Done-when - [x] Weight input per source, honoring the API's validation bounds - [x] `WeightedShuffle` offered on classic schedule items only - [x] Round-trips `weight` on save (no silent reset) - [x] Live-E2E: set weights, build a playout, confirm the rundown matches the ratio - [x] `spa-conventions.md` / `domain-model.md` updated - [x] Adversarial review passed
timothy added the enhancementpriority: medium labels 2026-07-17 12:59:30 +02:00
timothy added the in-progress label 2026-07-19 11:14:49 +02:00
Author
Owner

Claiming (Claude Code orchestrator session). Selected as the next eligible priority: medium backlog issue after #350 (its remaining optimization is blocked on prod cold-start measurement data — no channel tuned since the v26.10.0 auto-update, so no HLS cold-start log lines exist yet). #404 is fully actionable: #388 (design-system sync) is closed, deps clear.

Plan: SPA for the #70 weighted-distribution feature — per-source weight input in the multi-collection editor (round-tripping weight from the GET to avoid the silent-reset gotcha), and WeightedShuffle as a Playback Order on classic schedule items only (rejected on playlist/block write paths). Docs-first per project rules, then worktree off origin/main, live-E2E the ratio, adversarial review before merge.

Claiming (Claude Code orchestrator session). Selected as the next eligible `priority: medium` backlog issue after #350 (its remaining optimization is blocked on prod cold-start measurement data — no channel tuned since the v26.10.0 auto-update, so no `HLS cold-start` log lines exist yet). #404 is fully actionable: #388 (design-system sync) is closed, deps clear. Plan: SPA for the #70 weighted-distribution feature — per-source weight input in the multi-collection editor (round-tripping `weight` from the GET to avoid the silent-reset gotcha), and `WeightedShuffle` as a Playback Order on **classic schedule items only** (rejected on playlist/block write paths). Docs-first per project rules, then worktree off origin/main, live-E2E the ratio, adversarial review before merge.
timothy removed the in-progress label 2026-07-19 12:02:11 +02:00
Author
Owner

Closed — merged in PR #462

What was done: the SPA half of #70 weighted distribution — per-source weight input in the multi-collection editor (1..1000, native stepper, clamp-on-blur, % share, "Reset to fair share"), weight round-tripped through the draft so the replace-all PUT never silently resets it, and WeightedShuffle offered on classic MultiCollection schedule items only (excluded from fillWithGroup like ShuffleInOrder). Input gained min/max/inputMode/onBlur/ariaLabel passthroughs (reusable by #425).

Files: MultiCollectionsScreen.tsx, schedules/itemRules.ts, components/forms.tsx, shell.css (+tests); docs: domain-model.md, spa-conventions.md, decisions.md. No API/DB change.

Verification: 861 web tests + lint + typecheck + prod build green; cold review MERGEABLE; live-E2E (weighted create+read round-trips; rename-only PUT preserves weights; WeightedShuffle persists on a classic MultiCollection schedule item; block/playlist editors omit it). 3:1 ratio pinned by existing PlayoutBuildGoldenTests.Classic_weighted.

Root-cause note: live-E2E showed the classic write path ACCEPTS WeightedShuffle on a plain Collection (degrades to fair-share) — so MultiCollection-only is a meaningfulness choice, not a write-path mirror; the rejection is on playlist/block paths. Corrected in itemRules.ts + decisions.md.

Deferred: DesignSync push-back of the weight UI to the MultiCollections.jsx prototype (main-session-only, needs claude.ai approval). No follow-up issues.

## Closed — merged in PR #462 **What was done:** the SPA half of #70 weighted distribution — per-source weight input in the multi-collection editor (1..1000, native stepper, clamp-on-blur, % share, "Reset to fair share"), `weight` round-tripped through the draft so the replace-all PUT never silently resets it, and `WeightedShuffle` offered on classic **MultiCollection** schedule items only (excluded from fillWithGroup like ShuffleInOrder). `Input` gained min/max/inputMode/onBlur/ariaLabel passthroughs (reusable by #425). **Files:** MultiCollectionsScreen.tsx, schedules/itemRules.ts, components/forms.tsx, shell.css (+tests); docs: domain-model.md, spa-conventions.md, decisions.md. No API/DB change. **Verification:** 861 web tests + lint + typecheck + prod build green; cold review MERGEABLE; live-E2E (weighted create+read round-trips; rename-only PUT preserves weights; WeightedShuffle persists on a classic MultiCollection schedule item; block/playlist editors omit it). 3:1 ratio pinned by existing `PlayoutBuildGoldenTests.Classic_weighted`. **Root-cause note:** live-E2E showed the classic write path ACCEPTS WeightedShuffle on a plain Collection (degrades to fair-share) — so MultiCollection-only is a meaningfulness choice, not a write-path mirror; the rejection is on playlist/block paths. Corrected in itemRules.ts + decisions.md. **Deferred:** DesignSync push-back of the weight UI to the MultiCollections.jsx prototype (main-session-only, needs claude.ai approval). No follow-up issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: timothy/ersatztv#404