Skip to content

Disable in-place progress bar redraw on non-interactive output#11

Merged
janedbal merged 2 commits into
masterfrom
progress-bar-ci-overwrite
Jun 2, 2026
Merged

Disable in-place progress bar redraw on non-interactive output#11
janedbal merged 2 commits into
masterfrom
progress-bar-ci-overwrite

Conversation

@janedbal

@janedbal janedbal commented Jun 2, 2026

Copy link
Copy Markdown
Member

Problem

Running the detector in CI with --ansi produces an unreadable wall of stacked progress bars:

Symfony's ProgressBar animates the bar in place whenever the output is decorated — and --ansi forces decoration on, even when no real terminal is attached (ProgressBar::start() only disables overwrite when !isDecorated()). The in-place redraw emits cursor-control escape sequences (\x1B[1G, \x1B[2K) to overwrite the line. CI log viewers like GitLab don't collapse those sequences, so every redraw frame is appended, stacking ~50 partial bars into one wrapped blob.

PHPStan (which also uses Symfony Console with --ansi) doesn't suffer this because it emits one line per progress step in non-interactive output rather than animating in place.

Fix

Decide the redraw mode from an actual TTY check (stream_isatty) instead of from decoration:

  • Interactive terminal → keep the in-place animation (frequent redraws).
  • Non-interactive (CI / pipe)setOverwrite(false) so each redraw is its own line, plus a lower redraw frequency to keep the log compact (~10 lines, PHPStan-style).

Colors are untouched — --ansi still produces colored output in CI.

Verification

Before (piped, --ansi): cursor-control sequences interleaved, frames stacked.
After (piped, --ansi): clean newline-separated lines, no cursor escapes:

  0/26 ▓░░… …   0% < 1 ms
 26/26 ▓▓▓… … 100% < 1 ms

composer check passes (cs, phpstan, coverage, tests).

Co-Authored-By: Claude Code

janedbal added 2 commits June 2, 2026 15:25
Symfony's ProgressBar animates in place whenever the output is decorated,
which --ansi forces on even when no real terminal is attached. The in-place
redraw emits cursor-control escape sequences that CI log viewers (e.g. GitLab)
do not collapse, leaving every redraw frame stacked into an unreadable wall.

Decide the redraw mode from an actual TTY check instead of decoration: on an
interactive terminal keep the in-place animation; otherwise fall back to one
line per redraw (as PHPStan does) with a lower redraw frequency. Colors are
unaffected, so --ansi still produces colored output in CI.

Co-Authored-By: Claude Code
Co-Authored-By: Claude Code
@janedbal
janedbal marked this pull request as ready for review June 2, 2026 13:43
@janedbal
janedbal merged commit d4654ee into master Jun 2, 2026
22 checks passed
@janedbal
janedbal deleted the progress-bar-ci-overwrite branch June 2, 2026 13:43
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