feat(audit): Batch 23 — settings key renames with migration (CC1) + config.ts (CC11)
CC1: customCommandEnabled→enableCustomCommands, downloadArchive→ useDownloadArchive, clipboardWatch→watchClipboard, sidebarCollapsed→ isSidebarCollapsed, hardwareAcceleration→useHardwareAcceleration, videoDir/audioDir→videoFolder/audioFolder (+ chooseDir/clearDir store actions → chooseFolder/clearFolder). Rename map in settingsMigration.ts (pure, unit-tested incl. pre-rename backup fixture), applied as an idempotent on-disk shim at store open and on backup import so old settings.json and old backups both keep working. CC11: update host/owner/repo + release API moved to src/main/config.ts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+17
-12
@@ -1941,16 +1941,22 @@ section consolidates them by theme and — the point of the exercise — **recom
|
||||
*stylistically* consistent (no-semicolon, single-quote, 2-space) and has a genuinely good pure/impure
|
||||
split — but that style is unenforced and several "do the same thing two ways" seams have crept in.
|
||||
|
||||
- [ ] **CC1 — Naming conventions.** Boolean settings have no convention: `useAria2c` (verb-prefix),
|
||||
- [x] **CC1 — Naming conventions.** Boolean settings have no convention: `useAria2c` (verb-prefix),
|
||||
`autoUpdateYtdlp` (auto-prefix), `customCommandEnabled` (suffix), `downloadArchive`/`restrictFilenames`
|
||||
(bare). Keys say `videoDir`/`audioDir` while the UI says "folder." Preload names diverge from main
|
||||
(L92); `MediaKind` is declared twice (L105). **Standard:** booleans as `is`/`has`/`should`/`<verb>`
|
||||
consistently; one term ("folder") across keys + UI; align preload↔main names; single-source shared types in `@shared`.
|
||||
*Partially closed / deferred: `MediaKind` is single-sourced (L105 done). The remaining renames are a
|
||||
**breaking persistence change** — the boolean/`videoDir` keys are the on-disk `settings.json` schema, so
|
||||
renaming them silently orphans every existing user's saved settings without a migration. Deferred to a 1.x
|
||||
settings-migration pass; the preload↔main name alignment is the safe subset, tracked as L92 (Batch 13). The
|
||||
naming convention is recorded here for new keys.*
|
||||
*Fixed (Batch 23) — the breaking rename shipped WITH its migration: `customCommandEnabled` →
|
||||
`enableCustomCommands`, `downloadArchive` → `useDownloadArchive`, `clipboardWatch` → `watchClipboard`,
|
||||
`sidebarCollapsed` → `isSidebarCollapsed`, `hardwareAcceleration` → `useHardwareAcceleration`, and
|
||||
`videoDir`/`audioDir` → `videoFolder`/`audioFolder` (plus the store actions `chooseDir`/`clearDir` →
|
||||
`chooseFolder`/`clearFolder`); already-conforming verbs (`useAria2c`, `notifyOnComplete`, `minimizeToTray`,
|
||||
`launchAtStartup`, `restrictFilenames`, `autoUpdateYtdlp`, `autoDownloadNew`, `hasCompletedOnboarding`)
|
||||
kept. The rename map lives in [settingsMigration.ts](src/main/settingsMigration.ts) (pure, unit-tested in
|
||||
[test/settingsMigration.test.ts](test/settingsMigration.test.ts) incl. a full pre-rename backup fixture)
|
||||
and is applied in two places: a one-time idempotent on-disk shim when the electron-store opens, and on
|
||||
backup import so old backup files still restore. Preload↔main names (L92) and single-sourced types (L105)
|
||||
were already done.*
|
||||
- [x] **CC2 — Coding style is consistent but unenforced.** No ESLint/Prettier config, script, or dep
|
||||
(L44), so the (good) house style drifts only by discipline; `??` vs `||` is occasionally misused for
|
||||
null checks. **Standard:** add Prettier + typescript-eslint with `lint`/`format` scripts in CI; codify the existing style.
|
||||
@@ -2029,15 +2035,14 @@ split — but that style is unenforced and several "do the same thing two ways"
|
||||
divergence is gone. The remaining electron-store↔jsonStore split is a **deliberate** keep: settings live in
|
||||
electron-store for its DPAPI-encrypted secret fields, records in jsonStore. Fully migrating settings off
|
||||
electron-store is a 1.x call, not forced here.*
|
||||
- [ ] **CC11 — Configuration is scattered.** `electron-store` + `localStorage` (sidebar, M19) + env vars
|
||||
- [x] **CC11 — Configuration is scattered.** `electron-store` + `localStorage` (sidebar, M19) + env vars
|
||||
(`PORTABLE_EXECUTABLE_DIR`, `CSC_LINK`, `AEROFETCH_REAL_DOWNLOAD`) + hardcoded module consts (update
|
||||
host/owner/repo, timeouts, caps, `09:00`, `ARIA2C_ARGS`, L10). **Standard:** a `config.ts` for build/host
|
||||
constants; fold `localStorage` UI prefs into the settings store so there's one persisted-prefs source.
|
||||
*Partly closed / deferred: the runtime consts are already centralized in
|
||||
[constants.ts](src/main/constants.ts) (L10), and the sidebar `localStorage` pref was folded into the
|
||||
settings store (M19). What's left — a dedicated `config.ts` for build/host constants (update
|
||||
host/owner/repo, currently co-located in updater.ts) — is a marginal move deferred to the 1.x organization
|
||||
pass (CC12), with which it naturally lands.*
|
||||
*Fixed (Batch 23, the remaining move): build/host constants (update host/owner/repo + the release API URL)
|
||||
now live in [config.ts](src/main/config.ts), imported by the updater — deploy identity in one file,
|
||||
runtime tunables in constants.ts (L10), user prefs in settings (localStorage was folded in by M19). The
|
||||
env vars are genuinely environmental (portable mode, CI signing, integration-test opt-in) and stay env vars.*
|
||||
- [ ] **CC12 — Project organization.** Renderer `components/` mixes screens (views) with reusable widgets;
|
||||
helpers (`theme`/`thumb`/`useClipboardLink`) sit at src root; the **pure** `queueStats` lives in `store/`;
|
||||
main mixes pure (`buildArgs`/`validation`/`indexerCore`/`ytdlpPolicy`) and impure modules in one flat dir.
|
||||
|
||||
Reference in New Issue
Block a user