Skip to content

Scope Audible job cleanup to the deleted person and guard disc backups - #563

Merged
KodeStar merged 9 commits into
mainfrom
burndown/srv-audible-jobs
Nov 22, 2026
Merged

KodeStar merged 9 commits into
mainfrom
burndown/srv-audible-jobs

Conversation

@KodeStar

Copy link
Copy Markdown
Owner

Follow-ups from server#294 (SRV-7 comment, items c1 to c4) and the BR-MIGRATIONS verify finding F1.

  • Deleting a person or household member cancels only their Audible polls, syncs and backups. The account ids are read before the cascade; a claimed backup gets cancel_requested. Other people's jobs are untouched.
  • Interrupted deletion: the Audible scheduler cancels jobs whose account no longer exists, at start and on its one-minute tick while the module is on. An idle sweep takes no writer and leaves the database generation alone.
  • Disc backups can't claim an unrelated book. Setting a folder to "Always one book" checks saved title destinations, account templates and open backups' placement in the same transaction. Changing a title destination, an account's library or its placement template checks the disc parent too. The template is rendered the way the Bridge renders it. Titles already matched are skipped, since they are never backed up again.
  • The refusal says why. 400 invalid_dest_path is kept, with an additive reason of indexed_book or book_override. The console translates both in six languages. The Bridge's PUT /bridge/audible/accounts/{account} can now answer this 400; the Bridge decodes it leniently.
  • Job-history pruning moves onto the job kinds' registration, inside the enqueue transaction, with the same rules as before.

No migration.

Verified live on a scratch server with a stand-in Bridge over HTTP: both refusal reasons on destinations, templates and folder overrides (console wording in en, de and pt), the open-backup hold until cancelled, re-map refusal and re-map past a matched title, scoped cancellation on person and member delete, the orphan sweep with the Bridge offline and an idle sweep with no writes, and per-account pruning over four cycles. The podcast half of pruning is covered by unit tests only.

Bridge follow-up (separate issue): joinedBooks misses a lone indexed sibling disc, so the Bridge can write a title's ASIN onto the merged book. This server change now refuses that match.

Source: v2.7.0 burn-down SRV-AUDIBLE-JOBS. Docs: audiosilo-docs PR to follow.

Deleting a person or household member now cancels only their Audible
polls, syncs and backups (account ids read before the cascade), and the
Audible scheduler cancels jobs left by an interrupted deletion at start
and on its tick. Setting a folder to one book checks saved Audible title
destinations, account templates and open backups' placement in the same
transaction, so a disc backup can no longer claim an unrelated book; the
refusal names its reason (indexed_book, book_override) in the console.
Job history pruning moves onto the job kinds' registration, run inside
the enqueue transaction.
The orphan sweep on the one-minute tick and the folder-override check walked every open job; both now seek the audible key range of idx_bridge_jobs_open. A remap checks its saved destinations in one statement, the disc refusal wording lives in one helper, and the import key's account part is built in one place. Part of #294.
The disc-folder check took a template's folders from the raw string, so
"Audible/CD 1/" named the disc folder itself as the parent: re-saving the
template or re-mapping the account was refused once that lone disc was
indexed, while a one-book override on the real parent went through. The
folders are now split, trimmed and sanitized as the Bridge's placement
renders them, and a file token with modifiers ({OriginalFilename:lower},
{Ext:upper}) names the file as it does there. The remap check also loses a
branch no caller reaches.

Part of #294.
The account PATCH and the Bridge's account PUT can now answer 400
invalid_dest_path; their docs, the console client's and the catalog's say
so. A failed cancel of a deleted person's jobs names the accounts again.

Part of #294.
The two new refusals said "Escolhe" where the rest of the locale says
"Escolha".

Part of #294.
EnqueueAll skips Enqueue's pruning, promotion, cancels and refusals; now
that pruning is a field on the kind, a batch kind gaining one would be
silently skipped.

Part of #294.
A title already on this server is never backed up again, yet its saved disc destination was checked against the library the Bridge maps the account to. A book override or an indexed book at that old disc parent in the new library refused the Bridge's PUT with invalid_dest_path, so the Bridge could not move the account. Only titles that can still be backed up (unmatched, or marked Not this book) are checked now.

Part of #294.
checkDestOwnFolder and the audible_disc_parent registration had no doc comment; every other SQL function registration names its arguments and purpose.

Part of #294.
@KodeStar
KodeStar merged commit 1ebcd12 into main Nov 22, 2026
6 checks passed
@KodeStar
KodeStar deleted the burndown/srv-audible-jobs branch November 22, 2026 21:43
KodeStar added a commit to KodeStar/audiosilo-docs that referenced this pull request Nov 22, 2026
…348)

Docs for KodeStar/audiosilo-server#563.

- Admin Audible page: both destination refusals (the folder is already a
book; the folder is set to "Always one book"), the hold while a backup
is waiting, running or needs attention, and how to resolve each. The
Libraries and Users pages link to these and say what deleting a person
cancels.
- API reference: the `reason` (`indexed_book`, `book_override`) on `400
invalid_dest_path` for the folder override, title destination, account
and Bridge account routes, in one "Audible disc destinations" section.
- Bridge developer pages: the server's orphan sweep and per-kind job
history ("Job history"); the Bridge itself is unchanged.

/admin and /bridge routes are not in the API changelog. No screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant