Skip to content

feat(cli): print the summary on stdout and remove EndOutput - #1273

Merged
trunk-io[bot] merged 2 commits into
dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecationfrom
dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutput
Nov 4, 2026
Merged

trunk-io[bot] merged 2 commits into
dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecationfrom
dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutput

Conversation

@dfrankland

Copy link
Copy Markdown
Member

Closes TRUNK-22404 (part of TRUNK-18881).

The CLI's summary now goes to stdout. Logs, progress, warnings and errors stay on stderr. This is what lets TRUNK-22405 put JSON on stdout.

  • run() returns a Report. DisplayMessage::Final(Arc<dyn EndOutput>) and the EndOutput trait are gone. DisplayMessage::Report carries the summary lines and DisplayMessage::Notice carries everything else.
  • Report is written with superconsole's emit_aux, which writes to stdout after it clears the progress line on stderr. Notice is written with emit, on stderr.
  • On stderr:
    • the error of a run that fails outright
    • the test command's "📒 Test command outputs" header
    • the collected notices (deprecation warnings, BEP parse errors)
    • the --summary-output-file message
  • BEP parse errors now get one line each (⚠️ BEP file had a parse error: …). They used to be one Debug-formatted list at the top of the validate summary.
  • The cli/tests assertions that read the summary from stderr now read it from stdout. Command-line argument errors stay on stderr.
  • New tests for the split: upload_writes_summary_to_stdout_and_notices_to_stderr, test_command_writes_summary_to_stdout_and_its_header_to_stderr and validate_writes_summary_to_stdout_and_notices_to_stderr. upload_bundle_invalid_repo_root now checks that a run that fails outright prints its error on stderr and nothing on stdout.

Stacked on #1266 (TRUNK-22400, logs on stderr). It needs that PR so logs don't mix with the summary on stdout. Merge #1266 first.

Release note

Scripts that capture only stderr will lose the summary. The analytics-uploader GitHub Action runs the CLI with stdio: "inherit", so it isn't affected.

Testing

cargo test -p trunk-analytics-cli -p display passes, except for the three Swift xunit tests in cli/tests/upload.rs, which are known to fail locally and are unrelated to this change.

🤖 Generated with Claude Code

@trunk-staging-io

trunk-staging-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
pending_quarantine_test should be quarantined when run with variant A test marked as pending was expected to fail but unexpectedly passed. Logs ↗︎
variant_quarantine_test should be quarantined when run with variant The quarantine test failed because it expected 2 + 2 to equal 5, but the result was 4. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.87629% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.84%. Comparing base (c6c7f78) to head (f5fd8c5).

Files with missing lines Patch % Lines
display/src/message.rs 90.90% 2 Missing ⚠️
cli/src/main.rs 98.18% 1 Missing ⚠️
cli/src/test_command.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@                                               Coverage Diff                                               @@
##           dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecation    #1273      +/-   ##
===============================================================================================================
+ Coverage                                                                        85.82%   85.84%   +0.01%     
===============================================================================================================
  Files                                                                               86       85       -1     
  Lines                                                                            19238    19232       -6     
===============================================================================================================
- Hits                                                                             16511    16509       -2     
+ Misses                                                                            2727     2723       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@acatxnamedvirtue acatxnamedvirtue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like reasonable changes

@dfrankland
dfrankland force-pushed the dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutput branch from 194d13a to f5fd8c5 Compare November 4, 2026 18:34
@trunk-io

trunk-io Bot commented Nov 4, 2026

Copy link
Copy Markdown

Stacked PR 1277 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

dfrankland and others added 2 commits November 4, 2026 19:50
run() returns a Report, and main sends each part of it to its own stream:
the summary goes to stdout with superconsole's emit_aux, while notices
(deprecation warnings, BEP parse errors), the error of a run that fails
outright, the test command header and the summary file message go to
stderr. DisplayMessage::Final and the EndOutput trait are replaced by
Report and Notice variants that carry the rendered lines.

Scripts that capture only stderr will lose the summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's #1287 printed Deprecation and UploadSkipped notices inside the upload
summary. This branch already prints every notice on stderr through
render_notices, so render UploadSkipped there and drop the copy in the
summary, which would have printed each notice twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dfrankland
dfrankland force-pushed the dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutput branch from f5fd8c5 to 37da644 Compare November 4, 2026 19:55
@trunk-io

trunk-io Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 1277, which will merge 1266, 1273, 1277.

@trunk-io
trunk-io Bot merged commit 30d8da4 into main Nov 4, 2026
23 checks passed
@trunk-io

trunk-io Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request was merged into main as part of stacked PR 1277.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants