Fix: V5-suggested authors already in the library are not linked when author import is disallowed - #90
Open
sebclark wants to merge 1 commit into
Conversation
…author import is disallowed
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.
The bug
TryRecoverRestrictedMissViaV5bails out as soon asallowAuthorImportis false:The existing-author lookup (
FindByProviderId) lives insideTryGetOrImportSuggestedAuthorForRestrictedRecovery, below the early return - so any matching context withAllowAuthorImport = false(notablyMatchingContextPresets.ForDownloaded, i.e. every completed-download import) can never link a V5 suggestion to an author already in the library. The file is rejected withNo match in local library. Suggested author: <name> (<providerId>)even when that exact provider id is stored on a local author row.This bites hard after the V3 cutover: the metadata server now answers with
hc:-keyed author suggestions, while libraries built earlier hold authors added under other provider eras. On my install the completed-download queue filled with items blocked on suggestions for authors that were sitting in the library with the exact suggestedhc:id (verified in the DB).The fix
When
allowAuthorImportis false, still perform a lookup-only resolve of the suggested provider id (newTryFindExistingSuggestedAuthor, no add path). If the author exists, run the same author-scoped strict match used by the import-allowed branch. Behaviour for genuinely-new authors is unchanged - nothing is auto-added.Tests
New test in
AuthorRestrictedV5RecoveryFixture: same scenario as the existing...when_import_allowedtest but withAllowAuthorImport = false. It fails on current develop (file lands unmatched with the suggestion) and passes with the fix (links to the existing author, matches the book). Full Core.Test suite green: 2853/2853.