Slice 6a: Progress display + failure isolation #8

Closed
opened 2026-06-03 10:27:56 +02:00 by AlexKucera · 0 comments
AlexKucera commented 2026-06-03 10:27:56 +02:00 (Migrated from github.com)

Parent

#1

What to build

User-facing output polish: progress bars for interactive use, plain logs for cron, and per-book failure isolation.

Progress display:

  • When running interactively (TTY detected): Rich progress bar per book showing download speed, percentage, ETA
  • When running non-interactively (cron, piped output): plain log lines like "Downloading: Author Name - Book Title (45.2 MB)"
  • Auto-detect TTY via sys.stdout.isatty() or equivalent
  • Use rich.Progress for TTY mode (already a dependency)

Failure isolation:

  • Each book wrapped in try/except at the CLI orchestration level
  • One failing book does not stop the batch — log the error with ISBN + title, continue to next book
  • Book-level errors include: network timeout mid-download, 403/404 on specific book, disk full, corrupt ZIP
  • Fatal errors (auth failure, missing config, API unreachable) are NOT caught — they still exit 1 immediately
  • Distinguish between "this book failed" (continue) and "everything is broken" (abort)

Acceptance criteria

  • TTY detected → rich progress bar shown during download
  • Non-TTY → plain log line per book instead of progress bar
  • Progress bar shows: percentage, speed (MB/s), ETA, file size
  • Plain log format: "Downloading: Author - Title (size)" / "Completed: Author - Title" / "Failed: Author - Title (reason)"
  • One book failure does not prevent subsequent books from downloading
  • Failed book logged with ISBN, title, and error reason
  • Fatal errors (auth fail before loop) still cause immediate exit 1
  • ~8 tests: TTY detection, progress bar rendering, plain log format, failure isolation (one fail + others succeed), fatal vs book-level error distinction
  • All tests pass

Blocked by

#7

## Parent #1 ## What to build User-facing output polish: progress bars for interactive use, plain logs for cron, and per-book failure isolation. **Progress display:** - When running interactively (TTY detected): Rich progress bar per book showing download speed, percentage, ETA - When running non-interactively (cron, piped output): plain log lines like `"Downloading: Author Name - Book Title (45.2 MB)"` - Auto-detect TTY via `sys.stdout.isatty()` or equivalent - Use `rich.Progress` for TTY mode (already a dependency) **Failure isolation:** - Each book wrapped in try/except at the CLI orchestration level - One failing book does not stop the batch — log the error with ISBN + title, continue to next book - Book-level errors include: network timeout mid-download, 403/404 on specific book, disk full, corrupt ZIP - Fatal errors (auth failure, missing config, API unreachable) are NOT caught — they still exit 1 immediately - Distinguish between "this book failed" (continue) and "everything is broken" (abort) ## Acceptance criteria - [ ] TTY detected → rich progress bar shown during download - [ ] Non-TTY → plain log line per book instead of progress bar - [ ] Progress bar shows: percentage, speed (MB/s), ETA, file size - [ ] Plain log format: `"Downloading: Author - Title (size)"` / `"Completed: Author - Title"` / `"Failed: Author - Title (reason)"` - [ ] One book failure does not prevent subsequent books from downloading - [ ] Failed book logged with ISBN, title, and error reason - [ ] Fatal errors (auth fail before loop) still cause immediate exit 1 - [ ] ~8 tests: TTY detection, progress bar rendering, plain log format, failure isolation (one fail + others succeed), fatal vs book-level error distinction - [ ] All tests pass ## Blocked by #7
Sign in to join this conversation.