## Parent
#1
## What to build
Final orchestration polish: summary output, exit code semantics, and comprehensive integration tests.
**Summary output:**
- Always printed at end of every run (TTY or not)
- Shows counts: N downloaded, M skipped, K failed
- For failed books: list ISBN + title + error reason
- For skipped books: list ISBN + title (brief, can be multiple lines)
- Clean tabular or formatted text output
**Exit code semantics:**
- Exit code 0: success (including partial success — some books failed but at least one downloaded, or all skipped)
- Exit code 1: fatal error only (auth failure, missing/invalid config, secrets file missing, Libro.fm API unreachable)
- "All books failed" is exit code 0 (individual failures are not fatal — cron should not email unless auth/config is broken)
**Integration tests:**
- Full orchestration test with all dependencies mocked (httpx transport mock):
- Happy path: 3 new books → all download successfully
- Mixed result: 2 new (1 M4B, 1 MP3), 1 already downloaded (skipped), 1 fails (API 404 on download) → correct summary and exit code 0
- Fatal path: auth fails → exit 1, no downloads attempted
- These tests exercise the full CLI entry point through its public interface
## Acceptance criteria
- [ ] Summary printed at end of every run with downloaded/skipped/failed counts
- [ ] Failed books listed with ISBN + title + reason in summary
- [ ] Skipped books listed with ISBN + title in summary
- [ ] Exit code 0 when all books succeed
- [ ] Exit code 0 when some books fail (partial success)
- [ ] Exit code 0 when all books skipped (nothing to do)
- [ ] Exit code 0 when all books fail individually (non-fatal)
- [ ] Exit code 1 on auth failure
- [ ] Exit code 1 on missing/invalid config
- [ ] Exit code 1 on API unreachable (before download loop starts)
- [ ] Integration test: happy path (all new books download)
- [ ] Integration test: mixed result (new + skipped + failed) with correct summary
- [ ] Integration test: fatal error (auth fails) with exit code 1
- [ ] ~12 tests: summary formatting, exit code scenarios, 3 integration tests
- [ ] All tests pass
## Blocked by
#8
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
#1
What to build
Final orchestration polish: summary output, exit code semantics, and comprehensive integration tests.
Summary output:
Exit code semantics:
Integration tests:
Acceptance criteria
Blocked by
#8