Skip to content

fix: configure the requested format's author settings before searching - #4

Merged
elbrielle merged 3 commits into
mainfrom
chaptarr-cross-format-settings
Aug 30, 2026
Merged

elbrielle merged 3 commits into
mainfrom
chaptarr-cross-format-settings

Conversation

@elbrielle

Copy link
Copy Markdown
Owner

What

Chaptarr initializes author settings one format per add — by design, not a bug. AddBookService.cs:492-501 sets CreateAudiobook/CreateEbook from the single requested mediaType, and every per-format assignment in AuthorLibraryService.cs:1700-1780 is gated on those flags. The nested author's sibling-format settings are accepted on the wire and discarded.

An unconfigured format is a disabled format: ReleaseSearchService.cs:106-113 returns zero decisions when the author has no quality profile for that media type, and RefreshAuthorService.cs:697-704 excludes its remote books and prunes unpinned local rows.

So a request for an author's second format could report success and queue a BookSearch that could never return a release. Every monitor and edition read-back still passed — the state is invisible to all of them.

Found after the first production run of 4.6.1-chaptarr.1; the published build has both defects below. Neither is a regression from the Clojure bot and neither affects single-format use, which is all the 2026-08-28 canary exercised.

Changes

The author gate write configures the format. It now fills any missing quality profile, metadata profile, or root folder for the requested format and verifies all three on the read-back, failing closed. Fill-only, mirroring the server's own progressive semantics — a profile already on the author was chosen deliberately and outranks config. The write stays a full GET→mutate→PUT round-trip because Author.cs:329-330 copies both root paths unconditionally, so a partial body would wipe the other format.

Add bodies carry only the requested format's root. The server's progressive fill collapses both roots into one audiobook-preferring parameter (AuthorLibraryService.cs:1136-1137 → AuthorService.cs:714,751), so a body carrying both wrote the audiobook path into an unset EbookRootFolderPath. Applied to both bodies: an add for an author the server already has reaches that fill whatever the client believed.

The canary can now gate this. verify_request never read a profile or root field, so checklist case 13 was not actually runnable. It now asserts the requested format is configured and the other format's settings are unchanged.

Docs. New COMPATIBILITY.md section with verified v0.9.936 citations; safe-sequence steps 5 and 9 amended; mutation case 13 (both directions, author-record assertions) and an open prove-live section in RELEASE_CHECKLIST.md; upstream-issue draft for the root collapse; known-issue note on the 4.6.1-chaptarr.1 promotion record.

Testing

Test-driven — each test written and watched fail before the code. requested_format_settings_that_do_not_persist_fail_closed returned Ok against the old code, which is the vacuous success reproduced. The end-to-end test was separately verified to fail with the fill disabled, so it is not a test that merely passes alongside the fix.

Fifteen existing integration fixtures gained the settings a configured author carries, matching author.json. Every test's asserted request sequence is unchanged — that is the evidence the new write fires only for an unconfigured format.

Gates: cargo fmt --check clean, 131 workspace tests pass, clippy clean on default and canary features.

A 4-dimension adversarial review (18 findings, 16 refuted on verification) confirmed one real defect: safe-sequence step 5 still prescribed both roots on the new-author add, contradicting the code and a test. Fixed in f89a4c2.

Not proven

Fixture-proven only. No live server has confirmed the settings PUT persists, so per the drift policy the write path stays beta until mutation case 13 runs against a disposable instance in both directions.

Verified against Chaptarr v0.9.936 (develop @ 423b1bb) after the first
production run of 4.6.1-chaptarr.1 surfaced an author carrying only the
requested format's settings.

POST /book configures exactly one format per call by design: the add path
collapses to the requested mediaType (AddBookService.cs:492-501) and every
per-format author assignment is gated on those flags
(AuthorLibraryService.cs:1700-1780), so the nested author's sibling-format
settings are accepted and discarded. An unconfigured format is a disabled
format - searches are silently emptied, remote books excluded, unpinned
local rows pruned on refresh.

Two consequences for this bot, both previously undocumented:

- When the requested-format row already exists, no add fires, nothing
  initializes the settings, every read-back passes, and the acknowledged
  BookSearch is silently empty. Safe-sequence step 9 now requires
  verifying and filling the requested format's settings through the
  full-resource author PUT, failing closed.
- The server's progressive fill collapses both roots into one
  audiobook-preferring parameter (AuthorLibraryService.cs:1136-1137), so an
  add body carrying both roots writes the audiobook root into an unset
  ebook root. Safe-sequence step 5 now sends only the requested format's
  root; the defect is drafted for upstream.

The 2026-08-28 canary's cross-format case verified monitoring only and its
zero-indexer instance could not surface the silent search-emptying, so the
checklist gains mutation case 13 (both directions, author-record
assertions) and an open prove-live section.
Chaptarr initializes author settings one format per add, so an author
created by /request book carries no audiobook profile ids or root - and an
unconfigured format is a disabled one, whose searches the server empties
silently. Every monitor and edition read-back still passed in that state,
so a second-format request could report success and queue a BookSearch
that could never return a release.

The author gate write now fills any missing quality profile, metadata
profile, or root folder for the requested format and verifies all three on
the read-back, failing closed. The fill is fill-only, mirroring the
server's own progressive semantics: a profile already on the author was
chosen deliberately and outranks configuration. The write stays a full
GET-mutate-PUT round-trip because the update copies both root paths
unconditionally, so a partial body would wipe the other format.

Both add bodies now send only the requested format's root. The server's
existing-author progressive fill collapses both roots into one
audiobook-preferring parameter, so a body carrying both wrote the
audiobook path into an unset EbookRootFolderPath.

The canary driver gains the assertions checklist case 13 needs: the
requested format configured after a completed request, and the other
format's settings unchanged. Integration fixtures gain the per-format
settings a configured author actually carries, matching author.json; every
existing request sequence is unchanged, which is what confirms the new
write fires only for an unconfigured format.
…thor

An adversarial review of the fix caught the contract contradicting the
code: safe-sequence step 5 still opened with "If the author is new, POST
/book with both roots", because the narrowing was written before the code
change and scoped only to the existing-author branch. The code narrows both
bodies, and a unit test forbids the sibling root in either - so the
normative wire contract prescribed a shape the code refuses to produce, in
the section a future change would consult.

The rule belongs on every add body: an add for an author the server already
has routes through the progressive fill whatever the client believed, so a
new-author body carrying both roots reaches the same collapse. Records the
release known-issue note and the changelog entry for the fix as well.
@elbrielle
elbrielle merged commit f2ef2b0 into main Aug 30, 2026
4 checks passed
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