Repository navigation
web: deleted audiobook files are told as they are in chapter states, command-line rows and the Listen message (#1295) - #1639
Conversation
…hen audiobook files are deleted (#1295) The ruled answers, red on today's code: a chapter whose MP3 is deleted after the running job made it reads as not generated, one the job is making as being generated; a command-line row whose files are gone has no Listen link and reads as a library row in that situation; with the read-along file alone gone, the Listen page names it, in English and German. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…command-line rows and the Listen message (#1295) - The chapter states take the chapters the running job reports made or taken so far (its playable chapters), passed in from the job board: a chapter it has passed is not being generated, though its file is gone. - A command-line row whose book plays nothing reads as a library row in that situation, the chapters left or no audio, and its title is no link. - With the read-along file alone gone the Listen page names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stopped part-way (#1295) A conversion stopped part-way whose files are gone plays nothing, as a finished one does; its row now reads as a web row in the same state, with no Listen link. One that plays, and one whose record can't be read, keep today's row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review (reviewer subagent that did not write the change), in two rounds; head
|
Summary
Closes the three points of #1295 as its brief rules them. Branched from
origin/integrationat cea25c7, where the audiobook state and the chapter states are judged inapp/audiobook.py(PR 1632) and the per-request object lives inweb/audiobook.py.app/audiobook.pyJudgement(and soapp.Audiobookandjudge) takespassed: the chapters the running job reports made or taken as they are so far in this run. These are its playable chapters (AudioProgress.playable). The job does not make them again, soChapterStates.comingis now the chapters the record plans, less those made, lesspassed.readalong_gone. It is true while a finished book plays nothing because its read-along file alone is missing from the folder the message names: every other file its record names is there, and every chapter the chapter record made is still vouched for.appimports nothing new. The layer contract is unedited.web/audiobook.py:Audiobooksreads the running audio job off the board once per request, as before. It now also reads that job's latest progress, and_passedturns itsplayablelist intopassedfor that document only._audiobookand the webAudiobookpasspassedthrough.audiobook_of, used by job threads and tests, passes nothing, as before.web/pages.py_nowdropslisted. Every row and shelf item now gets its length only while the book plays (playing), andleftis given for command-line books too._outside_rowis keyed on whether the book plays (now.got is None), not on whether it is finished:partly("2 of 3 chapters ready") while some chapters' files of a finished book are still there, elseanalysed("Checked, no audio yet").hrefis None.readalong_goneis true, it showslisten.readalong_missing. Otherwise it showslisten.chapters_missingor the cause's own text, as before.templates/index.html: a row whosehrefis None shows its title as<span class="title">instead of a link.app.css: only a link title underlines on hover (.papers a.title:hover).en.tomlandde.toml(below).docs/decisions/2026-12-03-1295.md, one dated line on what the brief leaves open (see Decisions).Unchanged: no core dataclass, layer contract, golden file, snapshot, record format or dependency.
cli.py,audiobook_in,made_by_run,gone_fromand the moved-folder message (#1531) are untouched. The unreadable record (#1529) is untouched, and so are its rows and pages.The new string
listen.readalong_missingIts wording follows the neighbouring messages:
listen.missing("The audiobook files are no longer in {folder}. Make the audiobook again.") andlisten.mismatch("The read-along file does not fit this document." / "Die Mitlesedatei passt nicht …"). It uses the formal "Sie" ofde.tomland the term "Mitlesedatei"de.tomlalready uses. The command-line rows reuse existing strings (library.state_partly,library.state_analysed,library.no_audio).Before and after
1. A chapter's MP3 deleted while a job runs
A first make is held in the third chapter, and the first chapter's MP3 is deleted. The state is shown on Prepare, on Listen and in the chapters API:
On the Listen page, the growing book no longer plays. It still says "There is no audiobook of this document yet." (the cause, unchanged). It now lists the chapters with these states, because one of them is not generated. While the job runs nothing is offered (one job at a time).
A finished book made again with another speed ("replace"), its job held in the first chapter: that chapter's MP3 deleted now reads as being generated, because the job is making it. The other two read as generated. This was right before too, and is now pinned.
2. Command-line rows
A web library row whose book plays nothing reads the same ("2 of 3 chapters ready" or "Checked, no audio yet", "—";
test_one_mp3_deleted,test_every_file_deleted).3. Only the read-along file gone
A chapter's file gone still gives "Some chapters' files …", and every file gone still gives "The audiobook files are no longer in …". A moved folder still gives the #1531 message.
Acceptance criteria
test_audiobook_told.py::test_a_chapter_deleted_while_its_job_runs(Prepare, Listen rows, API);test_audiobook_four_answers.py::test_a_chapter_deleted_while_its_job_runs; the values row "growing, a made chapter's MP3 gone" intest_audiobook_object.py. The guard, where the job will make it:test_audiobook_told.py::test_a_made_chapter_deleted_while_its_job_makes_it_againand the values row "a chapter's MP3 gone before the running job reached it"test_audiobook_told.py::test_a_command_line_audiobook_with_files_deleted[every MP3, every file, one MP3, the read-along file]; for a conversion stopped part-way,::test_a_command_line_conversion_stopped_part_way_with_files_gone[one MP3, every MP3, the read-along file, the folder moved]. Each case compares the row with a web document's row in the same state, with unchanged file treestest_audiobook_told.py::test_only_the_readalong_file_deleted(chapters never chosen, English and German),::test_only_the_readalong_file_deleted_with_every_chapter_made(English and German), the command-line case above,test_audiobook_object.py::test_only_the_read_along_file_gone_is_told_apart; browser:test_add_chapters.py::test_with_only_the_read_along_file_deleted_the_listen_page_names_it(withcheck_axe, light and dark)Nothing is written, moved or deleted by showing any of this.
told()andtold_outside()compare every file of the working and output folders, bytes included, before and after every page load in these tests.Jobs are held mid-run by the builder's gate (an event the fake voice waits on), with no sleeps.
real_jobgainssettingsandoverwrite, which the "replace" case needs.Decisions (where the brief leaves it open; recorded in
docs/decisions/2026-12-03-1295.md)playable), and these are passed in from the job board. A job also takes chapters it was not asked for (the union, app, web: generate the remaining chapters later, all together or one by one #726), and their files stand there. Using the person's choice would show such a chapter, sitting there, as not generated for as long as the job takes to reach it.Existing tests changed to the ruled answer
test_audiobook_told.py::test_a_chapter_deleted_while_its_job_runs: pinned("generating", "generated", "generating")and no Listen rows (point 1's wrong answer). Now("not-generated", "generated", "generating"), and the Listen page lists("not generated", "generated", "being generated"). The row, shelf, tab, removal box and Listen message are unchanged.test_audiobook_four_answers.py::test_a_chapter_deleted_while_its_job_runs: the same chapter states, changed the same way.test_audiobook_object.py, row "growing, a made chapter's MP3 gone": pinned(COMING, GEN, COMING). It now passes the job'spassed={0, 1}and expects(NOT, GEN, COMING).Rowgainspassed(default empty), and the three table tests pass it tojudge.test_audiobook_told.py::test_only_the_readalong_file_deleted: pinned "Some chapters' files …" (point 3's wrong answer). Now the read-along message, plus the German.test_audiobook_told.py::test_a_command_line_audiobook_with_files_deleted: pinned the "From the command line · Not started" row with a Listen link (point 2's wrong answer). Now the ruled rows, plus a case for the read-along file.library_rowreads a title that is no link as"none", where it had read every non-Listen link as"document".No test was deleted or weakened. No snapshot changed.
What must not change (pinned, all passing unchanged)
test_audiobook_told.pycovers none, whole, one MP3 deleted, every file deleted, broken record, record of another version or document, growing (running, stopped, after a restart), the folder moved with its web: an audiobook whose folder was moved or renamed is not found #1531 message (English and German), the web record unusable, no folder known, a changed output folder.test_a_command_line_audiobook(whole),test_sci2audio_listen_on_a_conversion_stopped_part_way(growing and playing),test_sci2audio_listen_on_a_broken_record,test_web_library.py::test_a_command_line_working_folder_that_cannot_be_listed.test_growing_while_its_job_runs(told, four answers),test_web_add_chapters.py::test_adding_to_a_finished_project_shows_the_growing_view_until_done.Proof
Red first (the test commit on today's code): 8 failed and 48 passed in
test_audiobook_told.pyandtest_audiobook_four_answers.py. These failed:test_a_chapter_deleted_while_its_job_runs(told, four answers);test_only_the_readalong_file_deleted;test_only_the_readalong_file_deleted_with_every_chapter_made;test_a_command_line_audiobook_with_files_deleted[one MP3, every MP3, every file, the read-along file].The guard
test_a_made_chapter_deleted_while_its_job_makes_it_againpassed, as it should. The values table intest_audiobook_object.pyfailed on the newpassedargument.After:
test_audiobook_told.py,test_audiobook_object.py,test_audiobook_four_answers.pyandtest_web_languages.py: 216 passed.test_web_add_chapters.py,test_web_listen_growing.py,test_web_library.pyandtest_web_outside.py: 198 passed. The other audiobook, captures-state, command-line-listen, documents and review-tag tests: 203 passed.Second push (rows keyed on "plays"):
test_a_command_line_conversion_stopped_part_way_with_files_gonefailed in all 4 cases on the first head (5277fcb), with the row "From the command line" and a Listen link, while the growing-and-playing pin passed. After the fix,test_audiobook_told.py,test_audiobook_object.py,test_audiobook_four_answers.pyandtest_web_languages.pygave 220 passed.test_web_library.py,test_web_outside.py,test_cli_listen.pyandtest_review_tags.pygave 248 passed.pytest -m browser -n 2(Chromium, the whole browser suite, on the final head): 292 passed, 5 skipped (the installed-window tests), in 285 s.scripts/precheck.sh(final head): ruff, format, layers, deptry and pyright ok. Fast tests: 15335 passed, 9 skipped, 13 xfailed, 36 subtests passed, in 427 s.I also looked at the pages at 1280 px in English and German (Playwright screenshots, not added to the repo): the library with three command-line books (whole, one MP3 gone, every MP3 gone); the Listen page with only the read-along file gone; the Listen and Prepare pages during a job with a made chapter's file deleted.
What could break
Judgement,judgeandapp.Audiobooktake a new keyword with a default. A caller that leaves it out while a job runs gets today's answer, every planned chapter not made counting as coming. The only caller with a running job isAudiobooks, which passes it.passedcomes from the job's latest progress. Before the job reports its first playable chapters (reading, text steps), it is empty, and the states are as before. After the job's final "done" report, which carries noplayable, it is empty too, for the moment until the job ends. The record is complete by then, so nothing reads as being generated that is not.Closes #1295
🤖 Generated with Claude Code