Skip to content

Refine ASR progress bar presentation - #13

Merged
morehardy merged 2 commits into
mainfrom
codex/thin-percent-progress
May 14, 2026
Merged

Refine ASR progress bar presentation#13
morehardy merged 2 commits into
mainfrom
codex/thin-percent-progress

Conversation

@morehardy

Copy link
Copy Markdown
Owner

Summary

  • Replace thick/block window progress with a thin full-length progress track
  • Show percentage and elapsed time instead of window counts
  • Keep TTY Rich rendering and non-TTY fallback aligned

Review

  • Checked TTY/non-TTY behavior, file completion, and progress cleanup paths
  • No blocking issues found in the changed console observer code

Test Plan

  • PYTHONPATH=src uv run --frozen --python 3.14 python -m unittest discover -s tests -p 'test_*.py'

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the console progress display by introducing a thin progress bar style, switching from raw counts to percentages, and improving time formatting. Feedback suggests that the manual newline handling in _stop_progress and the associated _stream_ends_with_newline helper are likely redundant and inefficient, as the Rich library typically manages terminal cleanup and getvalue() is not suitable for standard output streams.

Comment thread src/asr/observability/console.py Outdated
Comment on lines 184 to 187
if not self._stream_ends_with_newline():
self.stream.write("\n")
self.stream.flush()
self._last_width = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The manual newline appended here appears redundant when using rich.progress.Progress with transient=False (the default in _ensure_progress), as Rich typically appends a newline when the live display stops. The current check _stream_ends_with_newline only works for streams that implement getvalue() (like io.StringIO used in tests) and will always return False for standard streams like sys.stdout. This will likely result in an extra blank line in real terminal output between files or steps. Consider removing this manual newline and relying on Rich's built-in cleanup.

            self._last_width = 0

Comment thread src/asr/observability/console.py Outdated
Comment on lines +194 to +199
def _stream_ends_with_newline(self) -> bool:
getvalue = getattr(self.stream, "getvalue", None)
if not callable(getvalue):
return False
value = str(getvalue())
return value.endswith("\n")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using getvalue() on the stream to check for a trailing newline is inefficient for large streams, as it copies the entire buffer into memory. While this is primarily used in tests, it's a fragile pattern for a general-purpose observer. If the manual newline in _stop_progress is removed as suggested, this helper method would no longer be necessary.

@morehardy

Copy link
Copy Markdown
Owner Author

Addressed Gemini review feedback in 8335300:

  • Removed the manual newline write from _stop_progress().
  • Removed _stream_ends_with_newline() and its getvalue()-based stream inspection.
  • Kept _last_width reset after Rich progress stops.

Verification:

  • PYTHONPATH=src uv run --frozen --python 3.14 python -m unittest discover -s tests -p "test_*.py"
  • GitHub Unit tests are passing.

@morehardy
morehardy merged commit 899868b into main May 14, 2026
2 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.

1 participant