Treat files without chapters as one chapter in the chapters feed #120
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 449 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #120"
general
weight: 0.35
pganssle
The chapters feed (
/rss/derived/<id>-chapters.xml) returned a 500 for books without chapter metadata:chapter_split_jobsaskedget_multipath_chapter_infofor chapters withfall_back_to_durations=False, which returns nothing when no file has usable chapters, while the single-file and segmented feeds already usefall_back_to_durations=True. With the fallback, a file without usable chapter information counts as one chapter. For a book with no usable chapters at all, every rendered file is then a copy of an original one, so the existing logic redirects to the book's original feed, as it already did for e.g. Dracula in the test library, whose first file is a single chapter and whose second file has a chapter that starts after the end of the file.I went with the redirect rather than a 404 since it's what the other rendered feeds already do when they'd be the same as the original, and it keeps old links and subscriptions working if a book's chapter information goes away. It also didn't need a separate check in the route that would have to agree with
has_chapter_info."Usable" is doing some work there:
get_multipath_chapter_infofalls back for any file whose chapter information it can't use, which means files with no chapters and files with bad chapter metadata (a chapter starting after the end of the file). When only some of a book's files have usable chapters, the others used to be silently left out of the chapters feed, and are now included as one chapter each. That's a bit broader than "files without chapter information", but it's what the segmented feed already does with these files, and it seems strictly better than losing the audio.The segmented feed wasn't affected, since it already used the fallback. The new tests request every rendered feed for every test book and check that each one either renders or redirects to the original feed, and none of them errors; they also check the redirects for the books without chapters, and the chapter-splitting jobs for files without (or with only some) chapter information. They fail without the fix.
The second commit adds a small warning sign to the "Chapters" button in the book list when some of a book's chapter information is broken, with a tooltip (an SVG
<title>, which is also its accessible name) saying "Some of this book's chapter information is broken, so those files are one chapter each". It's coloured with--exclude, so the themes all pick it up. To keep the list and the feed from disagreeing about what counts as broken, the check thatget_multipath_chapter_infodid inline is nowfile_probe.has_broken_chapters, which the renderer uses asbroken_chapter_info. It only looks at thefile_metadatastored on the entry, so it doesn't add any I/O to rendering the list. Files with no chapter information at all don't get the warning, since that's perfectly normal.Broken chapter information still counts for
has_chapter_info, so a book whose chapter information is broken in every file still links to the chapters feed (which redirects to the original one), with the warning. I think that's more useful than hiding the button, since the warning is the only sign that the book's chapter metadata needs fixing, and it means the warning can't show up without the button.Fixes #118.