[BUG] Import matches a sibling book when the file title carries a subtitle the edition title lacks
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #291 di @Arthur031221 — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start in FileMatchingService and inspect the strict edition eligibility pass, the CONTAINMENT_FAILED rejection, and the leftover fallback that excludes stagedPreferredBookIds. The report says Stage 2 selects book 6598 and edition 16318 carries the matching ASIN; compare the two dc:title variants in the reproduction against that path. Done means the subtitle variant selects book 6598, with a regression test covering both titles. An open linked pull request (#291) already addresses this issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: 0.9.965.0 (Docker, chaptarr/chaptarr:develop, buildTime 2026-09-27T18:51:06Z), PostgreSQL backend
What happens
A book file whose embedded title carries a subtitle that its own edition title does not have fails the strict edition-eligibility pass with CONTAINMENT_FAILED. The fallback that runs next re-scores with !stagedPreferredBookIds.Contains(...), so the book Stage 2 already identified is excluded by construction — and the only candidate that passes containment is the edition titled exactly the bare series name. That edition wins.
Concretely: "The Primal Hunter 6" imports as "The Primal Hunter, Vol. 1". Book 6, edition 16318 (ASIN B0BW17HMDZ), resolves to book 6589 — the series' volume 1.
To reproduce
The trigger is the subtitle, not the series number. Take the same file and change only dc:title in its OPF:
dc:title in the epub |
Matched book |
|---|---|
The Primal Hunter 6 |
The Primal Hunter 6 — correct |
The Primal Hunter 6: A LitRPG Adventure |
The Primal Hunter, Vol. 1 — wrong |
The Primal Hunter |
The Primal Hunter, Vol. 1 |
Same file, same ASIN, same tags otherwise. Nothing but the title string differs between rows 1 and 2.
Steps:
GET /api/v1/manualimport?folder=<folder>&filterExistingFiles=falseon the file titledThe Primal Hunter 6: A LitRPG Adventure.- Response suggests "The Primal Hunter, Vol. 1" with
rejections: []. - Edit
dc:titletoThe Primal Hunter 6, re-zip, repeat. Response suggests "The Primal Hunter 6".
For the A/B I built NzbDrone.MatchBench and ran /libraryaudit /live=true /source=disk against a directory holding the variants, then compared match_selected per file.
What the trace shows
[STAGED-FTS-FALLBACK] Stage 2 selected provider Book 'Ebook|base:hc:1093426',
but none of its Editions passed eligibility; running deep analysis on the
remaining author-gated Books.
MATCH ACCEPTED (book-occurrence-edition-selection-leftover): EditionId=16309, Title='The Primal Hunter'
Stage 2 gets it right — hc:1093426 is the correct book (local id 6598), with fts_stage2_book_selected reporting localBookIds: 6598, titleFields: title[0], yearExact: true, and the edition's provider keys az:B0BW17HMDZ,hc:edition:31229956. The exact ASIN is right there in the file.
The strict pass then rejects that very edition:
candidate_rejected ed=16318 book=6598 reason=CONTAINMENT_FAILED
21 of the 22 candidates were rejected with CONTAINMENT_FAILED. The sole survivor was edition 16309, titled exactly The Primal Hunter. So the fallback picks it, and the winning provenance records the series digit as neutral:
[ 0,17] 'The Primal Hunter' supporting title edition
[18,19] '6' neutral tolerated_metadata
Expected behavior
A file whose title contains its own edition title as a prefix should match that edition. At minimum, this shouldn't come back as a clean success with no rejections — see #105.
Diagnostics gap (may be worth fixing on its own)
The rejection reason is invisible in production. IFileMatchingService.TraceSink is assigned only in HolyGrailSmokeTestFixture and NzbDrone.MatchBench, so every RecordCandidateRejection call — gate name, leftovers, reason — writes to a sink that doesn't exist at runtime. No log level exposes it; two Trace-level captures of this exact match produced zero rejection lines. I only got CONTAINMENT_FAILED by building MatchBench.
Additional context
- Related but distinct from #111: that's duplicate book rows hijacking the monitored row via intersecting work IDs. This author's rows are a different mechanism, and the wrong match here happens inside
FileMatchingServicecontainment, not the retarget path. - #105 is the reporting side of this: the wrong match is returned with
rejections: []and no confidence, so it's indistinguishable from a correct one. This is one concrete mechanism behind it. - The leftover symptom is the
importBlockedqueue record (#50, #236): grabbed for book 6598, import matched 6589, and it stays there. - Across this library, 65
DownloadImportIncompleteevents over 31 books with repeated grabs of the same book are consistent with this path.
Uncertainty: I haven't pinned the exact predicate inside containment that yields no evidence when the field value has extra trailing tokens. The interior-gap check in TitleTokenAlignment.TryAlignStructural (lines 88–98) looks like it should pass for [the, primal, hunter, 6] against [the, primal, hunter, 6, a, litrpg, adventure], so something upstream of it is dropping the evidence. The A/B above should locate it quickly.
Logs
Matcher trace from the repro (MatchBench /libraryaudit):
[FILE-GROUP] Embedded tags used (14 keys): all_authors, author, authors, calibre:timestamp, calibre:title_sort, contributor_bkp, cover, creator_aut, date, identifier_unknown
Staged FTS retained 20/20 recalled Books after 1 unique author evaluations and ranked 22 Editions from 6 residual fields
Got 22 FTS results, validating evidence and leftovers...
[STAGED-FTS-FALLBACK] Stage 2 selected provider Book 'Ebook|base:hc:1093426', but none of its Editions passed eligibility; running deep analysis on the remaining author-gated Books.
MATCH ACCEPTED (book-occurrence-edition-selection-leftover): EditionId=16309, Title='The Primal Hunter'
SUCCESS: bk=6589 'The Primal Hunter, Vol. 1' ed=16309 author='Zogarth'
The book is not truncated by the recall limit — I re-ran the stage-1 recall SQL directly against Postgres and it ranks #10 of 23 with the 6 token and #17 without it, against a limit of 20.
- Lingua principale
- C#
- Stelle
- 664
- Fork
- 48
- Merge medio
- 5h 24m
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Chaptarr/chaptarr
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Chaptarr/chaptarr
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Rem0o/FanControl.Releases#4286 ·
-
[Tool] ServiceManagerApertahas-image has-license has-readme new-tool ready-to-approve repo-verified
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
shanselman/TinyToolTown#950 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
MPCoreDeveloper/SharpCoreDB#531 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
ardalis/CleanArchitecture#1236 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jsboige/CoursIA#29306 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno