Skip to content

Record why a finished Audible backup could not match its title - #561

Merged
KodeStar merged 9 commits into
mainfrom
burndown/br-migrations
Nov 22, 2026
Merged

KodeStar merged 9 commits into
mainfrom
burndown/br-migrations

Conversation

@KodeStar

Copy link
Copy Markdown
Owner

When a finished Audible backup can't be matched to its title, the server now stores why on the title, and the console explains it, instead of guessing from the job.

  • Migration 0093: fold_refusal_reason and fold_refused_at on the Audible title, written in the same transaction as the refused fold. Four reasons, each with plain console text in all six locales (it shows in place of "Backed up").
  • A refusal belongs to the title's latest backup: it clears when a later import or an accepted match succeeds, when the match really changes or "Not this book" is undone, when the title's next backup is queued, and when the library is deleted. A poll repeating the match and a book move keep it. Older titles keep today's wording.
  • Admin titles routes only (/admin/audible/titles); the Bridge's report is unchanged, and the player wire is untouched.

Part of KodeStar/audiosilo-bridge#47 ("Record a refused fold on the title"). Pairs with KodeStar/audiosilo-bridge (migration 0022, retried account removals) in the same cut.

Verified live with a Bridge built with the Audible fake, 12/12 console checks: each refusal sentence in en and the five other locales, kept across repeated polls and a folder rename, cleared when the next backup was queued; an upgrade of a data dir from 0092. Gate: build-admin, go build/vet/test -race/golangci-lint on the pure-Go and native SQLite engines.

Docs: KodeStar/audiosilo-docs (paired PR).

Migration 0093 stores the refused fold's reason code and time on the Audible title, in the same transaction as the refusal, and clears them when a later import or accepted match succeeds. The admin API returns them and the console explains each reason from the stored code instead of reading it from the job; older titles keep their wording. bridge#47 (record a refused fold on the title).
importOwnBook returned a reason string beside a sentinel error, and the
four stored codes were bare literals in the code and tests, so a typo
compiled and showed the console's generic text. A foldRefusal now
carries both (errors.Is still matches ErrImport*), the codes are
AudibleFold* constants, and the fold decodes params and result itself
so bridge.AudibleImportOf keeps its old contract. The clearing trigger
also watches match_library_id and match_path, as audible_title_match_update
does.

Part of KodeStar/audiosilo-bridge#47.
The row looked the reason up inline with an i18next fallback array, so
no list of the codes existed for a test to check. foldReasonKey maps the
four codes (a newer one reads as other) and a test asserts each has
English words, as the podcast codes do.

Part of KodeStar/audiosilo-bridge#47.
The clearing trigger fired whenever a write named the match columns,
and the poll upsert names them on every poll, so a refusal recorded on
a title a poll had already matched (a backup that joined that book) was
wiped by the next poll repeating the same match, or by a no-op undo of
Not this book. The trigger now clears only when the match changes or
rejected goes from 1 to 0, and a successful import clears the refusal
in its own UPDATE, since it may land on the path already matched.

Part of KodeStar/audiosilo-bridge#47.
The rejected_match sentence said the backup "found" the book, which
left the admin guessing; it now says the backup went into that book and
so was not matched, in all six languages. ReasonNote's doc comment is
back on ReasonNote.

Part of KodeStar/audiosilo-bridge#47.
A done Audible backup the server refused to match was logged as "recording a backup failed" although the refusal was stored on the title, sending an operator after a database fault that never happened. AudibleFoldRefusal reads the reason off the fold's error, and the log names it; a fold that could not run keeps the old message.

Part of bridge#47.
A book's move or join rewrites the title's match_path, which the 0093 trigger reads as a newly accepted match, so renaming the folder of a book a backup was refused for (not_own_book) dropped the console's explanation although the title still has the same book and nothing new was accepted. moveAudibleTitles reads the moved titles' refusals first and puts them back in the same transaction.

Part of bridge#47.
Deleting a library drops its matches and contests and cascades its jobs away, but a title whose backup into it was refused kept saying the server couldn't find the book in a library that no longer exists. DeleteLibrary clears the refusal on titles whose import job is that library's, in its own transaction, before the jobs go.

Part of bridge#47.
A refusal stayed until a later import or match, so a newer backup that failed or was cancelled showed the older refusal beside its own status, and a newer done job whose fold never ran had its "Backed up" hidden by the older job's reason. SetAudibleImportTx now clears the refusal in the transaction that queues the job, so a stored refusal is always the title's current backup's and the console speaks only for the latest backup.

Part of bridge#47.
@KodeStar
KodeStar merged commit 3843506 into main Nov 22, 2026
6 checks passed
@KodeStar
KodeStar deleted the burndown/br-migrations branch November 22, 2026 19:01
@github-project-automation github-project-automation Bot moved this to Backlog in AudioSilo Nov 22, 2026
@KodeStar KodeStar moved this from Backlog to Done in AudioSilo Nov 22, 2026
KodeStar added a commit to KodeStar/audiosilo-docs that referenced this pull request Nov 22, 2026
)

Recaptures admin/audible-titles.png through screenshots/run.sh so the
console's Audible titles list shows a title whose finished backup the
server refused to match (KodeStar/audiosilo-server#561), beside ordinary
rows.

- The capture stages the refusal through the Audible fake and removes
its staging book (with a rescan) when the step ends, so later shots in
the same run (Back up everything: 16 queued, 1 skipped) are unchanged.
- The manifest hint, caption and alt text describe the new image; the
refusal sentence links to the section on unmatched backups.

No PNG placed by hand; only this image changed.
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