Skip to content

web: deleted audiobook files are told as they are in chapter states, command-line rows and the Listen message (#1295) - #1639

Merged
dubidu22 merged 4 commits into
integrationfrom
web/deleted-audiobook-files-shown-truthfully-1295
Dec 3, 2026
Merged

dubidu22 merged 4 commits into
integrationfrom
web/deleted-audiobook-files-shown-truthfully-1295

Conversation

@dubidu22

@dubidu22 dubidu22 commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes the three points of #1295 as its brief rules them. Branched from origin/integration at cea25c7, where the audiobook state and the chapter states are judged in app/audiobook.py (PR 1632) and the per-request object lives in web/audiobook.py.

  1. A chapter deleted during a job. A chapter's MP3 deleted while the audiobook is being made read as "being generated" while any job of the document ran. Now it reads as not generated, unless the running job will still make it.
  2. Command-line rows. A command-line row whose files are gone still read "From the command line · Not started", with a Listen link. Now it follows the same "plays" answer as the other rows: no Listen link, and the state a library row shows in that situation. This holds whether the conversion finished or stopped part-way.
  3. The missing-files message. With only the read-along file gone, the Listen page said "Some chapters' files are no longer in …" (when chapters never chosen were offered) or "The audiobook files are no longer in …". Now it names the read-along file.
  • app/audiobook.py
    • Judgement (and so app.Audiobook and judge) takes passed: 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, so ChapterStates.coming is now the chapters the record plans, less those made, less passed.
    • New field 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.
    • app imports nothing new. The layer contract is unedited.
  • web/audiobook.py: Audiobooks reads the running audio job off the board once per request, as before. It now also reads that job's latest progress, and _passed turns its playable list into passed for that document only. _audiobook and the web Audiobook pass passed through. audiobook_of, used by job threads and tests, passes nothing, as before.
  • web/pages.py
    • _now drops listed. Every row and shelf item now gets its length only while the book plays (playing), and left is given for command-line books too.
    • _outside_row is keyed on whether the book plays (now.got is None), not on whether it is finished:
    • Listen page: when readalong_gone is true, it shows listen.readalong_missing. Otherwise it shows listen.chapters_missing or the cause's own text, as before.
  • templates/index.html: a row whose href is 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).
  • Strings: one new key in en.toml and de.toml (below).
  • Docs: 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_from and the moved-folder message (#1531) are untouched. The unreadable record (#1529) is untouched, and so are its rows and pages.

The new string

Key English German
listen.readalong_missing The read-along file is no longer in {folder}. Make the audiobook again. Die Mitlesedatei ist nicht mehr in {folder}. Erstellen Sie das Hörbuch neu.

Its wording follows the neighbouring messages: listen.missing ("The audiobook files are no longer in {folder}. Make the audiobook again.") and listen.mismatch ("The read-along file does not fit this document." / "Die Mitlesedatei passt nicht …"). It uses the formal "Sie" of de.toml and the term "Mitlesedatei" de.toml already 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:

Introduction (made, file deleted) Methods Results (being made)
Before being generated generated being generated
After not generated generated being generated

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

Situation Before After
One MP3 deleted From the command line · Not started · Listen link 2 of 3 chapters ready · — · no link
Every MP3 deleted From the command line · Not started · Listen link Checked, no audio yet · — · no link
Every file deleted (and the folder moved: the same state) From the command line · Not started · Listen link Checked, no audio yet · — · no link
Only the read-along file deleted From the command line · Not started · Listen link Checked, no audio yet · — · no link
Stopped part-way, two chapters made, then one MP3, every MP3 or the read-along file deleted, or the folder moved From the command line · — · Listen link Checked, no audio yet · — · no link (as the web row in each state)
Whole From the command line · Not started · Listen link unchanged
Growing and playing (a conversion stopped part-way) From the command line · Not started · Listen link unchanged
Record can't be read From the command line · — · Listen link unchanged

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

Situation Before After
Chapters never chosen (the references), all others made "Some chapters' files are no longer in . Generate them again to listen to the audiobook." + references offered "The read-along file is no longer in . Make the audiobook again." + references offered (making them writes the read-along file again)
Every chapter made "The audiobook files are no longer in . Make the audiobook again." "The read-along file is no longer in . Make the audiobook again."
A command-line book "The audiobook files are no longer in . …" "The read-along file is no longer in . …"

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

Criterion Test
Deleting a made chapter's MP3 during a job that will not make it again shows that chapter as not generated on the Listen page and in the chapters API 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" in test_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_again and the values row "a chapter's MP3 gone before the running job reached it"
A command-line row whose MP3s are all gone shows no Listen link and the same state as a library row in that situation 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 trees
With only the read-along file gone, the message names the read-along file test_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 (with check_axe, light and dark)
The browser tests pass see Proof

Nothing is written, moved or deleted by showing any of this. told() and told_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_job gains settings and overwrite, which the "replace" case needs.

Decisions (where the brief leaves it open; recorded in docs/decisions/2026-12-03-1295.md)

  • Whether the running job will make a chapter is not read from the chapters the person asked for. It is the chapters the job's chapter record plans, less those the job reports made or taken as they are in this run (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.
  • Command-line rows are keyed on whether the book plays, not on whether it is finished.
    • A book that plays nothing, finished or stopped part-way, reads as a library row: "partly" while some chapters' files of a finished book are left, else "analysed". There is no link, because the Listen page is the only page such a book has and it would play nothing.
    • A book that plays, whole or growing, keeps today's row ("From the command line", Listen link, "Not started").
    • So does one whose record can't be read (web: a broken or other-version audio.json makes the API and the removal box say there is an audiobook #1529, out of scope).
  • The read-along message applies wherever the Listen page would name missing files. That includes every chapter being made, and a command-line book's Listen page.

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's passed={0, 1} and expects (NOT, GEN, COMING). Row gains passed (default empty), and the three table tests pass it to judge.
  • 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_row reads 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)

  • Library rows, shelf, Prepare, Listen and API in every other state: test_audiobook_told.py covers 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.
  • Command-line rows that play or can't be read: 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.
  • The chapter states of a growing book while its job runs, and of chapters being added: 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.py and test_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_again passed, as it should. The values table in test_audiobook_object.py failed on the new passed argument.

  • After: test_audiobook_told.py, test_audiobook_object.py, test_audiobook_four_answers.py and test_web_languages.py: 216 passed. test_web_add_chapters.py, test_web_listen_growing.py, test_web_library.py and test_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_gone failed 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.py and test_web_languages.py gave 220 passed. test_web_library.py, test_web_outside.py, test_cli_listen.py and test_review_tags.py gave 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, judge and app.Audiobook take 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 is Audiobooks, which passes it.
  • passed comes 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 no playable, 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.
  • A chapter the job took as it is at its start, then deleted before the job writes its record, now reads as not generated. The job takes it as it is and does not make it.
  • Command-line rows that play nothing have no title link. That includes one whose working folder holds no records at all (state "none"), which before kept its link. Their Listen page, which said why nothing plays, is still at its address but no longer linked from the library.

Closes #1295

🤖 Generated with Claude Code

Colin Meng and others added 3 commits December 3, 2026 02:40
…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>
@dubidu22

dubidu22 commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

Independent review (reviewer subagent that did not write the change), in two rounds; head c520496ed803a2663541e9db30ae4e02808a6349

Verdict: nothing left to fix.

Round 1 (head 5277fcb): 88 audiobook states (69 web, 19 command-line), old (cea25c7) against new in separate processes over 114 scenarios, 13,036 requests, 14 of them real jobs held while an MP3 was deleted. 96 answers differ, every one under point 1, 2 or 3; file trees after every request and file opens per request are the same.

  • Point 1 was true in every held case, checked against the files after the job ended: a deleted chapter the job has passed, or takes as it is, reads not generated and stays gone; a chapter a replace job is making or will make reads being generated and is written again. No chapter read not generated and was then made. passed is read once per request from the board read that gives running.
  • Point 3: the read-along message shows only when the read-along file alone is missing; not with an MP3 also gone, a broken or non-UTF-8 read-along, a growing book, or a moved folder (that message wins). Making the audiobook again with Replace speaks nothing and rewrites only the read-along file and the records.
  • Point 2: the 10 finished command-line states that play nothing get the web row's chip and no link. Finding: a conversion stopped part-way that plays nothing kept its Listen link.
  • The four decisions in the decisions file: agreed, with the boundary of the second corrected to plays.

Round 2 (this head): 23 command-line and 9 web states, 3,484 requests. The four stopped states now read as the web row with no link; rows that play and the unreadable record are unchanged; web rows and file trees show no difference. A command-line conversion stopped before its first chapter (no records) now also reads Checked, no audio yet with no link, as its Listen page says. The new test fails 4 of 4 on 5277fcb; 233 passed in the four files run.

Answers (lead session): the finding is fixed in this head (browser suite 292 passed, precheck 15335 passed). What lies outside this PR is #1640: a command-line row that plays nothing has no way to the page that says why, and the chapter list is empty when the only made chapter's file is deleted mid-job.

@dubidu22
dubidu22 merged commit 01bfdf0 into integration Dec 3, 2026
15 of 21 checks passed
@dubidu22
dubidu22 deleted the web/deleted-audiobook-files-shown-truthfully-1295 branch December 3, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant