feat(series): add series navigation across cards, author pages, library and /series #10

Merged
chris-paganon merged 15 commits from feat/series-navigation into master 2026-11-14 19:44:28 +00:00

Summary

Series navigation: series can now be found directly, and every path (book cards, /series browse and search, author pages, library) leads to the same series page.

Changes

  • Series from subject tags. Open Library links only ~3.4k works to series records (Mistborn, Stormlight, Murderbot and Skyward have none), while many works carry series:<name> subject tags. Search normalization now also reads subject and adds tag series with the stable ID tag:<slug> (e.g. tag:the-murderbot-diaries). A tag with the same name as a linked series on the same work is dropped. Tag series have no position, so none is ever invented.
  • Series pages. The existing /series/OL…L page is unchanged. The new /series/tags/<slug> page uses the same BookBibliography UI and is labelled "positions unknown", listed by first publication year. Both pages now show the reader's saved state (e.g. "4 saved · 1 read · 1 reading · 2 to read", plus a "Show in my library" link) and per-book list controls as before.
  • Card links. The series name and position on book cards is now a primary-coloured link with a series icon, still on one compact line.
  • Author pages. Series groups use the same IDs, and every group heading links to its series page, including tag-only series.
  • /series browse and search. It lists the series of saved books from the already-loaded library, with covers, authors, saved and reading-status counts and positions. Typing filters this list locally. Submitting a search also queries Open Library and shows two lists: series whose names match the search, and series of the matching books. Results that are already in the library are marked.
  • Library. A "Series" filter (one series, or "No series") and a "Group books: By series" option. Grouped view shows a section per series with a "View series" link, plus a "No series" section, so standalone books stay visible. The URL keeps the state (?series=, ?group=series), and switching list tabs keeps it. Bulk edit works across groups.
  • Navigation. A "Series" entry (Layers icon) in the navbar and the mobile drawer. With four links, the desktop nav wrapped below about 1000px, so the inline links now start at lg; below that the existing drawer is used.
  • Docs. New "Series navigation" section in the README, and a status note in docs/current-project.md.

Decisions

  • Tag series identity: tag:<slug>, where the slug is the NFKC-lowercased name with non-alphanumeric runs replaced by -. series:Harry_Potter and series:Harry Potter therefore share one page. Only canonical slugs are accepted, so each tag has exactly one URL and cache key. The upstream query subject:"series:<words>" is a phrase match that also matches longer tags ("Skyward Flight" for "Skyward"), so results are filtered to the exact slug.
  • Open Library series search: Open Library has no public series search API. The lists search (/search/lists.json) only returns user lists, and /series/_autocomplete covers linked series only (it returns nothing for "mistborn"). /api/series?q= therefore runs one /search.json work search (the 100 most relevant works, with series and subject fields only) and collects the linked and tagged series of those works.
  • No local series curation or reading-order checklists, as scoped.

Request counts (all through the existing persistent cache)

Path Upstream requests
Book cards, library filter/grouping, /series saved list, saved-state summary 0 (saved metadata or existing search responses)
Book search, author page unchanged count; search responses ~2.5× larger because subject is now requested
/series?q= submit 1
/series/OL…L 2 per language (unchanged)
/series/tags/<slug> 1 per language. Up to 100 works, paginated locally, so other pages need no request

Changing the field list changes cache keys, so existing cached search responses are refetched once.

Known limitations

  • Books saved before this change only gain tag series when saved again from search or imported. There is no backfill, consistent with the earlier series metadata migration.
  • A book whose only series is a tag links to the tag page, even if another work of the same author links that name to a catalog series. The author page still groups them under the linked series.
  • Library list-tab counts stay per list; they don't reflect the series filter.

Verification

  • pnpm lint-full passes on every commit.
  • Saved Harry Potter 1–3 (linked, #1–3), Murderbot ×4, Skyward ×2, Mistborn, The Way of Kings (tags), plus standalones, in chrisp_w2_series.
  • Browser: Murderbot card link → /series/tags/the-murderbot-diaries with 10 books and "4 saved · 1 read · 1 reading · 2 to read". /series filter and the "sanderson" search (8 series). On the Sanderson author page, every series heading links (/series/tags/skyward, …). Library grouped by series with "No series (65)", filtered to Harry Potter, and the Read tab keeps the filter. Navbar checked at 660px and 1024px.
  • API: /api/series/OL326110L (9 books, source: catalog), and /api/series/tags/Bad%20Slug returns 400.
  • The demo was recorded before the last fix commit, so the "#1Cruel Prince" spacing on /series is fixed in 6ae8640.

Demo

demo

Download the demo video

## Summary Series navigation: series can now be found directly, and every path (book cards, `/series` browse and search, author pages, library) leads to the same series page. ### Changes - **Series from subject tags.** Open Library links only ~3.4k works to series records (Mistborn, Stormlight, Murderbot and Skyward have none), while many works carry `series:<name>` subject tags. Search normalization now also reads `subject` and adds tag series with the stable ID `tag:<slug>` (e.g. `tag:the-murderbot-diaries`). A tag with the same name as a linked series on the same work is dropped. Tag series have no position, so none is ever invented. - **Series pages.** The existing `/series/OL…L` page is unchanged. The new `/series/tags/<slug>` page uses the same `BookBibliography` UI and is labelled "positions unknown", listed by first publication year. Both pages now show the reader's saved state (e.g. "4 saved · 1 read · 1 reading · 2 to read", plus a "Show in my library" link) and per-book list controls as before. - **Card links.** The series name and position on book cards is now a primary-coloured link with a series icon, still on one compact line. - **Author pages.** Series groups use the same IDs, and every group heading links to its series page, including tag-only series. - **`/series` browse and search.** It lists the series of saved books from the already-loaded library, with covers, authors, saved and reading-status counts and positions. Typing filters this list locally. Submitting a search also queries Open Library and shows two lists: series whose names match the search, and series of the matching books. Results that are already in the library are marked. - **Library.** A "Series" filter (one series, or "No series") and a "Group books: By series" option. Grouped view shows a section per series with a "View series" link, plus a "No series" section, so standalone books stay visible. The URL keeps the state (`?series=`, `?group=series`), and switching list tabs keeps it. Bulk edit works across groups. - **Navigation.** A "Series" entry (Layers icon) in the navbar and the mobile drawer. With four links, the desktop nav wrapped below about 1000px, so the inline links now start at `lg`; below that the existing drawer is used. - **Docs.** New "Series navigation" section in the README, and a status note in `docs/current-project.md`. ### Decisions - **Tag series identity:** `tag:<slug>`, where the slug is the NFKC-lowercased name with non-alphanumeric runs replaced by `-`. `series:Harry_Potter` and `series:Harry Potter` therefore share one page. Only canonical slugs are accepted, so each tag has exactly one URL and cache key. The upstream query `subject:"series:<words>"` is a phrase match that also matches longer tags ("Skyward Flight" for "Skyward"), so results are filtered to the exact slug. - **Open Library series search:** Open Library has no public series search API. The lists search (`/search/lists.json`) only returns user lists, and `/series/_autocomplete` covers linked series only (it returns nothing for "mistborn"). `/api/series?q=` therefore runs one `/search.json` work search (the 100 most relevant works, with series and subject fields only) and collects the linked and tagged series of those works. - **No local series curation or reading-order checklists**, as scoped. ### Request counts (all through the existing persistent cache) | Path | Upstream requests | |---|---| | Book cards, library filter/grouping, `/series` saved list, saved-state summary | 0 (saved metadata or existing search responses) | | Book search, author page | unchanged count; search responses ~2.5× larger because `subject` is now requested | | `/series?q=` submit | 1 | | `/series/OL…L` | 2 per language (unchanged) | | `/series/tags/<slug>` | 1 per language. Up to 100 works, paginated locally, so other pages need no request | Changing the field list changes cache keys, so existing cached search responses are refetched once. ### Known limitations - Books saved before this change only gain tag series when saved again from search or imported. There is no backfill, consistent with the earlier series metadata migration. - A book whose only series is a tag links to the tag page, even if another work of the same author links that name to a catalog series. The author page still groups them under the linked series. - Library list-tab counts stay per list; they don't reflect the series filter. ## Verification - `pnpm lint-full` passes on every commit. - Saved Harry Potter 1–3 (linked, #1–3), Murderbot ×4, Skyward ×2, Mistborn, The Way of Kings (tags), plus standalones, in `chrisp_w2_series`. - Browser: Murderbot card link → `/series/tags/the-murderbot-diaries` with 10 books and "4 saved · 1 read · 1 reading · 2 to read". `/series` filter and the "sanderson" search (8 series). On the Sanderson author page, every series heading links (`/series/tags/skyward`, …). Library grouped by series with "No series (65)", filtered to Harry Potter, and the Read tab keeps the filter. Navbar checked at 660px and 1024px. - API: `/api/series/OL326110L` (9 books, `source: catalog`), and `/api/series/tags/Bad%20Slug` returns 400. - The demo was recorded before the last fix commit, so the "#1Cruel Prince" spacing on `/series` is fixed in `6ae8640`. ## Demo ![demo](https://forgejo.chrispaganon.com/attachments/abff24ce-eb7a-4def-8156-fbec213ebe1a) [Download the demo video](https://forgejo.chrispaganon.com/attachments/abff24ce-eb7a-4def-8156-fbec213ebe1a)
Author
Owner

Reviewed the 12 commits in feat/series-navigation against git merge-base origin/master HEAD, excluding the unrelated master changes.

Important — fix before merge

Preserve Unicode tag identities and produce valid slugs — shared/utils/series.ts:13, also used by server/utils/open-library.ts:80 and server/api/series/tags/[slug].get.ts:14–21.

The slug keeps Unicode letters and numbers but removes combining marks, which are meaningful parts of many writing systems. For example, tagSeriesSlug('शिवा') and tagSeriesSlug('शिव') both return श-व. These distinct tag names therefore get the same saved series ID, library group, filter and page; the route also reconstructs the upstream phrase as series:श व, losing the original spelling. This goes beyond the intended underscore/space equivalence.

There is also a Unicode boundary failure in the same function: .slice(0, 120) counts UTF-16 code units. For 'x'.repeat(119) + '𐐀', the generated slug ends in an unpaired surrogate, isTagSeriesSlug(slug) returns false, and seriesPath({ id: 'tag:' + slug }) throws URIError: URI malformed. A returned subject tag can consequently break card rendering and cannot be saved as a valid series ID.

Please preserve meaningful Unicode marks and use an identity/query representation that retains the tag name (while still intentionally merging underscore/space variants). Bound it without splitting Unicode characters, and ensure every generated ID passes its validator and can be passed to seriesPath. This should preserve the one-upstream-request budget.

Other categories

  • Nit picks: 0.
  • Pre-existing: 0 reported.
  • Security: 0 confirmed findings.

Validation: pnpm lint-full passed; reproduced the Unicode cases directly against the shared utility without adding tests or modifying repository files. Reviewed route/query validation, submitted-search request flow, raw subject handling, grouping/filtering and bulk-selection code. Subjects are retained in the upstream cache but stripped from normalized client/library book metadata. The field-list change causes cold cache misses and larger upstream responses as documented; no additional upstream fetch loop was found. No dev server or containers were started.

Reviewed the 12 commits in `feat/series-navigation` against `git merge-base origin/master HEAD`, excluding the unrelated master changes. ### Important — fix before merge **Preserve Unicode tag identities and produce valid slugs** — [`shared/utils/series.ts:13`](https://forgejo.chrispaganon.com/chris-paganon/chrisp-books/src/branch/feat/series-navigation/shared/utils/series.ts#L13), also used by `server/utils/open-library.ts:80` and `server/api/series/tags/[slug].get.ts:14–21`. The slug keeps Unicode letters and numbers but removes combining marks, which are meaningful parts of many writing systems. For example, `tagSeriesSlug('शिवा')` and `tagSeriesSlug('शिव')` both return `श-व`. These distinct tag names therefore get the same saved series ID, library group, filter and page; the route also reconstructs the upstream phrase as `series:श व`, losing the original spelling. This goes beyond the intended underscore/space equivalence. There is also a Unicode boundary failure in the same function: `.slice(0, 120)` counts UTF-16 code units. For `'x'.repeat(119) + '𐐀'`, the generated slug ends in an unpaired surrogate, `isTagSeriesSlug(slug)` returns false, and `seriesPath({ id: 'tag:' + slug })` throws `URIError: URI malformed`. A returned subject tag can consequently break card rendering and cannot be saved as a valid series ID. Please preserve meaningful Unicode marks and use an identity/query representation that retains the tag name (while still intentionally merging underscore/space variants). Bound it without splitting Unicode characters, and ensure every generated ID passes its validator and can be passed to `seriesPath`. This should preserve the one-upstream-request budget. ### Other categories - Nit picks: 0. - Pre-existing: 0 reported. - Security: 0 confirmed findings. Validation: `pnpm lint-full` passed; reproduced the Unicode cases directly against the shared utility without adding tests or modifying repository files. Reviewed route/query validation, submitted-search request flow, raw subject handling, grouping/filtering and bulk-selection code. Subjects are retained in the upstream cache but stripped from normalized client/library book metadata. The field-list change causes cold cache misses and larger upstream responses as documented; no additional upstream fetch loop was found. No dev server or containers were started.
Author
Owner

Fixed in ce671b3 (docs: 9109c62).

  • tagSeriesSlug now keeps combining marks ([^\p{L}\p{M}\p{N}]+ → -), so शिवा and शिव get distinct IDs. The upstream phrase rebuilt from the slug keeps their spelling. Underscore/space/punctuation variants still merge (series:Harry_Potter = series:Harry Potter). seriesNameKey keeps marks too, so tag/linked-name matching doesn't merge them either.
  • No more truncation. isTagSeriesSlug caps the slug at 120 code points, and seriesTagName skips tags whose slug is empty or too long. Every generated tag: ID therefore passes isSeriesId and works with seriesPath. Truncating would also have merged distinct names, which is why over-long tags are skipped. Lone surrogates aren't letters, marks or digits, so they become separators and never reach encodeURIComponent.
  • Checked directly: 'x'.repeat(119) + '𐐀' is valid and routable, a 121-character tag is skipped, İstanbul → i̇stanbul is valid. Request counts are unchanged, still one upstream request per tag page and language.
  • pnpm lint-full passes.
Fixed in `ce671b3` (docs: `9109c62`). - `tagSeriesSlug` now keeps combining marks (`[^\p{L}\p{M}\p{N}]+` → `-`), so `शिवा` and `शिव` get distinct IDs. The upstream phrase rebuilt from the slug keeps their spelling. Underscore/space/punctuation variants still merge (`series:Harry_Potter` = `series:Harry Potter`). `seriesNameKey` keeps marks too, so tag/linked-name matching doesn't merge them either. - No more truncation. `isTagSeriesSlug` caps the slug at 120 **code points**, and `seriesTagName` skips tags whose slug is empty or too long. Every generated `tag:` ID therefore passes `isSeriesId` and works with `seriesPath`. Truncating would also have merged distinct names, which is why over-long tags are skipped. Lone surrogates aren't letters, marks or digits, so they become separators and never reach `encodeURIComponent`. - Checked directly: `'x'.repeat(119) + '𐐀'` is valid and routable, a 121-character tag is skipped, `İstanbul` → `i̇stanbul` is valid. Request counts are unchanged, still one upstream request per tag page and language. - `pnpm lint-full` passes.
chris-paganon force-pushed feat/series-navigation from 9109c62b49 to a5964f5e36 2026-11-14 19:44:25 +00:00 Compare
chris-paganon deleted branch feat/series-navigation 2026-11-14 19:44:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chris-paganon/chrisp-books!10
No description provided.