Repository navigation
feat(web): jump to a letter in title-ordered library browse - #2346
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add queryCatalogLetters, a v2 letter index giving each letter's count and first list position for a title-ordered query-source browse, and an A–Z bar on web library browse that scrolls the virtualized grid to a letter. Closes #2130 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No merge-blocking issue was established for the letter jump feature; it is ready for normal checks. Pre-merge checks |
|
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gpt-6.1-sol, reviewed c2bb53d)
Two verified web findings: the rail compresses below its label height in landscape on phones, and the current-letter marker can stay pinned after scrolling back to the top. Verification used the source and a harness for the scroll listeners. Focused catalog/API Go checks passed; the two PostgreSQL checks skipped because no test database was configured. Web tests and browser rendering were unavailable.
AI disclosure: Codex, gpt-6.1-sol, at a maintainer's direction.
…marker The rail wraps into two columns when the viewport is too short for 27 readable rows, and a chosen letter stays current only while the page remains scrolled to the bottom, so scroll-to-top and scrollbar drags hand the highlight back to the top row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings on the letter bar: - The letter index also reports runs of consecutive titles under one letter, so the bar marks the right letter where the database collation sorts some of a letter's titles apart (accented initials under C, non-Latin titles after Z). - Fold Romanian ș and ț to S and T. - Size the grid from the index's exact total instead of the pager's estimated runway, which could add up to five pages of empty slots. - Let a running letter-index read finish during a scan, then read once more, instead of cancelling and restarting it on every sweep. - Show a refresh notice when the letter index fails to refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
The grid sizes itself from the larger of the letter index's total and the items known to exist. Known items counted only the pages in the current window, so after scrolling back from the end a letter index that trailed the browse could shrink the grid below titles it had already shown. Keep the furthest loaded end for the browse and its snapshot instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er-bar # Conflicts: # scripts/ci/db-contracts.txt
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
- Reserve the bar and the grid's padding from the first render of a title-ordered browse, with every letter greyed until the index lands, so the grid no longer reflows and the bar no longer pops in. - Count the first row at least half visible below the sticky header as the top row. On a long list the scroll can settle a fraction of a pixel short of a jump's offset, and flooring counted the row hidden under the header, so a jump to Q marked P. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Closes #2130
Related issue: N/A
Validation tasks: none
In the web app, the only way to reach a title partway through a large library is to scroll there, flip the sort, or search for it by name. This adds an A–Z bar to library browse when the list is sorted by title. Choosing a letter scrolls the full list to that letter's first title. Letters with no titles are greyed out.
Approach
Jump within the list instead of filtering it. The v2 browse already accepts
name_prefix, but filtering the grid to one letter hides the rest of the list and loses the reader's place. The grid is virtualized and loads distant windows withseek, so all a jump needs is each letter's position. A new additive v2 operation provides it:POST /api/v2/catalog/letters(queryCatalogLetters) takes a browse's library, type, rule groups, and title order. It returns each letter that has titles, with its count and the zero-based position of its first title, plus the exact total. It also returns the runs of consecutive titles under one letter, which tell which letter any list position is under even when the database collation sorts some of a letter's titles apart from the rest.getCatalogSearchCapabilitiesreportsletter_index: true.name_prefixmatches, so "The Hobbit" files under H. Accented Latin initials fold to their base letter, and digits, symbols, and other scripts go under#.ROW_NUMBER()over the same query plan,ORDER BY, and tie-break that the cursor pager andseekuse. They therefore match the list under any database collation. The cost is one sort of the filtered result, comparable to an exact count, with the same 10-second deadline as a window seek. It covers the query source in title order only; other sorts and search text are refused, and the web hides the bar when the browse carries aquery_limit.Web. The bar is a fixed rail on the right edge of the viewport at every width, compact on phones like a contacts index. It is one tab stop: arrow keys, Home and End, or typing a letter move between letters that have titles, and Enter or Space jumps. Each letter is labelled with its title count, the current letter has
aria-current, and a status region announces the jump. On a touchscreen, dragging along the rail jumps as the finger passes each letter.The grid scrolls the target row to just below whichever sticky header is showing. It also takes its height from the index's exact total instead of the estimate it grows while scrolling. The letter index is cached like the browse and refreshed with it, scoped to the library that changed. During a scan, a letter-index read that is already running finishes before the next one starts instead of being cancelled, and a failed refresh shows the usual refresh notice. The current letter follows the runs. The URL stays the source of truth for sort and filters; a jump is an action, not state.
Apple and Android already have A–Z, implemented as a
name_prefixfilter. Follow-ups to adopt the jump are linked below. jellycompat needs nothing: Jellyfin clients useNameStartsWith, which already matches the sort title.Validation
en_US.utf8and aCdatabase. They check that the letters and runs match the cursor pager in both directions and with a rule filter, and that aseekto each position lands on that letter. They cover articles, accents (including Romanian ș and ț), digits and symbols, a non-Latin title, a blank sort title, and the episode scope. Both are added toscripts/ci/db-contracts.txt.main: Go build, vet, gofmt,make lint-changed, web lint, format, build and budget, and the contract, fixture, route-inventory, ledger, path, and case checks pass.make test-gopasses except twointernal/mediasampletests that run the local FFmpeg; they fail the same way onmain.make test-webpasses.Evidence
Before and after on desktop and phone web, from the same library, sort, and data, with recordings of each jump.
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2130/
Risks
#or apostrophe sorted among letters, accented initials after Z underC), a letter's titles may not all be contiguous. The jump goes to the first one, the count still covers them all, and the current letter follows the runs. A#title sorted among the H titles therefore marks#while it is the last title in the top row. On such a database,runsgrows with the number of interleaved titles.Checklist
Follow-ups
name_prefixfilter.AI Disclosure
🤖 Generated with Claude Code