Repository navigation
fix(discover): an aborted run sends no batch; the watcher yields to Discover runs - #108
Merged
Merged
Conversation
…iscover runs Live dev run: Discover remounted, the resume started an 11-file run, and StrictMode's simulated unmount aborted it during its 10 ms start-up pause. The run still sent its batch, and an aborted run's listeners ignore every progress and file-complete event, so the list stayed at '0 ready' with placeholders until the 5-minute inactivity lock cancelled the batch (the image in progress became a filename-only 'Limited analysis'). The wait helper now refuses to send for an aborted or superseded run, and the run returns without a completion notice; its finally starts the files the remount queued. The smart-folder watcher holds its queue while any user-started analysis is in flight (userAnalysisInFlight) and resumes on its own afterwards, so a startup catch-up of hundreds of smart-folder files no longer halves a Discover run.
This was referenced Nov 10, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found in a live dev run right after #106 and #107 merged.
Results never appeared ("0 ready", placeholders)
Timeline from the log:
analysis:analyze-batch.operation-progressandanalysis:file-completeevent, so no result reached the list. Redux progress, which comes fromipcMiddleware, still showed "Analyzing 4 of 11".Analysis lock timeoutwithlastProgressAtstill at the 01:58:00 start. The run resets, cancels the batch after 6 files, and turns the image in progress into a filename-only "Limited analysis".Fix:
runBatchPathWhenFreereturnssupersededbefore any attempt when the run is aborted or superseded, and the run skips the completion notice. Its existingfinallyreleases the lock and starts the files the remount queued.The watcher halved Discover runs
On launch the watcher restored and queued about 879 smart-folder files that this app's history did not know, likely a library sorted by another app. It analyzed them file by file, alternating with the user's Discover batch. It now holds its queue while any user-started analysis is running (
hasUserAnalysisInFlight), rechecks every 5 s, and resumes on its own. The hold timer is cleared on stop.Verified
useAnalysis.test.js: an unmount during the start-up pause sends no batch, and under StrictMode a resumed run sends one batch whose results reach the list. Both fail on the previous code. The new tests import React and the hook at module scope, because a later test callsjest.resetModules().SmartFolderWatcher.userAnalysisDefer.test.js: a held queue analyzes nothing during the run and resumes after it.typecheck:jsare clean.