Skip to content

mam: do not file a sequel whose subtitle contains the series name - #41

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-6199
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-6199

Conversation

@cursor

@cursor cursor Bot commented Oct 16, 2026

Copy link
Copy Markdown

Bug and impact

With mam/accept_unsnatched on, sameMamTitle treated a MAM-only subtitle as the row's series name whenever token_set_ratio was high. That score is 100 when the series name is only a subset of the subtitle, so Dune matched Dune: Children of Dune and Dune: Dune Messiah (series Dune).

MAM's file-name search also looks in title and author, so a search for Dune.m4b returns later cycle books. If the release's own torrent failed the exact author check (MAM listed Herbert, Frank) the sequel was the only passing row and book 1 was filed as a later volume.

This is separate from #40 (samePosition ignoring series parts when titles omit Book N). #40 still accepts the sequel when the id3 tags have no part.

Root cause

The documented rule is that a subtitle only MAM has must be the candidate's own series name (Leviathan Wakes: The Expanse, Book 1). The implementation used token_set_ratio, which ignores extra subtitle words.

Fix

Use token_sort_ratio with the same 90 bar as the main title. Leviathan Wakes: The Expanse, Book 1 still matches (Book N is stripped first). Dune: Children of Dune / Dune: Dune Messiah / Foundation: Foundation and Empire are refused.

Validation

  • GateTest.test_a_sequel_whose_subtitle_contains_the_series_name_is_not_accepted: own torrent Herbert, Frank + Children of Dune is not used.
  • Unit cases in test_sibling_volumes_parts_and_box_sets_are_not_the_same_title for Dune / Messiah / Foundation; Leviathan Wakes still accepted.
  • Full suite: 263 tests OK. Correctness and security review of the diff: clean.
Open in Web View Automation 

sameMamTitle treated a MAM-only subtitle as the row's series name when
token_set_ratio was high, which is 100 if the series name is only a
subset. Dune then matched Dune: Children of Dune (series Dune), so
accept_unsnatched could file book 1 as a later cycle volume.

Use token_sort_ratio, the same bar as the main title. Leviathan Wakes:
The Expanse, Book 1 still matches series The Expanse.

Co-authored-by: Mancolt <Mancolt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant