Skip to content

Fix progress bar accumulation in Minimal view#27367

Open
reabr wants to merge 8 commits into
PowerShell:masterfrom
reabr:fix/progress-bar-accumulation-minimal-view
Open

Fix progress bar accumulation in Minimal view#27367
reabr wants to merge 8 commits into
PowerShell:masterfrom
reabr:fix/progress-bar-accumulation-minimal-view

Conversation

@reabr
Copy link
Copy Markdown
Contributor

@reabr reabr commented Apr 28, 2026

Summary

In Minimal/ANSI progress rendering mode, completed progress bars
were never removed from the internal tree, causing O(N²) console
output flooding when many bars reach 100% (e.g. Azure blob downloads).

Changes

  • PendingProgress.cs: Auto-remove nodes when PercentComplete
    reaches 100 in Minimal mode
  • PendingProgress.cs: Cap rendered bars to 5 in Minimal mode
    as a safety net
  • Write-Progress.Tests.ps1: Added 3 new tests covering the fix

Fixes

Fixes #26915

Also caps rendered bars to 5 in Minimal mode as a safety net.

Fixes PowerShell#26915
@reabr reabr requested a review from a team as a code owner April 28, 2026 09:00
Copilot AI review requested due to automatic review settings May 6, 2026 11:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a performance/usability issue in the ConsoleHost Minimal/ANSI progress renderer where progress nodes could accumulate indefinitely, causing excessive re-rendering and console output (O(N²)) when many activities reach 100% without sending -Completed.

Changes:

  • Update PendingProgress to remove 100%-complete progress nodes in Minimal view and cap rendered top-level bars to 5.
  • Add Pester coverage intended to exercise the Minimal progress view behavior around accumulation/capping.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/Microsoft.PowerShell.ConsoleHost/host/msh/PendingProgress.cs Removes 100% nodes in Minimal view and caps rendered top-level nodes to reduce output/perf impact.
test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Progress.Tests.ps1 Adds new Pester tests targeting Minimal progress view scenarios.

Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Progress.Tests.ps1 Outdated
Comment thread src/Microsoft.PowerShell.ConsoleHost/host/msh/PendingProgress.cs
Comment thread src/Microsoft.PowerShell.ConsoleHost/host/msh/PendingProgress.cs
Comment thread src/Microsoft.PowerShell.ConsoleHost/host/msh/PendingProgress.cs
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.

Minimal progress view re-renders all active bars on every update, causing O(N^2) console output when bars accumulate

2 participants