Skip to content

fix(photo-loader): count terminal items as progress so bar reaches N/N#1195

Merged
axisrow merged 1 commit into
mainfrom
fix/1152-progress-terminal-count
Jun 29, 2026
Merged

fix(photo-loader): count terminal items as progress so bar reaches N/N#1195
axisrow merged 1 commit into
mainfrom
fix/1152-progress-terminal-count

Conversation

@axisrow

@axisrow axisrow commented Jun 29, 2026

Copy link
Copy Markdown
Owner

What

Follow-up to #1152. The batch progress counter in JobsReadModel._from_photo_batch counted only COMPLETED items, so a batch with any FAILED/CANCELLED item froze at e.g. 2/3 forever — the batch was fully terminal but the counter implied work was still in flight.

Fix

completed_items now counts every item in a terminal state (completed / failed / cancelled), so the bar always reaches N/N. The terminal set _PHOTO_TERMINAL_STATUSES is derived from the existing _PHOTO_ITEM_STATE map (single source of truth — stays in sync if statuses change). total_items is unchanged (all items).

"Progress" = how many items finished, not how many succeeded — matches the "completeness bar" intent. Per-item success/failure remains visible via the batch status itself.

Tests

New regression test test_photo_batch_progress_counts_all_terminal_items — a batch of completed+failed+cancelled reports completed_items == total_items == 3. Mutation-verified: reverting the prod change to counts.get(COMPLETED, 0) makes the test fail (1 != 3). Existing test_photo_batch_read_model_counts_progress (completed+running+pending → 1/3) stays valid. ruff clean; 73 passed locally.

Closes #1152

🤖 Generated with Claude Code

https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1

The batch progress counter (#1152) counted only COMPLETED items, so a batch
with any FAILED/CANCELLED item froze at e.g. 2/3 forever — the batch was fully
terminal but the bar implied work was still in flight.

Count every item in a terminal state (completed/failed/cancelled) as
"processed". The terminal set is derived from _PHOTO_ITEM_STATE so it stays in
sync if statuses change. total_items is unchanged (all items).

Regression test (mutation-verified): a batch of completed+failed+cancelled now
reports completed_items == total_items == 3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1
@axisrow axisrow merged commit 3f6810e into main Jun 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add progress bar for batch photo scheduling

1 participant