feat(cli_tools): Added Logger.progressStream method #108
Conversation
Supports displaying multiple updated status strings during the run of a progress spinner.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Logger.progressStream and implements it in StdOutLogger and VoidLogger; StdOutLogger manages an animated progress spinner across stream events. Tests verify success, failure, empty-stream behavior, message mapping, leading-newline option, and log-level suppression. A Cursor rule for Dart test conventions is also added. ChangesProgress Stream Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.cursor/rules/dart-test-conventions.mdc:
- Around line 53-56: The test assertion contains a typo: update the string
literal in the test named "then error message is logged to errors." (the expect
call checking errors[0]) to use "erroneous usage" instead of "erronous usage" so
the example and any copied tests use the correct spelling.
In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart`:
- Around line 147-158: The empty-stream check using `finalEvent is! T` fails for
nullable T; replace it with an explicit boolean flag (e.g., `bool seen = false`)
declared before the loop, set `seen = true` inside the `await for (final event
in stream)` when you assign `finalEvent`, and after the loop throw
`StateError('No events in stream')` if `!seen`; then call `progress.complete()`
and return `finalEvent` cast to `T` (e.g., `return finalEvent as T`) so the
function reliably detects an empty stream regardless of nullability. Use the
existing symbols `finalEvent`, `stream`, `toMessage`, `progress.update`, and
`progress.complete` to locate and update the code.
In `@packages/cli_tools/test/logger/progress_test.dart`:
- Line 17: Several test cases destructure all three fields from collectOutput
but don't use stderr/stdin, which triggers analyzer warnings; update each
destructuring of collectOutput (e.g., the line using final (:stdout, :stderr,
:stdin) = await collectOutput(...)) to ignore unused fields by replacing the
unused names with underscores (for example use :_stderr and/or :_stdin or just
:_ for the unused positions) so only the used symbol (stdout) remains named;
apply the same change to the other occurrences mentioned (lines around where
stdout/stderr/stdin are destructured) to silence the analyzer warnings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e5ae7154-8e4f-45ad-8c53-753661d55d28
📒 Files selected for processing (5)
.cursor/rules/dart-test-conventions.mdcpackages/cli_tools/lib/src/logger/logger.dartpackages/cli_tools/lib/src/logger/loggers/std_out_logger.dartpackages/cli_tools/lib/src/logger/loggers/void_logger.dartpackages/cli_tools/test/logger/progress_test.dart
nielsenko
left a comment
There was a problem hiding this comment.
LGTM 👍
One unrelated suggestion now I was popping by 😊
Supports displaying multiple updated status strings during the run of a progress spinner.
Also makes progress and progressStream to handle exceptions by ending the animation with a failure message and rethrowing.
Also adds cursor rule file for writing tests according to our given - when - then convention.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests