Summary
The persisted failed_chunks count is always 1 regardless of how many chunks failed, and the live stats can report completed + failed > total because failed units are also counted as completed.
Where
src/core/adapters/generic_translator.py:215-229 (_record_failure passes failed_chunks=1), :271-285 (success reports completed_chunks: i + 1)
src/persistence/database.py:213-220 (update_job_progress sets progress['failed_chunks'] = 1, doesn't accumulate)
Details
_record_failure always passes failed_chunks=1, and update_job_progress overwrites rather than accumulates, so a job with 12 failed units persists failed_chunks: 1 — wrong in the resumable-jobs list and any post-resume accounting.
Separately, the success path reports completed_chunks: i + 1 (the absolute index), which counts previously failed units as completed. Example: unit 3 fails → failed=1, completed=3; unit 4 succeeds → completed=5, failed=1 for 5 processed units, so completed + failed > total is reportable.
Suggested fix
- Accumulate
failed_chunks (track a running count, or count the failed-index set), not a constant 1.
- Report
completed_chunks as the number of genuinely successful units, not the absolute loop index.
Found during the June 2026 repo audit. Severity: medium. Confidence: certain.
Summary
The persisted
failed_chunkscount is always 1 regardless of how many chunks failed, and the live stats can reportcompleted + failed > totalbecause failed units are also counted as completed.Where
src/core/adapters/generic_translator.py:215-229(_record_failurepassesfailed_chunks=1),:271-285(success reportscompleted_chunks: i + 1)src/persistence/database.py:213-220(update_job_progresssetsprogress['failed_chunks'] = 1, doesn't accumulate)Details
_record_failurealways passesfailed_chunks=1, andupdate_job_progressoverwrites rather than accumulates, so a job with 12 failed units persistsfailed_chunks: 1— wrong in the resumable-jobs list and any post-resume accounting.Separately, the success path reports
completed_chunks: i + 1(the absolute index), which counts previously failed units as completed. Example: unit 3 fails →failed=1, completed=3; unit 4 succeeds →completed=5, failed=1for 5 processed units, socompleted + failed > totalis reportable.Suggested fix
failed_chunks(track a running count, or count the failed-index set), not a constant 1.completed_chunksas the number of genuinely successful units, not the absolute loop index.Found during the June 2026 repo audit. Severity: medium. Confidence: certain.