Repository navigation
Preserve unknown credit roles instead of crashing during import - #39
Open
ArkhanLand wants to merge 1 commit into
Open
ArkhanLand wants to merge 1 commit into
ArkhanLand wants to merge 1 commit into
Conversation
ArkhanLand
marked this pull request as draft
September 30, 2026 05:54
ArkhanLand
marked this pull request as ready for review
September 30, 2026 06:01
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.
Importing ComicBookInfo credits can raise
AttributeError: 'NoneType' object has no attribute 'lower'when a person already has another credit and an incoming role is absent fromcredit_synonyms.get_role_from_synonyms()turns that role intoNone, whichaddCredit()then compares with existing roles. Without a matching person, the same role is silently dropped instead.Observed while importing Marvel metadata with roles such as
painter,penciller (cover), andcolorist (cover)in plugin 1.6.9 / Calibre 9.15.0. A minimal reproduction is adding a Writer credit for Mike Del Mundo, then overlaying hispaintercredit.This change preserves unrecognized nonempty role strings while keeping known synonym normalization. It also rejects missing/empty roles before duplicate comparison in
addCredit(). Case-insensitive deduplication and primary-credit updates continue to work.Adds six standard-library regression tests for the crash, unknown-role preservation, duplicate handling, known synonyms, role-specific overlay replacement, and missing roles. They import the actual metadata class with only its Calibre formatting-helper dependency stubbed.
Validation:
python -m unittest discover -s tests -v: all 6 tests pass on Python 3.14.7; the suite fails against unmodified upstream.git diff --check: passes.Scope: preservation is in the shared metadata model. This does not add new Calibre custom-column mappings or make ComicInfo.xml represent arbitrary roles. Live Calibre GUI validation of this patch has not yet been performed.