Skip to content

refactor: inject async writer into reporters instead of hardcoding stdout#161

Merged
branchseer merged 3 commits intomainfrom
refactor/async-reporter-writer
Feb 15, 2026
Merged

refactor: inject async writer into reporters instead of hardcoding stdout#161
branchseer merged 3 commits intomainfrom
refactor/async-reporter-writer

Conversation

@branchseer
Copy link
Copy Markdown
Member

Summary

  • Inject Box<dyn AsyncWrite + Unpin> writer into PlainReporter and LabeledReporterBuilder instead of hardcoding std::io::stdout()
  • Make LeafExecutionReporter::start/finish and GraphExecutionReporter::finish async via #[async_trait(?Send)]
  • Convert display helpers to sync formatters returning Str/Vec<u8>, keeping async I/O only at the reporter method level
  • Pass tokio::io::sink() as writer in unit tests; move reporter tests to their own module files (plain.rs, labeled.rs)

…dout

- Add Box<dyn AsyncWrite + Unpin> writer parameter to PlainReporter and
  LabeledReporterBuilder, replacing hardcoded std::io::stdout() calls
- Make LeafExecutionReporter::start/finish and GraphExecutionReporter::finish
  async using #[async_trait(?Send)]
- Convert display helpers to sync formatters (format_command_with_cache_status,
  format_error_message, format_cache_hit_message) returning Str
- Convert print_summary to sync format_summary returning Vec<u8> buffer
- Restructure labeled reporter to batch shared state updates before async
  writes, avoiding RefCell borrows across await points
- Pass tokio::io::sink() as writer in unit tests
- Move reporter tests to their own module files (plain.rs, labeled.rs)
  with shared test fixtures in mod.rs
tokio::io::Stdout has its own internal ~8KB buffer. Without explicit
flush(), data written to the reporter's writer may appear after process
output (which is flushed by the execution engine), causing E2E snapshot
test failures due to output reordering.
CI runs clippy with -D warnings, and redundant_pub_crate triggers when
pub(crate) is used inside a private module (the effective visibility is
already crate-scoped).
@branchseer branchseer merged commit c5ee519 into main Feb 15, 2026
6 checks passed
@branchseer branchseer deleted the refactor/async-reporter-writer branch February 15, 2026 15:03
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