Skip to content

feat: batch progress + ETA lines during --execute runs#194

Open
seonghobae wants to merge 1 commit into
mainfrom
feat/cli-progress
Open

feat: batch progress + ETA lines during --execute runs#194
seonghobae wants to merge 1 commit into
mainfrom
feat/cli-progress

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

During --execute runs over many files, the CLI printed per-file result lines but gave no sense of overall batch progress. This PR adds a progress line after each completed file:

PROGRESS	<done>/<total>	<pct>%	ETA <mm:ss>
  • ETA is extrapolated from the average per-file wall time so far x remaining files, measured with time.monotonic (immune to wall-clock jumps).
  • Output style matches the existing tab-separated CONVERTED/DRY-RUN lines and is printed with flush=True so it streams live.
  • Deliberately minimal: no progress bars, no new dependencies, no extra threads.
  • Dry runs are unaffected — PROGRESS only appears on the --execute path.

Changes

  • media_shrinker.py: new _format_progress() helper; _execute_conversions() tracks total/completed/start time and prints a PROGRESS line after each future completes. Docstrings on everything new/touched.
  • tests/test_media_shrinker.py: tests for PROGRESS formatting (counts, percent, mm:ss, minutes > 1, negative-ETA clamping), a deterministic workers=1 three-file batch with a patched monotonic clock asserting exact PROGRESS lines, and a dry-run test asserting no PROGRESS output.

Gates

  • coverage report --include=media_shrinker.py: 100% (581 stmts, 0 missed)
  • interrogate -c pyproject.toml media_shrinker.py: PASSED (100.0%)
  • unittest discover -s tests: 117 tests, no new failures (baseline 5 macOS os.listxattr errors only)

🤖 Generated with Claude Code

Long batch conversions previously emitted only per-file result lines,
leaving no way to gauge overall completion. After each file finishes,
the CLI now prints a tab-separated progress line:

    PROGRESS\t<done>/<total>\t<pct>%\tETA <mm:ss>

The ETA extrapolates from the average per-file wall time so far
(measured with time.monotonic) times the remaining file count. Output
stays consistent with the existing tab-separated CONVERTED/DRY-RUN
style; no progress bars, threads, or new dependencies. Dry runs are
unaffected.

Tests cover the PROGRESS line formatting (counts, percent, mm:ss ETA,
negative clamping), a deterministic workers=1 batch with a patched
monotonic clock, and the absence of PROGRESS output in dry-run mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CJRVbDrp1vGYkJgNHMGPpG
@seonghobae seonghobae enabled auto-merge (squash) July 6, 2026 14:26
@opencode-agent

opencode-agent Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 97c98b53f51d6fdd9be91bb1d275e0d4d1c97aa1
  • Workflow run: 28760880038
  • Workflow attempt: 1
  • Gate result: APPROVE (exit 0)

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file: media_shrinker.py"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file: media_shrinker.py"]
  R1 --> V1["required checks"]
  Evidence --> S2["Test: test_media_shrinker.py"]
  S2 --> I2["regression suite"]
  I2 --> R2["Review risk: Test: test_media_shrinker.py"]
  R2 --> V2["targeted test run"]
Loading

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.

1 participant