Keep a database handle when the File Provider domain is unusable (fix post-update sign-in)#23
Merged
Merged
Conversation
Right after a Sparkle update macOS temporarily disables the File Provider extension, so NSFileProviderManager.stateDirectoryURL() throws on the first launch. That throw propagated out of configureInitialDatabase, leaving the app with no database handle: loadAccounts bailed (no session activated) and sign-in failed with "Database not available" — only on the post-update launch; a later manual relaunch (extension re-enabled) worked. Always open the App Group bootstrap database first, then try to upgrade to the shared File Provider state database. The bootstrap database doesn't depend on the domain, so the app always has a working handle; the session bootstrap re-seeds and adopts the shared database once the extension is back. persistSignIn also opens a bootstrap handle if none is active, as a backstop.
Nightly BuildDownload Findle Nightly (unsigned) Built from 17d0bfc. Important This build is unsigned. macOS will block it on first launch. To open it:
|
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.
Summary
Signing in right after a Sparkle update failed with "Database error: database not available". A normal relaunch worked.
Root cause (confirmed from app logs): after Sparkle replaces the bundle, macOS temporarily disables the File Provider extension. On that first launch
NSFileProviderManager.stateDirectoryURL()throws, and that throw propagated out ofconfigureInitialDatabase, sodatabasewas left nil —loadAccountsbailed (no session), andpersistSignInthrew "Database not available". On a later manual relaunch the extension is re-enabled, so it worked.Fix
configureInitialDatabasenow always opens the App Group bootstrap database first (it doesn't depend on the File Provider domain), then tries to upgrade to the shared state-directory database. So the app always has a working handle; the session bootstrap re-seeds + adopts the shared DB once the extension is back.persistSignInalso opens a bootstrap handle if none is active, as a backstop.This is a pre-existing fragility in the original 0.2.0 code. Note: the 35→36 update itself exercises the fix (the post-update launch runs build 36's code).
Build
Compiles clean.