Upgrade both ProgressReporter (TTY/Rich) and PlainTextReporter (cron) from single-book singleton state (_current_task, _current_book) to a per-book identity mapping ({task_id: book} / {book_id: task_id}). This enables N simultaneous progress bars or interleaved log lines when multiple books download concurrently.
ProgressReporter changes:
Replace _current_task / _current_book with _tasks: dict[object, int] (book -> task_id) and _books: dict[int, object] (task_id -> book)
start_download(book) -> create Rich task, store bidirectional mapping, return task_id
update(completed, *, total, task_id=None) -> look up task from caller-provided identity; fall back to "most recently started" if no task_id for backward compat
complete(book) -> look up task by book, mark complete, remove from mappings, print status line
fail(book, reason) -> look up task by book, stop task, remove from mappings, print failure line
Same dict pattern but simpler: just thread-safe log line output
_print() already writes atomically per line (single write() + flush())
No bar management needed -- only start_download/complete/fail produce output
Thread safety: Both reporters use per-book identity lookup. No shared mutable state is mutated concurrently (dict mutations happen in start_download which is called before worker threads begin competing).
Acceptance criteria
ProgressReporter.start_download("Book A") then start_download("Book B") shows two simultaneous Rich progress bars
update(task_id=X) updates the correct bar (not always the last one)
complete("Book A") removes only Book A's bar; Book B's bar continues
fail("Book B") removes only Book B's bar; prints failure line
summary() fires after all tasks done, stops progress cleanly
PlainTextReporter produces correctly interleaved start/complete/fail lines for concurrent books
6-8 new tests covering multi-bar lifecycle, correct bar removal, plain text interleaving
All existing progress tests pass (backward-compatible fallback)
Blocked by
None - can start immediately
## Parent
#11
## What to build
Upgrade both `ProgressReporter` (TTY/Rich) and `PlainTextReporter` (cron) from single-book singleton state (`_current_task`, `_current_book`) to a per-book identity mapping (`{task_id: book}` / `{book_id: task_id}`). This enables N simultaneous progress bars or interleaved log lines when multiple books download concurrently.
**ProgressReporter changes:**
- Replace `_current_task` / `_current_book` with `_tasks: dict[object, int]` (book -> task_id) and `_books: dict[int, object]` (task_id -> book)
- `start_download(book)` -> create Rich task, store bidirectional mapping, return task_id
- `update(completed, *, total, task_id=None)` -> look up task from caller-provided identity; fall back to "most recently started" if no task_id for backward compat
- `complete(book)` -> look up task by book, mark complete, remove from mappings, print status line
- `fail(book, reason)` -> look up task by book, stop task, remove from mappings, print failure line
- Rich `Progress` natively supports multiple concurrent tasks -- no library changes needed
**PlainTextReporter changes:**
- Same dict pattern but simpler: just thread-safe log line output
- `_print()` already writes atomically per line (single `write()` + `flush()`)
- No bar management needed -- only `start_download`/`complete`/`fail` produce output
**Thread safety:** Both reporters use per-book identity lookup. No shared mutable state is mutated concurrently (dict mutations happen in `start_download` which is called before worker threads begin competing).
## Acceptance criteria
- [ ] `ProgressReporter.start_download("Book A")` then `start_download("Book B")` shows two simultaneous Rich progress bars
- [ ] `update(task_id=X)` updates the correct bar (not always the last one)
- [ ] `complete("Book A")` removes only Book A's bar; Book B's bar continues
- [ ] `fail("Book B")` removes only Book B's bar; prints failure line
- [ ] `summary()` fires after all tasks done, stops progress cleanly
- [ ] `PlainTextReporter` produces correctly interleaved start/complete/fail lines for concurrent books
- [ ] 6-8 new tests covering multi-bar lifecycle, correct bar removal, plain text interleaving
- [ ] All existing progress tests pass (backward-compatible fallback)
## Blocked by
None - can start immediately
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
#11
What to build
Upgrade both
ProgressReporter(TTY/Rich) andPlainTextReporter(cron) from single-book singleton state (_current_task,_current_book) to a per-book identity mapping ({task_id: book}/{book_id: task_id}). This enables N simultaneous progress bars or interleaved log lines when multiple books download concurrently.ProgressReporter changes:
_current_task/_current_bookwith_tasks: dict[object, int](book -> task_id) and_books: dict[int, object](task_id -> book)start_download(book)-> create Rich task, store bidirectional mapping, return task_idupdate(completed, *, total, task_id=None)-> look up task from caller-provided identity; fall back to "most recently started" if no task_id for backward compatcomplete(book)-> look up task by book, mark complete, remove from mappings, print status linefail(book, reason)-> look up task by book, stop task, remove from mappings, print failure lineProgressnatively supports multiple concurrent tasks -- no library changes neededPlainTextReporter changes:
_print()already writes atomically per line (singlewrite()+flush())start_download/complete/failproduce outputThread safety: Both reporters use per-book identity lookup. No shared mutable state is mutated concurrently (dict mutations happen in
start_downloadwhich is called before worker threads begin competing).Acceptance criteria
ProgressReporter.start_download("Book A")thenstart_download("Book B")shows two simultaneous Rich progress barsupdate(task_id=X)updates the correct bar (not always the last one)complete("Book A")removes only Book A's bar; Book B's bar continuesfail("Book B")removes only Book B's bar; prints failure linesummary()fires after all tasks done, stops progress cleanlyPlainTextReporterproduces correctly interleaved start/complete/fail lines for concurrent booksBlocked by
None - can start immediately
✅ Complete via commit
35cd34b— per-book identity mapping for concurrent progress bars (7/7 AC, 10 new tests, 194 total passing)