Implement database-driven provider uninstallation#36
Open
Quickkill0 wants to merge 2 commits intomaxpiva:mainfrom
Open
Implement database-driven provider uninstallation#36Quickkill0 wants to merge 2 commits intomaxpiva:mainfrom
Quickkill0 wants to merge 2 commits intomaxpiva:mainfrom
Conversation
Fix provider uninstallation by making the database the single source of truth for provider state, addressing the core issue where ReconcileLocalAsync was resurrecting uninstalled providers. Changes: - ReconcileLocalAsync no longer sets IsEnabled=true automatically - DisableProviderAsync now marks SeriesProvider entries as IsUninstalled, removes from Mihon bridge, and preserves DB entries (no delete) - InstallProviderAsync restores SeriesProvider.IsUninstalled=false - Add IsActive computed property (IsEnabled && !IsBroken && !IsDead) - Replace IsEnabled-only checks with IsActive where provider usability matters (queries, job scheduling, language lists) Fix maxpiva#28
Refactor dead provider handling logic to simplify conditions for marking providers as dead and managing their enabled state.
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
Addresses #28 and implements the approach outlined by @maxpiva in PR #34 review.
Core fix:
ReconcileLocalAsyncwas resurrecting uninstalled providers by settingIsEnabled = truewhen a previously dead provider reappeared. This made uninstallation ineffective.What changed
ProviderStorageEntity— Added[NotMapped] IsActiveproperty (IsEnabled && !IsBroken && !IsDead) so all three state flags are checked consistentlyReconcileLocalAsync— Never setsIsEnabled = trueautomatically. Dead flag is cleared when a provider reappears, but the user must explicitly re-install. Only marks providers asIsDeadif they wereIsEnabled(skips already-uninstalled ones)DisableProviderAsync— Full uninstall: setsIsEnabled = false, marks relatedSeriesProviderEntity.IsUninstalled = true, removes from Mihon bridge, refreshes cache. Does not delete from DB (series may still reference them)InstallProviderAsync/InstallProviderFromFileAsync— On install, re-enables existing providers (IsEnabled = true, clearsIsDead/IsBroken) and restoresSeriesProviderEntity.IsUninstalled = falsevia sharedReEnableProvidersForPackageAsynchelperIsEnabled→IsActiveaudit —GetSourcesForLanguagesAsync, language list building,CheckAndScheduleJobsAsync, andUpdateExtensionJobsAsyncnow useIsActiveto exclude broken/dead providers.RefreshCacheAsyncsecond pass keepsIsEnabled(user intent for recovery)Design decisions per @maxpiva's feedback
IsEnabledis the install/uninstall flag, bridge state is secondaryReconcileLocalAsyncnever auto-enablesp.IsEnabled = truefrom dead-provider recoveryIsBroken/IsDeadalongsideIsEnabledIsActiveproperty used in all usability checksIsEnabled = false)SeriesProvider.IsUninstalled = trueSeriesProvider.IsUninstalled = falseTest plan
IsEnabled = falsein DB,SeriesProvider.IsUninstalled = true, extension removed from bridgeIsEnabled = true,SeriesProvider.IsUninstalled = false