Shrink download_book() from 9 parameters to 4 domain-aligned parameters. Introduce DownloadResult dataclass. Move history writing out of download_book() to the caller.
## Parent
#25 — PRD 001: Deepen Architecture — Module Depth & Domain Alignment
## What to build
Shrink `download_book()` from 9 parameters to 4 domain-aligned parameters. Introduce `DownloadResult` dataclass. Move history writing out of `download_book()` to the caller.
**End state:**
- New interface: `download_book(book: Book, session: LibroFmSession, plan: OutputPlan, reporter: DownloadReporter) -> DownloadResult`
- `DownloadResult` frozen dataclass: status (downloaded/skipped/failed), path (Path | None), format (str | None), error (str | None)
- History writing no longer happens inside `download_book()`; caller inspects result and writes
- Format strategy + extras flags consumed from `OutputPlan` (not raw Config)
- Progress callback obtained from reporter (not passed as separate param)
- Cancel event handled internally or via reporter contract
## Acceptance criteria
- [ ] `download_book()` has exactly 4 parameters (plus self)
- [ ] `DownloadResult` frozen dataclass with correct shape for all three statuses
- [ ] History is NOT written by `download_book()`; caller writes after inspecting result
- [ ] All download tests exercise new interface; no test passes raw Config or history to `download_book()`
- [ ] M4B→MP3 fallback flow produces correct `DownloadResult` at each stage
- [ ] Cancel/interrupt path produces correct `DownloadResult(status="failed")`
## Blocked by
- #27 — needs `LibroFmSession` (not old `LibroFmClient`)
- #28 — needs `OutputPlan` (paths + format + extras)
Summary:download_book() shrunk from 9→4 domain-aligned params returning frozen DownloadResult. History writing moved to caller. OutputPlan.format_strategy added. Cancel wired through reporter.
Commit:9ac581e on feature/improve-codebase
✅ Complete — all 6 AC met, 368 tests pass.
**Summary:** `download_book()` shrunk from 9→4 domain-aligned params returning frozen `DownloadResult`. History writing moved to caller. `OutputPlan.format_strategy` added. Cancel wired through reporter.
**Commit:** `9ac581e` on `feature/improve-codebase`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Parent
#25 — PRD 001: Deepen Architecture — Module Depth & Domain Alignment
What to build
Shrink
download_book()from 9 parameters to 4 domain-aligned parameters. IntroduceDownloadResultdataclass. Move history writing out ofdownload_book()to the caller.End state:
download_book(book: Book, session: LibroFmSession, plan: OutputPlan, reporter: DownloadReporter) -> DownloadResultDownloadResultfrozen dataclass: status (downloaded/skipped/failed), path (Path | None), format (str | None), error (str | None)download_book(); caller inspects result and writesOutputPlan(not raw Config)Acceptance criteria
download_book()has exactly 4 parameters (plus self)DownloadResultfrozen dataclass with correct shape for all three statusesdownload_book(); caller writes after inspecting resultdownload_book()DownloadResultat each stageDownloadResult(status="failed")Blocked by
LibroFmSession(not oldLibroFmClient)OutputPlan(paths + format + extras)✅ Complete — all 6 AC met, 368 tests pass.
Summary:
download_book()shrunk from 9→4 domain-aligned params returning frozenDownloadResult. History writing moved to caller.OutputPlan.format_strategyadded. Cancel wired through reporter.Commit:
9ac581eonfeature/improve-codebase