Fix R8: compact JSON for the large media-items store

writeJsonAtomic always pretty-printed (JSON.stringify(value, null, 2)), which
needlessly inflates size and write time for the media-items store (up to
MAX_ITEMS=20000 rows). Added an optional `pretty` flag (default true, so
history/sources/templates/errorlog stay hand-inspectable) threaded through
createJsonStore, and set it false for media-items.json.

typecheck + 242 tests + eslint green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 15:53:42 -04:00
parent 6ee4dbe78e
commit 15d64b7ba6
3 changed files with 22 additions and 15 deletions
+1 -1
View File
@@ -1350,7 +1350,7 @@ cosmetics. `R` IDs.
- [ ] **R7 — `safeStorage` unavailable ⇒ secrets silently stored as plaintext.** `encryptSecret` falls back
to plaintext when DPAPI/safeStorage isn't available, with no indication — compounds H7 (cookies) and the
backup-cleartext issue (M22). **Fix:** warn (or refuse to store) when encryption is unavailable.
- [ ] **R8 — Pretty-printed JSON for large stores.** `JSON.stringify(value, null, 2)` inflates size/write
- [x] **R8 — Pretty-printed JSON for large stores.** `JSON.stringify(value, null, 2)` inflates size/write
time for the potentially-20k-item media store (ties R3). **Fix:** compact JSON for the large stores.
- [ ] **R9 — Clock-skew sensitivity.** `shouldAutoCheckYtdlp` and the scheduled-download promoter compare
`Date.now()`; a backward system-clock correction can skip or double-fire a check/schedule. Minor; note for awareness.