Skip to content

Erase transient progress lines and coordinate shared grace period across embedders - #4864

Open
sigurdm wants to merge 18 commits into
dart-lang:masterfrom
sigurdm:clean-progress
Open

Erase transient progress lines and coordinate shared grace period across embedders#4864
sigurdm wants to merge 18 commits into
dart-lang:masterfrom
sigurdm:clean-progress

Conversation

@sigurdm

@sigurdm sigurdm commented Aug 18, 2026

Copy link
Copy Markdown
Contributor
  • Erase transient progress lines using ANSI escape sequences (\r\u001b[2K, log.eraseLine) on supported terminals in Progress.stopAndClear (with whitespace overwrite fallback for non-ANSI terminals).
  • Support transient progress via log.progress(..., transient: true) and use it during dependency resolution (summaryOnly: true), cached package downloads, and snapshot precompilation so progress output is erased upon completion.
  • Add ProgressGracePeriod to debounce transient progress display (defaulting to 500ms), sharing the grace period across multiple operations and across Zone boundaries (accessible to embedding tools via withOverrides(progressGracePeriod: ...)).
  • Reset the active grace period whenever permanent log output is printed.
  • Suppress the summary message in SolveReport when quiet: true (e.g. during embedded dart run).
  • Add unit tests in test/progress_test.dart.

Companion Dart SDK CL: https://dart-review.googlesource.com/c/sdk/+/538280

cc @mit-mit

@sigurdm
sigurdm marked this pull request as draft August 18, 2026 13:03
@sigurdm sigurdm changed the title Erase progress lines using ANSI escape codes and use spinner when resolving with summaryOnly Erase transient progress lines and coordinate shared grace period across embedders Aug 19, 2026
@sigurdm

sigurdm commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Here are side-by-side recordings comparing the baseline behavior with this PR.
These were recorded with a simulated network delay (~350ms per request) to clearly showcase the spinner animation, elapsed time ticker, and subsequent cleanup.

In every recording:

  • Left (Red badge): Dart 3.13 baseline behavior
  • Right (Green badge): Clean transient progress (this PR)

1. Cold Start: dart run bin/hello.dart

Resolving and downloading package dependencies prior to running an application. In baseline, intermediate resolution and download progress lines remain permanently above the app output. In the updated version, transient spinners animate during network operations and are erased before the app executes.

Demo 1: dart run


2. Standalone Compilation: dart compile exe bin/hello.dart -o hello.exe

Compiling a Dart entrypoint to a self-contained native executable. The resolution and download spinners spin and tick during dependency acquisition, and are then erased before the compiler output is rendered.

Demo 2: dart compile exe


3. Dependency Graph: dart pub deps

Inspecting the project's dependency graph. In baseline, Resolving dependencies... and Downloading packages... clutter the terminal before the tree. In the updated version, transient progress erases in place, leaving only the clean dependency tree.

Demo 3: dart pub deps


4. Sub-project Example: dart pub get --example

Resolving dependencies for both a package and its nested ./example sub-project. In baseline, both sets of progress indicators stay in the output. In the updated version, intermediate progress for ./example is transient and erases cleanly to Got dependencies in ./example..

Demo 4: dart pub get --example


5. Remote Package Run: dart run <remote-package>

Executing an executable from an uncached remote package (e.g. dart run benchmark_harness:bench@ --help). In baseline, Resolving dependencies in ..., Downloading packages..., and compiler output (Generated: ...) remain permanently above the command output. In the updated version, resolution and download spinners are transient and erased upon completion, and non-error compiler output is silenced.

Demo 5: dart run remote package

@sigurdm
sigurdm marked this pull request as ready for review September 1, 2026 10:30
@sigurdm
sigurdm requested a review from jonasfj September 1, 2026 10:30
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.

2 participants