Skip to content

Improve cached startup state and keep directory scans responsive#566

Open
moreaki wants to merge 5 commits intomangerlahn:mainfrom
moreaki:feature/nonblocking-directory-scan-ui
Open

Improve cached startup state and keep directory scans responsive#566
moreaki wants to merge 5 commits intomangerlahn:mainfrom
moreaki:feature/nonblocking-directory-scan-ui

Conversation

@moreaki
Copy link
Copy Markdown

@moreaki moreaki commented Mar 15, 2026

Summary

This PR includes the combined directory-monitoring fixes from #565 and the follow-up responsiveness/usability work that was built on top of them.

It targets main because GitHub cannot open a PR against a base branch that only exists on a fork. Once #565 lands, the effective review delta for the follow-up work is the responsiveness and caching improvements described below.

On top of the combined monitoring work, this branch turns the app into a much better "show something immediately, finish work in the background" experience, and adds guardrails for the slow-path cases.

The main user-facing changes are:

  • Latest restores the last known app list on launch from cache in AppDataStore, instead of starting with an empty main window every time.
  • Cached update availability is restored too, via Update, App, and UpdateButton, but stale cached updates are treated as non-actionable until a fresh check confirms them.
  • Snapshot generation for the main table was moved off the main thread and coalesced in UpdateTableViewController, UpdateTableView+Search, and AppListSnapshot, so large refreshes no longer block the UI while snapshots are rebuilt.
  • The Settings locations list no longer repeatedly rescans the same directory count on every redraw; AppDirectoryCellView now uses a shared cached/deduplicated count provider.
  • Adding a very broad scan root like /, the home folder, or a whole volume now triggers a warning in AppLocationViewController, so users are nudged toward choosing a narrower app folder instead of accidentally selecting an entire disk.

Under the hood, scan performance and scan behavior were tightened:

  • BundleCollector now enumerates candidate .app bundles first and processes them concurrently for larger result sets.
  • Source detection no longer needlessly reopens bundles, via BundleCollector, MacAppStoreCheckerOperation, SparkleCheckerOperation, and UpdateCheckCoordinator.
  • AppDirectory now performs collection work on a utility queue instead of doing that work inline on a generic serial queue with a misleading name.

The branch also includes diagnostics and failure UX that fit naturally on top of the combined monitoring base work:

  • Observation failures are buffered until a delegate exists in UpdateCheckCoordinator, so startup failures are not dropped.
  • Opt-in diagnostics tracing lives in Observable, disabled by default, so we can later build richer app-aware tracing on top of it.
  • Real observation/access failures are shown through the polished custom sheet in MainWindowController, and the same component is reused from Settings when a location count hits the same failure mode.
  • Strings for the broad-folder warning and permission/access guidance were added in Localizable.strings.

So the PR story is basically:

  • the combined monitoring work fixes correctness: no startup crash, recursive monitoring, visible access-failure handling
  • the follow-up work improves responsiveness and usability: cached startup state, nonblocking UI refresh, faster/more efficient scanning, smarter Settings behavior, and retained diagnostics support

Verification

  • xcodebuild -project Latest.xcodeproj -scheme Latest -configuration Debug CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= build

I did not run the full test suite end-to-end because the existing test-target dependency issue with CommerceKit / StoreFoundation still applies.

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