Make verbose timing output sink injectable (#341)#373
Conversation
`VerboseTimingReporter` bypassed the reporter abstraction by writing its timing summary lines straight to `io::stderr()`, creating a second hard-coded output path that tests and alternative reporters could not capture. Introduce an injectable `TimingSink` (one rendered line per call): `new` keeps the stderr default, while the new `with_sink` constructor lets callers route the summary anywhere. The accessible, silent, and indicatif reporter behaviour is unchanged — only the summary's destination becomes a policy of the constructor. Add a test that captures the summary through an injected sink without touching global stderr, alongside the existing behaviour tests.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideMakes VerboseTimingReporter’s verbose timing output go through an injectable sink instead of writing directly to stderr, and adds a focused test that captures the timing summary via this new sink using a fake clock. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Closes #341
VerboseTimingReporterwrote timing summary lines directly toio::stderr()(src/status_timing.rs), bypassing the reporter abstraction and leaving the timing path uncapturable in tests.Of the approaches the issue offers, this implements the dedicated injected sink:
TimingSinkalias (dyn Fn(&str) + Send + Sync, one rendered line per call) andVerboseTimingReporter::with_sinkconstructor.newkeeps the stderr default via a namedstderr_sink, so existing behaviour (accessible, silent, indicatif wrapping) is preserved bit-for-bit.report_completeemits through the injected sink.Testing
verbose_timing_reporter_routes_summary_through_injected_sink: captures the localised summary (header, stage line, total) through an injected sink with a fake clock — no global stderr involved.Validation
make check-fmt/make lint/make test— pass (37 suites)🤖 Generated with Claude Code
Summary by Sourcery
Inject a configurable sink for verbose timing summaries so timing output no longer writes directly to stderr and can be captured in tests.
New Features:
Enhancements:
Tests: