Files
gui-video-clipper/chat-summaries/2026-09-22_15-21-fix-v012-regressions-summary.md
cottongin 9499d776fd fix: about dialog, cache paths, keyframes, reprocess always uses low-res
- Replace native macOS About menu with custom Svelte dialog via Tauri event
- Inline SVG icon in AboutDialog (fixes broken image in webview)
- Align cache directory with Tauri $APPDATA, add to asset protocol scope
- Fix ffprobe 8.x keyframe parsing (skip_frame nokey, flexible parser)
- Copy caption files into cache dir when outside cache path
- Add -y flag to ffmpeg thumbnail extraction (prevent hang on re-extract)
- Reprocess always uses preview (low-res) file, never HQ export
- Prefer cached preview file for analysis even when HQ is cached
- Guard upgrade toast when already on HQ

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-22 16:16:00 -04:00

3.4 KiB

Fix v0.1.2 Regressions

Date: 2026-09-22 15:21 Task: Fix three regressions introduced by the v0.1.2 caching work

Changes Made

Bug 1: Slow keyframe/thumbnail/caption generation (seconds → minutes)

Root cause: When the HQ export file was cached from a prior session, beginDownload() passed the HQ file to triggerPostDownloadProcessing(). All ffmpeg operations ran on the full-resolution file instead of the ~360p preview, causing 10-50x slowdown.

Fix in src/lib/stores/videoSession.svelte.ts: In the HQ early-return path, also check for cached preview and prefer it for ffmpeg analysis while still using HQ for playback:

const previewForProcessing = await checkCachedDownload(session.title, 'preview').catch(() => null);
triggerPostDownloadProcessing(previewForProcessing || exportCached);

Bug 2: Blank thumbnails

Root cause: Tauri's asset protocol scope in tauri.conf.json only allowed temp directories. The new thumbnail cache directory under ~/Library/Application Support/ was blocked, so convertFileSrc() requests were denied.

Fix (3 files):

  1. src-tauri/src/services/cache_manager.rs: Added OnceLock<PathBuf> + init() function so cache_base_dir() uses the Tauri-resolved app data directory (matching $APPDATA).
  2. src-tauri/src/lib.rs: Call cache_manager::init(app.path().app_data_dir()) during setup.
  3. src-tauri/tauri.conf.json: Added "$APPDATA/**" to the asset protocol scope.

Side effect: Existing caches under ~/Library/Application Support/gui-video-clipper/cache/ are orphaned. New location is ~/Library/Application Support/xyz.cottongin.gui-video-clipper/cache/. One-time cost for a brand-new feature.

Bug 3: False upgrade toast when already on HQ

Root cause: triggerPostDownloadProcessing() unconditionally set showUpgradeToast = true when exportStatus === 'complete', even when activeVideoPath was already the export file.

Fix in src/lib/stores/videoSession.svelte.ts: Added guard && session.activeVideoPath !== session.exportFilePath to both toast-setting locations (cache-hit and cache-miss blocks).

Defensive fix: ffmpeg -y flag

File: src-tauri/src/services/thumbnail_extractor.rs Added -y flag to the ffmpeg thumbnail extraction command to prevent hangs if re-extracting to a directory with existing frame files.

Files Changed

  • src/lib/stores/videoSession.svelte.ts — Fixes 1 and 3
  • src-tauri/src/services/cache_manager.rs — Fix 2 (OnceLock for app data dir)
  • src-tauri/src/lib.rs — Fix 2 (init cache manager in setup)
  • src-tauri/tauri.conf.json — Fix 2 (add $APPDATA to scope)
  • src-tauri/src/services/thumbnail_extractor.rs — Defensive -y flag

Lessons Learned

  1. When adding a caching layer that moves files from temp dirs to persistent dirs, always verify that security scopes (Tauri asset protocol, CSP, etc.) cover the new location.
  2. When adding an "HQ early return" optimization, consider that downstream processing might still benefit from the smaller preview file — separate the "playback source" from the "analysis source."
  3. Toast/notification conditions should always guard against the "already in target state" case, not just the "target state reached" case.
  4. ffmpeg commands writing to potentially non-empty directories need -y to avoid interactive prompts that hang .output() calls.

Follow-up Items

  • Consider cleaning up orphaned caches under the old gui-video-clipper directory.