feat(analysis): ship index-key rebuild, strategy controls, and playback/queue pipeline updates (#864)

* feat(analysis): align index settings and per-server strategies

Rebuild the local index UX to live under Servers with per-server analytics
strategies, and scope analysis queue hints/pruning by playback server so
priorities stay isolated across profiles.

* feat(analysis): add progress tracking and server analysis deletion functionality

Introduce new interfaces for tracking library analysis progress and reporting on server analysis deletions. Implement functions to retrieve analysis progress for a server and to delete all analysis data for a specified server, enhancing the analytics strategy section with real-time progress updates and management capabilities. Update relevant components and localization files to support these features.

* feat(server): implement server index key migration and enhance server ID resolution

Add functionality to migrate server index keys from legacy IDs to new URL-based keys, improving server ID resolution across the application. Introduce new types and commands for handling server key migrations in both analysis and library contexts. Update relevant functions to utilize the new server ID resolution logic, ensuring consistency and accuracy in server-related operations.

* refactor(library): simplify server ID handling in sync progress and idle subscriptions

Refactor the library sync progress and idle subscription functions to directly use the payload's server ID without additional mapping. Update related components to resolve server IDs using a new utility function, ensuring consistent server ID resolution across the application. This change enhances code clarity and maintains functionality.

* refactor(analytics): rename advanced strategy to aggressive and update descriptions

Refactor the AnalyticsStrategySection component to rename the 'advanced' strategy to 'aggressive' for clarity. Update related localization strings to reflect this change, enhancing the user experience by providing clearer descriptions of the analytics strategies. Additionally, remove unused strategy description functions to streamline the code.

* fix(audio): update server ID handling in audio progress functions

Refactor the audio progress handling to utilize the new `getPlaybackIndexKey` function for server ID resolution. This change ensures that the correct analysis server ID is used when processing audio progress, enhancing the accuracy of playback operations. Additionally, a minor update was made to the analysis cache to include a checkpoint after seeding from bytes. Update the library path in live search to reflect the new database structure.

* refactor(analysis): update server ID handling and drop legacy keys

Refactor server ID handling across analysis components to utilize scheme-less keys (host + optional path) instead of legacy scheme-based keys. Introduce SQL migrations to drop legacy analysis rows and library entries keyed by scheme URLs. Update relevant functions and tests to ensure consistent server ID resolution and remove references to the legacy '' scope, enhancing clarity and maintainability.

* refactor(migration): switch to strategy C dual-db flow

Replace destructive server-key migration paths with a blocking inspect/run pipeline that imports into v2 sqlite files, verifies data, then switches active databases with backup safety. Add frontend migration orchestration and post-switch key rewrites while preserving existing user settings behavior.

* fix(migration): harden runtime db switch and startup gate

Switch database promotion through live runtime store/cache connection swaps so migration cannot leave writers on old sqlite inodes, and tighten startup gating to block initialization until migration completes. Also fix empty-bucket warning detection and set the done flag only after a post-run inspect confirms no pending legacy rows.

* feat(migration): enhance migration reporting with skipped server rows tracking

Add new fields to migration interfaces and reports to track skipped rows for removed servers. Update relevant components to display warnings and log messages when such rows are encountered during migration processes, improving visibility and user awareness of migration status.

* fix(migration): avoid startup blocking modal on no-op runs

Keep migration gate completed by default after successful runs and perform done-flag inspections without forcing a blocking phase, so normal app startup no longer flashes migration preparation when no migration is needed.

* fix(migration): enforce startup precheck and purge unknown rows

Prevent stale done-flag bypass by starting migration state in idle and gating completion on orchestrator precheck, and delete unknown removed-server rows from v2 databases before switch so skipped rows are not carried into the new active DB.

* fix(migration): block UI during done-flag precheck

Set inspecting phase before the first migration inspection and treat idle as blocking in the migration gate, so startup precheck cannot render the app before migration status is confirmed.

* fix(migration): hide precheck modal when no migration is needed

Keep startup precheck in a non-blocking idle phase and show the migration modal only after inspect confirms real migration work, removing the recurring half-second migration flash for already-migrated users.

* fix(migration): cleanup legacy db files after path migration

Always remove legacy analysis and library sqlite files (including wal/shm sidecars) when the new database paths are active, so old-path artifacts from previous builds do not linger after migration.

* docs(changelog): add PR #864 release notes and contributor credit

Document the full index-key rebuild scope for 1.47.0 and add the
corresponding settings credit entry for PR #864.

* test(analysis): raise hot-path coverage for analysis cache

Add focused unit tests for analysis cache compute/store hot paths and edge branches so coverage regressions are caught before CI. Make AppHandle entrypoints runtime-generic and enable tauri test utilities in dev dependencies to cover no-cache and registered-cache execute paths.

* fix(migration): make rebind pass resilient to foreign key ordering

Run library and analysis server_id rebind operations inside a foreign-key-disabled transaction and validate with PRAGMA foreign_key_check after commit, so migrations from older databases do not fail on transient FK ordering during bulk updates.

* feat(backup): add dual-database backup flow and blocking UX

Extend backup/export and restore flows to handle library databases with unified archive detection and asynchronous backend execution. Improve backup UI with a global blocking modal and clearer localized copy so long operations do not look like app hangs.

* docs(changelog): add PR #864 backup notes and contributor credit

Update 1.47.0 release notes with backup/restore UX and archive-flow entries for PR #864, and add the matching settings credits contribution line for cucadmuh.

* docs(changelog): sort 1.47.0 entries from old to new

Reorder Added, Changed, and Fixed subsections in the 1.47.0 changelog so entries follow chronological PR order inside each block.

* fix(playback): align offline/hot cache lookup with indexKey scope

Use a canonical playback cache key based on indexKey with legacy UUID fallback so migrated offline and hot-cache entries are still resolved on normal play, resume, queue-undo, and prefetch paths. Refresh PR #864 changelog/credits text to reflect the full migration and backup scope.
This commit is contained in:
cucadmuh
2026-05-24 21:11:04 +03:00
committed by GitHub
parent 003b280a77
commit 11974e1438
111 changed files with 7537 additions and 1673 deletions
+54
View File
@@ -288,6 +288,33 @@ export const settings = {
libraryIndexAutoReconcileDesc: 'Автоматически искать удалённые треки, когда на сервере их меньше ожидаемого.',
libraryIndexSyncError: 'Ошибка синхронизации: {{error}}',
libraryIndexBindError: 'Не удалось включить индекс: {{error}}',
analyticsStrategyTitle: 'Стратегии аналитики',
analyticsStrategyDesc: 'Выберите стиль анализа для библиотеки.',
analyticsStrategyLabel: 'Стратегия',
analyticsStrategyLazy: 'Ленивая',
analyticsStrategyLazyDesc: 'Анализ только при проигрывании или попадании в горячий/офлайн-кэш — минимальная нагрузка на CPU и сеть.',
analyticsStrategyAdvanced: 'Агрессивный',
analyticsStrategyAdvancedDesc: 'Более агрессивный фоновый прогон. После завершения — BPM для всех треков и мгновенная загрузка loudness + waveform.',
analyticsStrategyPriorityTitle: 'Приоритет анализа (всегда)',
analyticsStrategyPriorityHigh: '1 — Сейчас играет: скачивание и анализ в первую очередь (байты воспроизведения, loudness backfill или HTTP при необходимости).',
analyticsStrategyPriorityMiddle: '2 — Следующие: ~5 треков в очереди, preload next и соседи hot cache — анализ из уже скачанных байтов, HTTP backfill только при промахе.',
analyticsStrategyPriorityLow: '3 — Библиотечный batch (только Агрессивный): автоматическая фоновая очередь в хвосте; пополняется по watermark (~3× потоков), не дожидаясь полного опустошения.',
analyticsStrategyServerLabel: 'Сервер',
analyticsStrategyProgressLabel: 'Прогресс анализа:',
analyticsStrategyProgressValue: '{{percent}}% ({{done}}/{{total}})',
analyticsStrategyActionsLabel: 'Действия',
analyticsStrategyParallelismLabel: 'Параллельные потоки',
analyticsStrategyParallelismValue: '{{n}} потоков',
analyticsStrategyParallelismDesc: 'Сколько треков одновременно скачивать и анализировать (HTTP + CPU). Больше значение — быстрее догоняет библиотеку, но выше нагрузка на сеть и CPU.',
analyticsStrategyAdvancedWarning: 'Агрессивный режим даёт большую нагрузку на CPU и сеть, пока идёт фоновый прогон библиотеки.',
analyticsStrategyServerRemoved: 'Удалённый сервер',
analyticsStrategyClearAction: 'Очистить анализ',
analyticsStrategyClearTitle: 'Очистить анализ?',
analyticsStrategyClearDesc: 'Очистка анализа для {{server}} удалит кэш волн и loudness. При повторном добавлении сервера индексация может занять много времени.',
analyticsStrategyClearCancel: 'Отмена',
analyticsStrategyClearConfirm: 'Очистить анализ',
analyticsStrategyClearSuccess: 'Анализ удалён для удалённого сервера.',
analyticsStrategyClearError: 'Не удалось очистить анализ для удалённого сервера.',
randomMixTitle: 'Чёрный список случайного микса',
luckyMixMenuTitle: 'Показывать «Мне повезёт» в меню',
luckyMixMenuDesc:
@@ -395,9 +422,36 @@ export const settings = {
backupImport: 'Импорт настроек',
backupImportDesc: 'Восстановить из .psybkp. Приложение перезапустится.',
backupImportConfirm: 'Текущие настройки будут заменены. Продолжить?',
backupImportAny: 'Импорт резервной копии',
backupImportAnyConfirm:
'Импортировать выбранный файл резервной копии и применить его содержимое (настройки, базы библиотеки или полный архив). Продолжить?',
backupSuccess: 'Копия сохранена',
backupImportSuccess: 'Настройки восстановлены — перезапуск…',
backupImportError: 'Файл повреждён или не подходит.',
backupModeFull: 'Полный',
backupModeLibrary: 'Базы библиотеки',
backupModeConfig: 'Настройки',
backupFullDesc: 'Архивирует настройки и базы библиотеки в один файл резервной копии.',
backupFullExport: 'Экспорт полного архива',
backupFullImport: 'Импорт полного архива',
backupFullImportConfirm:
'Настройки будут перезаписаны, текущие базы библиотеки будут заменены и сохранены в .bak. Продолжить?',
backupFullExportSuccess: 'Полный архив экспортирован.',
backupFullImportSuccess: 'Полный архив импортирован — перезапуск…',
backupFullImportError: 'Не удалось импортировать полный архив.',
backupLibraryExport: 'Экспорт баз',
backupLibraryExportDesc: 'Создаёт сжатый архив с чистыми SQLite-снимками баз библиотеки.',
backupLibraryImport: 'Импорт баз',
backupLibraryImportDesc:
'Восстанавливает базы библиотеки из архива. Текущие базы перед заменой переносятся в .bak.',
backupLibraryImportConfirm:
'Текущие базы библиотеки будут заменены и сохранены в .bak. Продолжить?',
backupLibraryExportSuccess: 'Копия баз экспортирована.',
backupLibraryImportSuccess: 'Копия баз импортирована.',
backupLibraryImportError: 'Не удалось импортировать копию баз.',
backupOverlayExportTitle: 'Создаём резервную копию…',
backupOverlayImportTitle: 'Восстанавливаем резервную копию…',
backupOverlayHint: 'Окно можно не закрывать, идёт обработка файлов. Ввод временно заблокирован.',
shortcutsReset: 'Сбросить',
shortcutListening: 'Нажмите клавишу…',
shortcutUnbound: '—',