Add health check for root folders missing media type defaults - #85
Open
jbob06 wants to merge 1 commit into
Open
Conversation
A root folder created via POST /api/v1/rootfolder without going through the UI wizard can be saved with no AudiobookSettings/EbookSettings for a media type its FolderType accepts. DiscoveryWorker then fails every author it tries to create there (AuthorLibraryService.NormalizeMonitoringConfigForMediaType), but the failure is only a warn-level log entry that's never surfaced elsewhere and never retried. Add RootFolderMediaTypeDefaultsCheck, a startup/scheduled health check that flags any root folder missing defaults for a media type its FolderType is compatible with, so the gap is visible in the UI instead of requiring a manual trawl through /api/v1/log. Fixes Chaptarr#31
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
Fixes #31.
POST /api/v1/rootfolderlets you create a root folder with noAudiobookSettings/EbookSettings(or with settings that have no quality/metadata profile chosen) configured for a media type itsFolderTypeaccepts. WhenDiscoveryWorkerlater tries to auto-create an author/book there,AuthorLibraryService.NormalizeMonitoringConfigForMediaTypethrows - but that's a warn-level log entry deep in an async import path with no retry and no other visible surfacing, so the failure is invisible outside manually paging through/api/v1/log.This adds
RootFolderMediaTypeDefaultsCheck, a health check that flags any root folder missing usable defaults for a media type itsFolderTypeis compatible with, so the gap shows up in the UI's health/system status instead. It mirrorsNormalizeMonitoringConfigForMediaType's own checks (settings present, quality profile id set, metadata profile id set) so it can't report healthy while that method is still failing for the same root folder. It's wired with[CheckOn(typeof(ModelEvent<RootFolder>))](same pattern asCalibreRootFolderCheck/DownloadClientRootFolderCheck) so it re-evaluates immediately on root folder create/update/delete, plus the usual startup/scheduled runs.Known gap, left out of this pass: it doesn't detect a quality/metadata profile id that points at a since-deleted profile (the other thing
NormalizeMonitoringConfigForMediaTypevalidates) - that needsIQualityProfileService/IMetadataProfileServiceinjected and felt like a separate, slightly bigger change. Happy to add it here if preferred.Deliberately did not touch
DiscoveryWorker's async retry path or add blocking validation toPOST /api/v1/rootfolderitself, to keep this additive and low-risk rather than changing existing create/update behavior.Test plan
RootFolderMediaTypeDefaultsCheckFixture(9 cases: healthy mixed folder, missing audiobook/ebook settings, single-type folders correctly ignoring the incompatible media type, missing quality/metadata profile ids, corrupt stored settings JSON, multi-folder combined message)