feat: show subtitles, part labels and edition years on book cards #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/better-card-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Book cards now show which publication they present, so a split volume (e.g. Words of Radiance, Part Two) no longer looks like the complete novel. The card still uses the preferred-language edition's title and cover.
No extra upstream requests: only the
fieldslist of the existing/search.jsoncall is extended (subtitle,editions.subtitle,editions.publish_year).What a card shows now
title):Badge,secondary, inline after the title). A normalized label such asPart 2,Part 2 of 2orVol. 1. It is shown only when the presented title and subtitle hide the part, e.g. the German edition Die Türme der Mitternacht of the work Towers of Midnight 2/2. When the title or subtitle already shows the part (Words of Radiance / Part two), nothing is repeated.Part/Pt/Teil/Parte/Partie/Deel N,Volume/Vol/Tome/Tomo N(digits, number words, roman numerals),N of M, ordinal-first forms (1re partie,Erster Teil,Second part) and a trailing1/2.Book Nis deliberately ignored because it is a series position (already shown on the series line).Book 1 of 3,24/7and9/11are not matched either.Published 2019becomesFirst published 2019(the work's first publication). A separateThis edition 2025appears when the presented edition's year differs. This keeps the original publication date separate from a particular edition's date.Title: Subtitle (Part 2)) viabookFullTitle().Persistence
library_bookgains three nullable columns:subtitle,part_label,edition_publish_year(migration0008). Search-result saves and Goodreads imports store them, so saved books render the same way. The fields are optional onBookSearchResult, so the existing jsonb snapshots (imports/recommendations) and other producers keep working. Library identity and dedup are untouched.Import matching
bestImportMatchnow requires the part labels to agree. A Goodreads row titled Words of Radiance no longer auto-matches OL19913851W, whose edition is titled "Words of Radiance" with the subtitle "part two". Such rows fall through to the other candidates or to manual review.Commits
Verification
pnpm lint-full(typecheck + eslint) passes on every commit; the migration was applied to the worktree DB.Book Two of…,Part of Your World,Le parti pris,Books 1-3,24/7,9/11,Book 1 of 3).Part 2 of 2, Das Rad der Zeit 34. Der Traum des WolfsPart 1 of 2.part_label = 'Part 2 of 2'and the library card shows the same badge.Demo
41 s. Covers "Words of Radiance" (subtitle + edition-year cards), "Towers of Midnight" with German filter (part badges), and the saved book in My library.
better-card-metadata-demo.mp4
Reviewed
feat/better-card-metadataagainstmaster(5 commits), using the full-code-review skill and the product notes.Important
Require stronger evidence before interpreting ordinary prose as a part label — must fix before merge.
shared/utils/book-search.ts:46(used byserver/utils/open-library.ts:92-99). Running the actual extractor returnsPart 1for bothThe Part I PlayedandThe Part One Plays, andVol. 5forVol. V. Smith: A Biography. These are valid ordinary-title/name constructions, not evidence of a split publication. If an edition has a translated/different title, normalization adds that invented part badge to its card and persists it on save. The same false positives also participate in import matching. Constrain detection to clearer label contexts, treating ambiguous prose/initials as unknown.Do not treat Goodreads series annotations as split-publication labels — must fix before merge.
server/utils/import-matching.ts:64-69. For a row titledA Book (Series, Vol. 1)and a candidate titledA Bookby the same author with no split-part metadata,comparable()deliberately removes the Goodreads suffix, butsamePart()scans the unstripped title and comparesVol. 1withnull. This previously valid match now becomes manual review, including when the candidate was found by the row's ISBN. A volume position inside a Goodreads series qualifier does not establish that the book is a fragment of a larger publication. Separate series annotations from publication-part evidence before applying this guard.Compare part identity rather than the complete display string — must fix before merge.
server/utils/import-matching.ts:65. A Goodreads rowA Book (Part 1)and a normalized candidate{ title: "A Book", partLabel: "Part 1 of 2" }by the same author matched onmaster, but now fail becausePart 1 !== Part 1 of 2. Both identify the same first part; only one supplies the total. This is reproducible through the normalizer with work titleA Book, Part 1 of 2and edition titleA Book. Compare structured part numbers, checking totals when both are known, while continuing to reject conflicting part numbers and whole-book/fragment mismatches.Other categories and validation
pnpm lint-fullpassed. Evaluated the actual extraction, normalization and matching functions in memory; no test files or repository code were added or changed.a5f5cc53bdtodf286e6523Thanks. I accepted all three findings and fixed them in separate commits (
pnpm lint-fullpasses on each):169dd6afix: require a clear label context before detecting part labels). Number words, roman numerals, ordinal-first forms andN of Mnow count only when they end the title or a clause: end of string,, ; : ) ] / –, or a final period. Digits after an explicit Part/Vol keyword keep the old boundary rule, since that context is unambiguous (Naruto, Vol. 3: …).The Part I Played,The Part One Plays,Vol. V. Smith: A BiographyandThe first part of the talenow return nothing.Words of Radiance, Part Two,Part II: The Fall,Words of Radiance (1 of 5),Der Tragödie erster TeilandTowers of Midnight 2/2are still detected. The extractor now returns a structuredPublicationPart { kind, number, total }, andextractPartLabelformats it.3b88a96fix: ignore Goodreads series annotations when comparing import parts). A trailing parenthetical containing,or#((Series, #1),(Series, Vol. 1)) is stripped before reading the row's part.A Book (Series, Vol. 1)matchesA Bookagain. A bare(Part 1)is still read as a part.9f55804fix: compare structured part numbers when matching imports).samePublicationPartcompares part numbers and checks totals only when both sides know them.A Book (Part 1)matches a candidate withPart 1 of 2.Part 2vsPart 1 of 2,Part 1 of 3vsPart 1 of 2, and whole book vs fragment are still rejected.Rebase on master (PR #3): the only conflicts were the
bookSearchIdentitycomment and the migration journal. I dropped my old0008and regenerated it as0009_lame_dust(addssubtitle,part_label,edition_publish_year), chained to master's0008_blushing_prism. Migrations 0000–0009 apply cleanly to a fresh DB clone. Saving through master's one-entry-per-work flow persists the new fields (checked:Der Traum des Wolfs→part_label = 'Part 1 of 2'). I also addeddf286e6, which uses the full title (subtitle and part) in master's new "Saved as another edition" note. A browser re-check after the rebase shows subtitles, part badges and "This edition" years as before.