Skip to content

fix(discover): reanalyze files where they are, not through the smart-folder watcher - #120

Merged
iLevyTate merged 1 commit into
mainfrom
fix/discover-reanalyze
Nov 12, 2026
Merged

iLevyTate merged 1 commit into
mainfrom
fix/discover-reanalyze

Conversation

@iLevyTate

Copy link
Copy Markdown
Owner

Problem

Reanalyze on a Discover file card, and Reanalyze N in Organize, sent the file to SmartFolderWatcher.reanalyzeFile. The watcher refuses any file outside a watched Smart Folder, and Discover's files are source files, so the action ended in:

This file is not inside a configured Smart Folder. Add its source folder as a Smart Folder destination to enable reanalysis.

Change

Both controls now re-run Discover's own analysis run for those paths with bypassCache, so the analyzers skip the cached result and the card updates in place.

  • Analysis IPC (src/main/ipc/analysis.js): the single-file analyze payload accepts bypassCache (boolean) and passes it to the document, image and media analyzers.
  • Preload: files.analyze forwards bypassCache.
  • useAnalysis: new reanalyzeFiles(paths), exposed through useAnalysisRun(). It always uses the per-file path, does not auto-advance to Organize, does not set the total-failure state, and reports "Reanalyzed N files" / "Reanalysis failed for N files".
  • Organize: UncategorizedActionsBar takes onReanalyze and is disabled while an analysis runs.

Behaviour to know about

  • Reanalyze is refused while an analysis is running (toast: "Analysis is still running. Reanalyze when it finishes."), because files queued behind a run would lose the bypass flag.
  • A failed reanalysis replaces the card's previous result with the error state.
  • The watcher route (embeddings.reanalyzeFile, EMBEDDINGS.REANALYZE_FILE, SmartFolderWatcher.reanalyzeFile) is left in place but no longer has a renderer caller. Removing it also means removing the watcher's exclusion-exemption logic and its tests, so it is left for a separate change.

Testing

  • Full npm run ci run locally on Windows: passes (944 suites, 13,916 tests passed, 4 skipped; typecheck, all verify:* checks and the production build).
  • New tests cover the bypass flag through preload and the IPC handlers, reanalyzeFiles (cache bypass, path matching, no auto-advance, failure wording, busy and empty refusals), the card action and the Organize button.
  • Not exercised in the running app.

…folder watcher

Reanalyze on a Discover file card and "Reanalyze N" in Organize sent the
file to SmartFolderWatcher.reanalyzeFile, which refuses any file outside a
watched Smart Folder. Discover's files are source files, so the action
always ended in "This file is not inside a configured Smart Folder".

Both controls now re-run the Discover analysis run for those paths with
bypassCache, so the analyzers skip the cached result:

- analysis IPC: the single-file analyze payload accepts bypassCache and
  passes it to the document, image and media analyzers
- preload: files.analyze forwards bypassCache
- useAnalysis: reanalyzeFiles(paths) runs the per-file path with the
  cache bypassed, does not auto-advance to Organize, and reports
  reanalysis results in its own words; refused while a run is active
- Organize: the button is disabled while an analysis runs

The watcher's embeddings.reanalyzeFile route is left in place; it no
longer has a renderer caller.
@iLevyTate
iLevyTate merged commit 62efb88 into main Nov 12, 2026
10 checks passed
@iLevyTate
iLevyTate deleted the fix/discover-reanalyze branch November 12, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant