From 96cded35385e2a1488df0caae3599776cbd93588 Mon Sep 17 00:00:00 2001 From: KodeStar Date: Sun, 22 Nov 2026 18:14:27 +0000 Subject: [PATCH 1/4] Document Audible backup match refusals and account removal retries The console's four reasons a finished backup could not be matched to its title and when each goes away (server migration 0093), and how the Bridge retries removing an account from a server it couldn't reach (Bridge migration 0022): backoff, the answers that end it, the week cap and the fresh id on re-add. --- docs-developers/bridge/audible.md | 63 +++++++++++++------ docs-developers/bridge/development.md | 3 +- docs-developers/server/api/reference.md | 27 +++++++- docs-developers/server/data-model.md | 19 ++++-- docs-users/admin/audible.md | 34 ++++++++-- docs-users/getting-started/bridge-accounts.md | 14 ++++- 6 files changed, 124 insertions(+), 36 deletions(-) diff --git a/docs-developers/bridge/audible.md b/docs-developers/bridge/audible.md index 849cae87..96aa090e 100644 --- a/docs-developers/bridge/audible.md +++ b/docs-developers/bridge/audible.md @@ -66,10 +66,10 @@ app's own flow, and the admin pastes back the address where it ends: - seals the credentials as `audible_` and stores the row. If any step after the registration fails, the Bridge deregisters the new device - and puts back what it changed, best effort. A new account is DELETEd on the - server. An existing one's earlier sign-in goes back in the vault, and its - earlier mapping is PUT again. A failed sign-in leaves no device and the account - as it was. + and puts back what it changed, best effort. If it already asked the server + to map a new account, it records a pending removal and sends the DELETE. + For an existing account, it restores the earlier sign-in and sends the + earlier mapping again if that mapping was on the same server. The device is named `"'s AudioSilo"` in the Amazon account's device list (`audible.DeviceName`, decisions 14/16: "AudioSilo", not "Bridge"). The @@ -92,22 +92,42 @@ If the server omits it, the Bridge keeps its local value. The Accounts card labels this value **Last known to the Bridge**. A console edit reaches the card on the next mapping save. -**Remove** (page `DELETE /api/accounts/audible/{id}`, answering `{audible, -warning}`) runs to the end even if the page goes away. In order, it: +**Remove** (page `DELETE /api/accounts/audible/{id}`, answering `{audible, warning}`) +finishes even if the page closes. The Bridge takes these steps in order. + +1. Under `finishMu`, it forgets the sign-in in the vault and deletes the local + account row. For an account on the paired server, the same SQLite transaction + records the pending DELETE in `audible_removals` (migration `0022`). +2. It releases the lock and sends `DELETE /bridge/audible/accounts/{account}` + on that pairing. +3. It calls `audible.Deregister`, which refreshes an access token within two + minutes of expiry and asks Amazon to remove this device + (`POST /auth/deregister` with `deregister_all_existing_accounts: false`). + If the page warns about the device, the admin removes it in Amazon's device list. + +Each pending removal stores the old account ID, the pairing ID, the number of +failed attempts and the next retry time. After a successful heartbeat, the +Bridge drops rows from ended pairings and retries at most one due DELETE in the +background. Unpairing and pairing again gives a new pairing ID, even on the +same server. Adding the same Audible account again gives it a fresh account ID, +so a late DELETE can only remove the old entry. + +| DELETE outcome | What the Bridge does | +|---|---| +| Any `2xx` or `404` | Clears the pending removal. The server normally returns `204` even if the account is already gone. | +| Network failure, `401`, `408`, `429` or `5xx` | Keeps the removal for retry. A refused token still belongs to the same pairing. | +| Other `4xx`, such as `403` | Logs the refusal and drops the pending removal. The server may still list the account. | -1. forgets locally **first**: the vault, then the row (it takes `finishMu` - meanwhile); -2. DELETEs on the server; -3. deregisters (`audible.Deregister`: `POST /auth/deregister` with - `deregister_all_existing_accounts: false`, this device only). It first - refreshes an access token within 2 minutes of expiry. +The retry delay starts at one minute and doubles up to one hour. A longer +`Retry-After` takes precedence, up to 24 hours. On the 168th failed attempt, +the Bridge logs a warning and drops the removal. That takes about a week of +hourly failures. Failed heartbeats do not count toward the limit. -A server or Amazon failure is a `warning` for the page, never the account kept. -When the server's DELETE failed, the server keeps an orphaned account until an -admin removes it -([`DELETE /admin/audible/accounts/{account}`](../server/api/reference.md#delete-apiv1adminaudibleaccountsaccount)). -The admin does that from the console with **Remove** (see -[The console](#the-console) for which card lists it). +After a temporary failure, the page says the Bridge will try again. If the +Bridge is unpaired, paired to a different known server, or receives a permanent +refusal, the page says the server may still list the account. An admin can +remove an old entry with **Remove...** in the console. +See [the admin account DELETE](../server/api/reference.md#delete-apiv1adminaudibleaccountsaccount). **Refused.** A `401`/`403` on a signed call (`audible.IsRefused`) marks the account refused (`refused_at`, `last_error`; the page's **Sign in again**). The exception @@ -1062,8 +1082,11 @@ request. Where the Bridge finds preorders is in [Preorders](#preorders). into a folder book already there never makes that book (nor another title's) this title's match. Nor does it ever match the book the admin marked Not this book for the title. -3. It sets the match (`match_how = 'import'`) and clears `rejected` and - `import_pending`, only while `import_job_id` is still this job. +3. If the checks pass, it sets the match (`match_how = 'import'`) and clears + `rejected`, `import_pending` and any previous refusal. If it refuses the + result, it records the reason and time on the title and keeps the existing + match. An older job cannot overwrite a newer backup's outcome. + See the [admin title fields](../server/api/reference.md#get-apiv1adminaudibletitles). A later poll keeps an `import` match while its book is indexed and the poll names no other match for the title (`importMatches`). The poll may have listed the library diff --git a/docs-developers/bridge/development.md b/docs-developers/bridge/development.md index 80fe6b96..db288f57 100644 --- a/docs-developers/bridge/development.md +++ b/docs-developers/bridge/development.md @@ -110,7 +110,8 @@ internal/ store/ SQLite, append-only migrations (0001 the engine, 0002 server_jobs, 0003 generate_books, server_jobs.server_id, books.contrib_mode, 0004 workers, 0005 books.goal, 0006 accounts, 0007-0008 podcasts, - 0009-0012 and 0014 Audible, 0013 idx_books_unfinished: a partial + 0009-0012 and 0014 Audible, 0022 pending Audible account removals, + 0013 idx_books_unfinished: a partial index whose WHERE is unfinishedBook's word for word, so the periodic passes scan only the books the engine may act on) -- Phase 2b -- diff --git a/docs-developers/server/api/reference.md b/docs-developers/server/api/reference.md index b2c975a4..7272f01a 100644 --- a/docs-developers/server/api/reference.md +++ b/docs-developers/server/api/reference.md @@ -12489,10 +12489,32 @@ queued until the destination is corrected. A failed backup with `code: "exists"` | `dest_path` | the console's destination for the title's backup, `""` for the account's placement | | `import_job_id` | the title's latest backup job, `null` for none | | `import` | the title's backup: `{job_id, state, code}` with `state` the job's ([job states](#the-job-object)) and `code` a failed or parked job's code (`not_released`, `no_rights`, `audible_refused`, `not_writable`, `exists`, `disk_full`, `offline_url_expired`, `unknown_account`, `drm_free` (Audible offers the title only as a DRM-free MP3, which the Bridge doesn't back up yet), or `""`); `{job_id: null, state: "pending"}` for a Back up on a preorder waiting for its release; `null` for none | +| `fold_refusal_reason` | Optional string. The code below explains why the server could not use a completed backup as this title's match. | +| `fold_refused_at` | Optional string. The UTC time the server recorded the refusal, in RFC 3339 format with up to nine fractional digits. | | `needs_attention` | a preorder still not available 14 days after its `release_date`: the account is no longer polled hourly for it | | `planned` | where a backup would go, as the Bridge planned it at its last poll (the object the [titles PUT](#put-apiv1bridgeaudibleaccountsaccounttitles) takes); `null` when matched, not planned, or the account is no longer mapped to the plan's library (paused or mapped again: none until its next poll) | | `contested` | for a title left unmatched as `contested`, `{library_id, path, with: [{asin, title}]}`: the book it tied for and the account's other titles (not `gone`) contested over that book or matched to it, by title, at most 10; `null` otherwise, or while the account isn't mapped to that library | +The titles list and the [title PATCH](#patch-apiv1adminaudibletitlesaccountasin) +return both refusal fields on the title itself. Both are omitted when the title +has no recorded refusal. The backup job can still be `done`. + +| `fold_refusal_reason` | Why the server refused the match | +|---|---| +| `invalid_result` | The server could not read the backup result, or it named the wrong library or lacked a usable book path. | +| `not_indexed` | The server found no indexed book at that path in the backup's books library. | +| `not_own_book` | The indexed book's ASIN did not match the title's, and the server could not verify that the book contained only files placed by this backup. | +| `rejected_match` | The book at that path was marked **Not this book** for this title. | + +The server clears both fields when it queues the title's next backup or +successfully matches a completed import. A poll that adds or changes the +accepted match also clears them, as does undoing **Not this book** on an +existing match. A poll that repeats the same match and a move of the matched +book both preserve the refusal. + +Removing the finished job alone preserves the refusal on the title. Deleting a +library clears refusals whose backup jobs belong to that library. + | Status | Meaning | |---|---| | `200` | `{ titles, next }` | @@ -12578,7 +12600,8 @@ out is left as it is: ``` - `rejected` `true` marks the title "Not this book" (and drops a pending preorder - request); `false` clears it. A done backup clears it too. + request). `false` clears the mark. A completed backup clears it when the + server accepts the book as the title's match. - `dest_path` is where in the account's library its backup goes, `""` for the account's placement: a file path, or a folder (a last segment without an audio extension) the title's file goes in. At most 1024 bytes, clean (no `..`, no @@ -12598,7 +12621,7 @@ logged and the next scheduled sync carries the change. | Status | Meaning | |---|---| -| `200` | the [title](#get-apiv1adminaudibletitles) (not wrapped) | +| `200` | The [title](#get-apiv1adminaudibletitles) directly, including `fold_refusal_reason` and `fold_refused_at` if a refusal still applies after the edit. | | `400` | `invalid_request` - the JSON (an unknown field too); `invalid_dest_path` - with what is wrong in `error` | | `404` | `unknown_account`; `unknown_title`; `module_off` | diff --git a/docs-developers/server/data-model.md b/docs-developers/server/data-model.md index 4025051a..2cbada3e 100644 --- a/docs-developers/server/data-model.md +++ b/docs-developers/server/data-model.md @@ -1691,8 +1691,8 @@ Pairing a new Bridge clears the status, and unpairing deletes the row. Migration `0063` adds the Bridge's Audible accounts ([Audible](../bridge/audible.md)). The credentials stay in the Bridge's vault. -These tables hold only what the Bridge reports. Later migrations added -columns, listed after the tables. +The server keeps the account mapping, the titles the Bridge reports and the +outcomes of backups and matches. **`audible_accounts`** *(0063; `template` and `policy_since` in 0064; `sync_queued_at`, `last_sync_at` and `refused_at` in 0066; `refusal_ended_at` @@ -1725,8 +1725,9 @@ in 0071)*: Mapping the account to another person turns `sync` off and clears `sync_queued_at` and `last_sync_at`. -**`audible_titles`** *(0063; `import_pending` in 0064; `planned`, -`contest_library_id` and `contest_path` in 0065; `no_sync` in 0066)*: +**`audible_titles`** (0063) gained `import_pending` in 0064, `planned`, +`contest_library_id` and `contest_path` in 0065, `no_sync` in 0066 and the +backup refusal fields in 0093. - `account` (FK `ON DELETE CASCADE`) + `asin`. - `title`, `authors` and `series` (JSON), `release_date`, `runtime_s`. @@ -1752,6 +1753,10 @@ Mapping the account to another person turns `sync` off and clears a stored match clears them. - `no_sync`: the console's "Don't sync this book". A poll keeps it, like `rejected` and `ignored`. Only the sync reads it; backups never do. +- `fold_refusal_reason TEXT NOT NULL DEFAULT ''` and `fold_refused_at TEXT` + store the code and UTC timestamp when the server refuses a completed backup + as the title's match. Existing rows start with an empty reason and a NULL + timestamp. See the [admin title fields and codes](api/reference.md#get-apiv1adminaudibletitles). The titles are indexed by match, by title, and by account then title (the console's orders). @@ -1779,6 +1784,11 @@ What each later migration did: trigger. A `preorder` title then takes no part in its account's sync, like a `gone` one, and a preorder becoming available offers its book's place to Audible again. It adds `refusal_ended_at`. +- `0093_audible_fold_refusal` adds the refusal columns and a trigger that + clears them when the title gains a new accepted match or an admin accepts a + previously rejected match. A repeated match or a move of the same book + preserves them. Queueing the title's next backup, successfully matching an + import, or deleting the library that owns the backup job clears them. ### Podcasts @@ -2573,6 +2583,7 @@ The migration history so far: | 0090 | `chapter_basis_match` | Includes the recorded work and recording in the basis for a community chapter check. | | 0091 | `mp3_rev2_tag_read_failed` | Advances current revision 1 rows for books without an MP3 to revision 2. The next scan [re-indexes MP3 books once](scanner.md#the-first-scan-after-updating). Adds the nullable `books.tag_read_failed_at` timestamp. | | 0092 | `health_ignores` | Stores duplicate decisions per comparison and split-disc ignores per folder. Carries forward [existing Health ignores](#health-ignores). | +| 0093 | `audible_fold_refusal` | Records why and when the server refused to match a completed backup on the [Audible title](#audible-accounts-and-titles). | `server_state.progress_feed` identifies the Audible progress feed. A restore renews this ID before clients can page it. The separate data-folder mark detects a database restored behind the last diff --git a/docs-users/admin/audible.md b/docs-users/admin/audible.md index 4bd8a883..27bec24a 100644 --- a/docs-users/admin/audible.md +++ b/docs-users/admin/audible.md @@ -122,8 +122,8 @@ it matched. **Back up everything** and **Back up by itself** skip it. Then: 3. Press **Back up**. The Bridge downloads the book, removes its copy protection and saves it in your -library. Once the server indexes it, the title shows **On this server** with -**Backed up here**. +library. Once the server matches the saved book to the title, the title shows +**On this server** with **Backed up here**. The Bridge backs up one book at a time. A download cut off part way picks up where it stopped. Once the copy protection is removed, the Bridge keeps @@ -135,6 +135,24 @@ This removes the temporary copy. A failed backup keeps its copy in the Bridge's data folder until you back the title up again. When it starts, the Bridge also clears away copies left over for seven days or more. +### When the server can't match a finished backup + +The Bridge can finish saving the files even if the server can't match them +to the Audible title. The message under the title explains why. + +- The server couldn't use the backup details to match this title to a book in its library. +- The server couldn't find the backed-up book in the library index. +- The server couldn't confirm that the book at the backup destination belongs to this title. +- The backup went into the book marked “Not this book” for this title, so the server didn't match it. + +All four messages clear as soon as the server queues the title's next backup. +They also clear when the server matches a finished backup or a check finds a new +match. If you marked the right book by mistake, **Undo Not this book** accepts +that match and clears the message. + +Checking again with the same match or moving the matched book keeps the message. +Deleting the library where the backup went clears it. + ### When a backup fails The reason under the title says what to do. After fixing the problem, press @@ -314,13 +332,17 @@ titles update once the check finishes. ## Removing an account -Remove an account on the Bridge's Accounts tab (see -[Bridge accounts](../getting-started/bridge-accounts.md#removing-an-account)). That -removes it everywhere, including from your Amazon device list. +Remove the account on the Bridge's **Accounts** tab. The Bridge forgets the +sign-in, asks the paired server to remove the account and asks Amazon to remove +the AudioSilo device. + +If the paired server is offline, leave the Bridge paired. It retries the removal +on its own once the server responds. If the Bridge warns about the Amazon device, remove it +in Amazon's device list. See [Removing an account on the Bridge](../getting-started/bridge-accounts.md#removing-an-account). **Remove...** in the console is for an account the Bridge can no longer remove, such as one from a Bridge you replaced. It removes the account from **this server -only**, so also remove the device in your Amazon account. Any check, backup or +only**. If the device is still listed on Amazon, remove it there too. Any check, backup or sync that hasn't finished is cancelled. Books already on your server stay. If your Bridge still has the account, its checks fail until you map it again on the Bridge. diff --git a/docs-users/getting-started/bridge-accounts.md b/docs-users/getting-started/bridge-accounts.md index 82b17a92..18d7da19 100644 --- a/docs-users/getting-started/bridge-accounts.md +++ b/docs-users/getting-started/bridge-accounts.md @@ -144,9 +144,17 @@ off. You can turn it on in the console. Changing the person turns it off again. ### Removing an account -**Remove**, then **Remove the account**, removes it everywhere: from the Bridge, -from the server and from your Amazon device list. Books already in your library -stay. If the server or Amazon can't be reached, the card says what didn't happen. +On the Audible card, choose **Remove**, then **Remove the account**. The Bridge +forgets the sign-in immediately. Books already in your library stay. + +If the paired server is offline, the card says the Bridge will try again. +Leave the Bridge paired and it will retry on its own once the server responds. +If the card says the server may still list the account, check the console. +Use **Remove...** there for an old account the Bridge can no longer remove. +See [Removing an account from the server](../admin/audible.md#removing-an-account). + +The Bridge also asks Amazon to remove the AudioSilo device. If the card warns +about the device, remove it yourself in Amazon's device list. Backing up is for a personal backup of books you bought. Read the note at the top of [Back up your Audible books](../admin/audible.md) first. From 545815ef7c8bdf5cce152b4aed7e10e5a9210a88 Mon Sep 17 00:00:00 2001 From: KodeStar Date: Sun, 22 Nov 2026 18:17:33 +0000 Subject: [PATCH 2/4] Say each Audible refusal and removal rule in one place The account removal steps were on both user pages, and the refusal clearing rules were on three developer pages in different words. The Bridge account page and the admin title fields now hold them, and the others link there. The console's admin DELETE and web-ui pages no longer send an admin to Remove for a removal the Bridge now retries. --- docs-developers/bridge/audible.md | 9 ++++---- docs-developers/bridge/development.md | 3 +-- docs-developers/server/api/reference.md | 12 +++++----- docs-developers/server/data-model.md | 12 ++++------ docs-developers/server/web-ui.md | 2 +- docs-users/admin/audible.md | 23 ++++++++----------- docs-users/getting-started/bridge-accounts.md | 7 +++--- 7 files changed, 30 insertions(+), 38 deletions(-) diff --git a/docs-developers/bridge/audible.md b/docs-developers/bridge/audible.md index 96aa090e..5c2e0326 100644 --- a/docs-developers/bridge/audible.md +++ b/docs-developers/bridge/audible.md @@ -1,6 +1,6 @@ --- title: Audible -description: "Audible accounts on the Bridge (the paste-back PKCE sign-in, device registration and deregistration, the vault), the audible.poll job and its matching rules, preorders from the orders and the catalog (remembered, Bridge 0012), the audible.import backup (params, steps, result and codes, resume and temp files, the hardened transfer, enrichment, secrets), the server's accounts and titles (0063, 0064, 0065), its queueing (priorities, policy_since, preorders, the done fold) and the audible module, the console, and the build-tagged Audible fake; the current device profile (Bridge 0010), redacted account ids, contests settled by series number and planned destinations; position sync both ways (audible.sync, the push loop, furthest only, the two Bridge routes, server 0066 and 0085, and Bridge 0011)." +description: "Audible accounts on the Bridge (the paste-back PKCE sign-in, device registration and deregistration, the vault), the audible.poll job and its matching rules, preorders from the orders and the catalog (remembered, Bridge 0012), the audible.import backup (params, steps, result and codes, resume and temp files, the hardened transfer, enrichment, secrets), the server's accounts and titles (0063, 0064, 0065, and 0093's backup refusals), its queueing (priorities, policy_since, preorders, the done fold) and the audible module, the console, and the build-tagged Audible fake; the current device profile (Bridge 0010), redacted account ids, owed account removals (Bridge 0022), contests settled by series number and planned destinations; position sync both ways (audible.sync, the push loop, furthest only, the two Bridge routes, server 0066 and 0085, and Bridge 0011)." --- The Bridge does three things with Audible accounts: @@ -30,7 +30,7 @@ probe and OpenAudible sources were not imported. | Where | What | |---|---| | The Bridge's vault | each account's sign-in, sealed as `audible_` (`secrets.AudibleName`): the access, refresh and adp tokens, the device's RSA key, its serial, the customer id and marketplace (`audible.Credentials.Marshal`). **Full Amazon account access**, so never anywhere else | -| The Bridge's `bridge.db` | `audible_accounts` (migration `0009`): `id`, `label`, `marketplace`, `customer_hash` (sha256 of the customer id, never the id), `server_id` (the server the mapping was last recorded on), `user_id`/`user_name`, `library_id`, `policy`, `sync` (sent to the server, which ignores it), `created_at`, `last_ok_at`, `last_poll_at`, `last_titles`, `last_matched`, `refused_at`, `last_error`, `device_profile` (migration `0010`, [below](#the-device-profile)), and the push and sync health columns and `refusal_kind` with the `audible_push` table (migration `0011`, [below](#bridge-migration-0011_audible_push)). The remembered pending preorders: `audible_preorders` (migration `0012`, [below](#preorders)). Unique on `(customer_hash, marketplace)` where the hash isn't empty. No credential | +| The Bridge's `bridge.db` | `audible_accounts` (migration `0009`): `id`, `label`, `marketplace`, `customer_hash` (sha256 of the customer id, never the id), `server_id` (the server the mapping was last recorded on), `user_id`/`user_name`, `library_id`, `policy`, `sync` (sent to the server, which ignores it), `created_at`, `last_ok_at`, `last_poll_at`, `last_titles`, `last_matched`, `refused_at`, `last_error`, `device_profile` (migration `0010`, [below](#the-device-profile)), and the push and sync health columns and `refusal_kind` with the `audible_push` table (migration `0011`, [below](#bridge-migration-0011_audible_push)). The remembered pending preorders: `audible_preorders` (migration `0012`, [below](#preorders)). The owed server removals: `audible_removals` (migration `0022`, under Remove below). Unique on `(customer_hash, marketplace)` where the hash isn't empty. No credential | | The server | the mapping and the titles (`0063`, `0064`, `0065`, `0066`, below), the poll and sync schedules, what to back up and when, and whether an account's places sync. It never talks to Audible and never holds a credential or a book's key | No credential reaches the store, job params or results, logs, the heartbeat or the @@ -114,7 +114,7 @@ so a late DELETE can only remove the old entry. | DELETE outcome | What the Bridge does | |---|---| -| Any `2xx` or `404` | Clears the pending removal. The server normally returns `204` even if the account is already gone. | +| Any `2xx` or `404` | Clears the pending removal. The server answers `204` whether or not it knew the account ([the Bridge DELETE](../server/api/reference.md#delete-apiv1bridgeaudibleaccountsaccount)). | | Network failure, `401`, `408`, `429` or `5xx` | Keeps the removal for retry. A refused token still belongs to the same pairing. | | Other `4xx`, such as `403` | Logs the refusal and drops the pending removal. The server may still list the account. | @@ -1588,7 +1588,8 @@ The server keeps two tables. The columns are in the `last_queued_at`, `template` and `policy_since`. - **`audible_titles`**: one row per account and ASIN, with its state and match, plus the console's and an import's columns: `rejected`, `ignored`, `dest_path`, - `import_job_id` and `import_pending`, which a titles PUT never overwrites. + `import_job_id`, `import_pending` and the refusal pair `fold_refusal_reason` and + `fold_refused_at` (`0093`), which a titles PUT never overwrites. `ignored` has no route that sets it yet. Back up everything, the policy pass and the preorder clock skip an ignored title. Migration `0066` adds `sync_queued_at`, diff --git a/docs-developers/bridge/development.md b/docs-developers/bridge/development.md index db288f57..e41e1931 100644 --- a/docs-developers/bridge/development.md +++ b/docs-developers/bridge/development.md @@ -110,8 +110,7 @@ internal/ store/ SQLite, append-only migrations (0001 the engine, 0002 server_jobs, 0003 generate_books, server_jobs.server_id, books.contrib_mode, 0004 workers, 0005 books.goal, 0006 accounts, 0007-0008 podcasts, - 0009-0012 and 0014 Audible, 0022 pending Audible account removals, - 0013 idx_books_unfinished: a partial + 0009-0012, 0014 and 0022 Audible, 0013 idx_books_unfinished: a partial index whose WHERE is unfinishedBook's word for word, so the periodic passes scan only the books the engine may act on) -- Phase 2b -- diff --git a/docs-developers/server/api/reference.md b/docs-developers/server/api/reference.md index 7272f01a..c1d738b2 100644 --- a/docs-developers/server/api/reference.md +++ b/docs-developers/server/api/reference.md @@ -12495,9 +12495,9 @@ queued until the destination is corrected. A failed backup with `code: "exists"` | `planned` | where a backup would go, as the Bridge planned it at its last poll (the object the [titles PUT](#put-apiv1bridgeaudibleaccountsaccounttitles) takes); `null` when matched, not planned, or the account is no longer mapped to the plan's library (paused or mapped again: none until its next poll) | | `contested` | for a title left unmatched as `contested`, `{library_id, path, with: [{asin, title}]}`: the book it tied for and the account's other titles (not `gone`) contested over that book or matched to it, by title, at most 10; `null` otherwise, or while the account isn't mapped to that library | -The titles list and the [title PATCH](#patch-apiv1adminaudibletitlesaccountasin) -return both refusal fields on the title itself. Both are omitted when the title -has no recorded refusal. The backup job can still be `done`. +Both refusal fields are omitted when the title has no recorded refusal, in the +list and in the [title PATCH](#patch-apiv1adminaudibletitlesaccountasin)'s +answer. The backup job itself can still be `done`. | `fold_refusal_reason` | Why the server refused the match | |---|---| @@ -12621,7 +12621,7 @@ logged and the next scheduled sync carries the change. | Status | Meaning | |---|---| -| `200` | The [title](#get-apiv1adminaudibletitles) directly, including `fold_refusal_reason` and `fold_refused_at` if a refusal still applies after the edit. | +| `200` | the [title](#get-apiv1adminaudibletitles) (not wrapped) | | `400` | `invalid_request` - the JSON (an unknown field too); `invalid_dest_path` - with what is wrong in `error` | | `404` | `unknown_account`; `unknown_title`; `module_off` | @@ -12861,8 +12861,8 @@ clock too, so the Bridge counts its baseline's recent window back from ### `DELETE /api/v1/admin/audible/accounts/{account}` *Admin*, **not** behind the module's toggle. Removes an account the Bridge can no -longer remove (one from a Bridge since unpaired or replaced, or whose removal on the -Bridge couldn't reach the server), exactly as the Bridge's delete does: its titles +longer remove (one from a Bridge since unpaired or replaced, or whose removal the +Bridge [gave up on](../../bridge/audible.md#the-sign-in-internalaudibleacct)), exactly as the Bridge's delete does: its titles go, its open poll and sync are cancelled, and so are its open backups. It signs nothing out of Amazon: that is the Bridge's. `204`, known or not; audited as `bridge.audible.remove` when there was one, its target the account's name (its label, else "person diff --git a/docs-developers/server/data-model.md b/docs-developers/server/data-model.md index 2cbada3e..d4f6f4db 100644 --- a/docs-developers/server/data-model.md +++ b/docs-developers/server/data-model.md @@ -1725,9 +1725,9 @@ in 0071)*: Mapping the account to another person turns `sync` off and clears `sync_queued_at` and `last_sync_at`. -**`audible_titles`** (0063) gained `import_pending` in 0064, `planned`, -`contest_library_id` and `contest_path` in 0065, `no_sync` in 0066 and the -backup refusal fields in 0093. +**`audible_titles`** *(0063; `import_pending` in 0064; `planned`, +`contest_library_id` and `contest_path` in 0065; `no_sync` in 0066; +`fold_refusal_reason` and `fold_refused_at` in 0093)*: - `account` (FK `ON DELETE CASCADE`) + `asin`. - `title`, `authors` and `series` (JSON), `release_date`, `runtime_s`. @@ -1785,10 +1785,8 @@ What each later migration did: `gone` one, and a preorder becoming available offers its book's place to Audible again. It adds `refusal_ended_at`. - `0093_audible_fold_refusal` adds the refusal columns and a trigger that - clears them when the title gains a new accepted match or an admin accepts a - previously rejected match. A repeated match or a move of the same book - preserves them. Queueing the title's next backup, successfully matching an - import, or deleting the library that owns the backup job clears them. + clears them on a newly accepted match. Every case that clears or keeps them + is under the [admin title fields](api/reference.md#get-apiv1adminaudibletitles). ### Podcasts diff --git a/docs-developers/server/web-ui.md b/docs-developers/server/web-ui.md index f21e3bad..f2e586bb 100644 --- a/docs-developers/server/web-ui.md +++ b/docs-developers/server/web-ui.md @@ -1697,7 +1697,7 @@ While the `audible` module is on, an **Audible accounts** card (`features/audible/audible-accounts-card.tsx`) sits under Libraries, in the paired view only (`Paired` in `bridge-topic.tsx`). With no Bridge paired, **Remove** on Server > Settings > Audible is the console's way to clear an -orphaned account. +account the Bridge can no longer remove. The card runs on [`GET /admin/audible/accounts`](api/reference.md#get-apiv1adminaudibleaccounts), diff --git a/docs-users/admin/audible.md b/docs-users/admin/audible.md index 27bec24a..03007879 100644 --- a/docs-users/admin/audible.md +++ b/docs-users/admin/audible.md @@ -145,13 +145,11 @@ to the Audible title. The message under the title explains why. - The server couldn't confirm that the book at the backup destination belongs to this title. - The backup went into the book marked “Not this book” for this title, so the server didn't match it. -All four messages clear as soon as the server queues the title's next backup. -They also clear when the server matches a finished backup or a check finds a new -match. If you marked the right book by mistake, **Undo Not this book** accepts -that match and clears the message. - -Checking again with the same match or moving the matched book keeps the message. -Deleting the library where the backup went clears it. +The message clears when you back the title up again, when a backup or a check +matches the title to a book, or when you delete the library the backup went +into. If you marked the right book by mistake, **Undo Not this book** accepts +that match and clears the message. A check that finds the same match, or moving +the matched book, keeps it. ### When a backup fails @@ -332,13 +330,10 @@ titles update once the check finishes. ## Removing an account -Remove the account on the Bridge's **Accounts** tab. The Bridge forgets the -sign-in, asks the paired server to remove the account and asks Amazon to remove -the AudioSilo device. - -If the paired server is offline, leave the Bridge paired. It retries the removal -on its own once the server responds. If the Bridge warns about the Amazon device, remove it -in Amazon's device list. See [Removing an account on the Bridge](../getting-started/bridge-accounts.md#removing-an-account). +Remove the account on the Bridge's **Accounts** tab (see +[Bridge accounts](../getting-started/bridge-accounts.md#removing-an-account)). That +removes it from the Bridge, this server and your Amazon device list, and says +what to do if one of them can't be reached. **Remove...** in the console is for an account the Bridge can no longer remove, such as one from a Bridge you replaced. It removes the account from **this server diff --git a/docs-users/getting-started/bridge-accounts.md b/docs-users/getting-started/bridge-accounts.md index 18d7da19..ba3c019c 100644 --- a/docs-users/getting-started/bridge-accounts.md +++ b/docs-users/getting-started/bridge-accounts.md @@ -148,10 +148,9 @@ On the Audible card, choose **Remove**, then **Remove the account**. The Bridge forgets the sign-in immediately. Books already in your library stay. If the paired server is offline, the card says the Bridge will try again. -Leave the Bridge paired and it will retry on its own once the server responds. -If the card says the server may still list the account, check the console. -Use **Remove...** there for an old account the Bridge can no longer remove. -See [Removing an account from the server](../admin/audible.md#removing-an-account). +Leave the Bridge paired until it does. If the card says the server may still +list the account, remove it with **Remove...** in the console (see +[Removing an account](../admin/audible.md#removing-an-account)). The Bridge also asks Amazon to remove the AudioSilo device. If the card warns about the device, remove it yourself in Amazon's device list. From 5d251440601edc270dfccd7df27bb678c6372ac4 Mon Sep 17 00:00:00 2001 From: KodeStar Date: Sun, 22 Nov 2026 18:23:05 +0000 Subject: [PATCH 3/4] Say when the Bridge stops retrying an Audible account removal The card's "will try again" read as open-ended. An unpair, or a week of refusals, ends the retries and leaves the account on the server, so the page now points to the console's Remove... for that case. --- docs-users/getting-started/bridge-accounts.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs-users/getting-started/bridge-accounts.md b/docs-users/getting-started/bridge-accounts.md index ba3c019c..e74d4ca3 100644 --- a/docs-users/getting-started/bridge-accounts.md +++ b/docs-users/getting-started/bridge-accounts.md @@ -148,8 +148,10 @@ On the Audible card, choose **Remove**, then **Remove the account**. The Bridge forgets the sign-in immediately. Books already in your library stay. If the paired server is offline, the card says the Bridge will try again. -Leave the Bridge paired until it does. If the card says the server may still -list the account, remove it with **Remove...** in the console (see +Leave the Bridge paired until it does. If you unpair first, or the server +still hasn't accepted the removal after about a week, the Bridge stops trying. +If the card says the server may still list the account, or the console still +lists it after that, remove it with **Remove...** in the console (see [Removing an account](../admin/audible.md#removing-an-account)). The Bridge also asks Amazon to remove the AudioSilo device. If the card warns From dc203c9fad5714876f408a76b53ceb30bffae7ee Mon Sep 17 00:00:00 2001 From: KodeStar Date: Sun, 22 Nov 2026 18:23:05 +0000 Subject: [PATCH 4/4] Name the stored refusal codes and the console's refusal note The done fold listed only its errors, so ErrImportNotIndexed read as not_indexed when a wrong-library result is stored as invalid_result. The console pages now show the refusal note in place of Backed up, the pairing rule notes that a same-server re-pair after a refused token keeps the owed removals, and the Bridge's Audible migrations list is complete. --- docs-developers/bridge/audible.md | 18 ++++++++++++------ docs-developers/bridge/development.md | 3 ++- docs-developers/server/web-ui.md | 5 ++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs-developers/bridge/audible.md b/docs-developers/bridge/audible.md index 5c2e0326..ee1feb18 100644 --- a/docs-developers/bridge/audible.md +++ b/docs-developers/bridge/audible.md @@ -109,8 +109,10 @@ Each pending removal stores the old account ID, the pairing ID, the number of failed attempts and the next retry time. After a successful heartbeat, the Bridge drops rows from ended pairings and retries at most one due DELETE in the background. Unpairing and pairing again gives a new pairing ID, even on the -same server. Adding the same Audible account again gives it a fresh account ID, -so a late DELETE can only remove the old entry. +same server. Pairing again with the same server after its token was refused, +with no unpair between, keeps the pairing ID and its pending removals. Adding +the same Audible account again gives it a fresh account ID, so a late DELETE +can only remove the old entry. | DELETE outcome | What the Bridge does | |---|---| @@ -1074,11 +1076,13 @@ request. Where the Bridge finds preorders is in [Preorders](#preorders). `FoldAudibleImport` runs from the jobs' `OnEnded` hook for a done `audible.import`: 1. The result must name the job's library (and the params' library) and a clean - book path, else `ErrImportNotIndexed`. + book path, else `ErrImportNotIndexed` (stored as `invalid_result`, as is an + unreadable result). 2. `importOwnBook` checks the book. It must be indexed in a books library, else - `ErrImportNotIndexed`. It must be the **title's own**, else `ErrImportNotOwn` - (logged). The title's own book carries the title's ASIN, or holds **only** the - files the backup placed (a single-file book is its file). A file the scan joined + `ErrImportNotIndexed` (`not_indexed`). It must be the **title's own**, else + `ErrImportNotOwn` (logged; `not_own_book`, or `rejected_match` for the book + marked Not this book). The title's own book carries the title's ASIN, or holds + **only** the files the backup placed (a single-file book is its file). A file the scan joined into a folder book already there never makes that book (nor another title's) this title's match. Nor does it ever match the book the admin marked Not this book for the title. @@ -1659,6 +1663,8 @@ The code is in `features/audible/`. and **Destination...** (`title-actions.tsx`); - the import's state and code (`importStatus`). The loaded titles are fetched again every 5 s while a backup is queued or running (`backupRunning`); +- a done backup's refusal (`fold_refusal_reason`, `FoldNote`) in place of + **Backed up**; - **Backed up here** for an `import` match; - **Don't sync** / **Sync again**, with a **Not synced** badge. diff --git a/docs-developers/bridge/development.md b/docs-developers/bridge/development.md index e41e1931..5b644d19 100644 --- a/docs-developers/bridge/development.md +++ b/docs-developers/bridge/development.md @@ -110,7 +110,8 @@ internal/ store/ SQLite, append-only migrations (0001 the engine, 0002 server_jobs, 0003 generate_books, server_jobs.server_id, books.contrib_mode, 0004 workers, 0005 books.goal, 0006 accounts, 0007-0008 podcasts, - 0009-0012, 0014 and 0022 Audible, 0013 idx_books_unfinished: a partial + 0009-0012, 0014, 0017-0018, 0020 and 0022 Audible, + 0013 idx_books_unfinished: a partial index whose WHERE is unfinishedBook's word for word, so the periodic passes scan only the books the engine may act on) -- Phase 2b -- diff --git a/docs-developers/server/web-ui.md b/docs-developers/server/web-ui.md index f2e586bb..521b0d3e 100644 --- a/docs-developers/server/web-ui.md +++ b/docs-developers/server/web-ui.md @@ -1738,7 +1738,10 @@ one), state, and on this server. The legal line sits under the filters. - **Matched by title** for a `fuzzy` match, **Backed up here** for an `import` one, **Not this book** for a rejected title, and **Not synced** for a `no_sync` one; -- the backup's state and code (`importStatus`, `audible.code.`). +- the backup's state and code (`importStatus`, `audible.code.`); +- for a done backup the server refused as the title's match, the stored + reason in place of **Backed up** (`FoldNote`, `foldReasonKey`: + `audible.fold.`, `audible.fold.other` for a code it doesn't know). **Per-title actions** (`title-actions.tsx`):