Fix M23/M27: cap per-source on re-index; per-batch kind for library enqueue

M23: replaceMediaItems wrote [...newItems, ...others] and the JSON store sliced
     the combined list to MAX_ITEMS, so re-indexing one large source could
     silently evict ANOTHER source's tail. Now other sources are always kept in
     full and only the source being (re)indexed is capped to the remaining
     budget (MAX_ITEMS - others.length).

M27: enqueueItems forced settings.defaultKind for every item, so a channel
     couldn't be queued as audio without flipping the global default. Added an
     optional `kind` override (falls back to the default) and a video/audio
     SegmentedControl in the Library action row, seeded from defaultKind so
     existing behavior is unchanged until toggled.

typecheck + 242 tests + eslint green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 15:51:33 -04:00
parent 8cbfc90f5d
commit 6ee4dbe78e
4 changed files with 36 additions and 18 deletions
+2 -2
View File
@@ -289,7 +289,7 @@ token system + shared primitives (UI/SIMP — high value, larger effort) · i18n
plain JSON file; the UI caption only says "Does not include download history" — no warning that
the file contains credentials. *Fixed: `proxy`/`youtubePoToken`/`updateToken` are stripped (set to
`''`) before writing; SettingsView caption updated to say credentials are not included.*
- [ ] **M23 — `MAX_ITEMS` truncation can silently drop a source's items.** [sources.ts](src/main/sources.ts)
- [x] **M23 — `MAX_ITEMS` truncation can silently drop a source's items.** [sources.ts](src/main/sources.ts)
`replaceMediaItems` does `[...new, ...others].slice(0, 20000)`; once the global total exceeds the
cap, the *tail* (another source's items) is dropped on write and only reappears when that source
is re-indexed. Cap per-source, or surface it.
@@ -309,7 +309,7 @@ token system + shared primitives (UI/SIMP — high value, larger effort) · i18n
Toffee; the shipped [theme.ts](src/renderer/src/theme.ts) is rose / coral / amber / teal
("Sunset-to-sea") with a default of **teal**. The whole section documents a palette that no
longer exists.
- [ ] **M27 — Library batch-enqueue ignores per-item kind.** [sources.ts](src/renderer/src/store/sources.ts)
- [x] **M27 — Library batch-enqueue ignores per-item kind.** [sources.ts](src/renderer/src/store/sources.ts)
`enqueueItems` forces `settings.defaultKind` (+ its quality) for *every* item, so a channel can't
be downloaded as audio without flipping the global default — inconsistent with the DownloadBar
playlist panel, which offers a per-item video/audio toggle.