feat(photo-loader): progress bar for batch scheduling (CLI + web item-count)#1194
Merged
axisrow merged 3 commits intoJun 29, 2026
Merged
Conversation
…-count) CLI: optional on_progress callback in PhotoTaskService.run_due and PhotoAutoUploadService.run_due; run_due_impl prints plain "[done/total] ... (~Xm left)" per item plus a final summary. No new dependencies (extends the existing print(f"[N]...") pattern). Without a callback (None) behaviour is unchanged — existing test fakes keep working. Web (item-count parity): new repo count method (completed/total items per batch), surfaced via jobs_read_model; new HTMX fragment photo_loader_batch_row.html with hx-get/hx-trigger="every 5s" polling on RUNNING batches (server-driven swap, per the HTMX policy — not fetch/SSE). Tests: CLI progress callback, repo counts, jobs_read_model fields, route fragment, photo task lifecycle. 99 passed isolated; ruff clean. Closes #1152 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1
- Stub bundle.count_due_items in TestPhotoTaskServiceRunDue (4 tests) — run_due now calls it unconditionally; bare MagicMock bundles raised "MagicMock can't be used in 'await'" (signature-change-breaks-fakes, #1117). - run_due item_id path: on_progress(1, max(due_total, 1)) avoids "[1/0]" when an item is claimed by id before its schedule_at; loop path caps total at processed so progress never exceeds the snapshot total. - Merge resolution kept the #1190 HELD Publish button: photo_loader_batch_row.html now carries the publish-form column (HELD batches stay web-publishable) and the table header has the Прогресс + publish columns. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1
6284efa to
dbc5143
Compare
count_due_items / count_items_by_batch_status are consumed by PhotoTaskService / JobsReadModel (which hold a PhotoLoaderBundle, not db.repos), so the progress-count reads must live on the bundle surface. Legitimate +2 growth — raise the ratchet cap accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds live progress feedback for long-running photo batch operations (#1152) — previously
run-duecould run silently for 30+ minutes.Closes #1152
CLI (plain, no new deps)
on_progress: Callable[[int, int], None] | None = NoneinPhotoTaskService.run_dueandPhotoAutoUploadService.run_due. Without a callback behaviour is unchanged (existing test fakes keep working).run_due_implprints[done/total] ... (~Xm left)per item + a final summary, via_make_progress_printer/_format_eta/_print_progress_summary. Extends the existingprint(f"[N]...")pattern — no rich/tqdm dependency added (owner decision).Web (item-count parity)
repositories/photo_loader.py.jobs_read_modelsurfacescompleted_items/total_items.photo_loader_batch_row.htmlwithhx-get="/dialogs/photos/fragments/batches/{id}"+hx-trigger="every 5s"polling on RUNNING batches (server-driven swap per the HTMX policy — not fetch/SSE), showsN/Mitems.Tests
CLI progress callback, repo counts, jobs_read_model fields, route fragment, photo task lifecycle. 99 passed isolated (
-n 0); ruff clean. No new CLI leaf (callback on existingrun-due) → no manifest change needed.🤖 Generated with Claude Code
https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1