Skip to content

fix(cli): CLI output inconsistencies (logs to stderr, -qqq, deprecation warnings, test progress) - #1266

Open
dfrankland wants to merge 5 commits into
mainfrom
dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecation
Open

dfrankland wants to merge 5 commits into
mainfrom
dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecation

Conversation

@dfrankland

Copy link
Copy Markdown
Member

Fixes TRUNK-22400. Part of TRUNK-18881, and needed before TRUNK-22405 (--output-format json), which needs stdout free of logs.

One commit per fix:

  • Console logs go to stderr instead of stdout. Logs only show with -v, so default output is unchanged.
  • -qqq turns console logs off. to_trace_filter mapped LevelFilter::Off to TRACE, so the quietest setting logged the most.
  • Flag deprecations are logged with warn! instead of error!, and still go to Sentry. Each one carries a deprecated_flag field. Sentry records these as warning-level events with the same command_name / org_url_slug / repo_root tags as errors, so we can still see who uses deprecated flags, but they no longer count as errors. Other warnings are still sent only as breadcrumbs. --use-quarantining was already a warn!, so this is the first time it reaches Sentry.
  • Removed the unused impl EndOutput for TestRunResult.
  • test now shows the slow-API progress messages that upload shows. run_test now passes its render_sender to run_upload.

Testing

  • New upload integration tests:
    • With -v, a debug log appears on stderr and not on stdout, and the --team deprecation appears as WARN.
    • With -qqq, the debug log appears on neither stdout nor stderr.
    • Both tests fail on main.
  • falls_back_to_binary_file now looks for its log on stderr.
  • I checked the Sentry mapping locally with sentry::test::with_captured_events:
    • A tagged deprecation becomes a warning-level event with the tags.
    • A plain warn! isn't sent.
    • Errors are unchanged.
  • Not tested: the test progress messages, which would need a deliberately slow mock server.

Release note

With -v/--verbose, log lines now go to stderr instead of stdout. Scripts that read verbose logs from stdout need to read stderr instead.

🤖 Generated with Claude Code

@trunk-io

trunk-io Bot commented Oct 27, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.77%. Comparing base (41f781f) to head (5c6f239).

Files with missing lines Patch % Lines
cli/src/main.rs 78.57% 3 Missing ⚠️
cli/src/upload_command.rs 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1266      +/-   ##
==========================================
+ Coverage   85.42%   85.77%   +0.35%     
==========================================
  Files          86       86              
  Lines       19235    19214      -21     
==========================================
+ Hits        16431    16481      +50     
+ Misses       2804     2733      -71     

☔ 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.

@trunk-staging-io

trunk-staging-io Bot commented Oct 27, 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 quarantined variant test failed because it expected 2 + 2 to equal 5, but the result was 4. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

dfrankland and others added 5 commits October 29, 2026 17:30
Leaves stdout free for the command's own output, which the upcoming
`--output-format json` relies on. Logs only show with `--verbose`, so
default output is unchanged.

TRUNK-22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`to_trace_filter` mapped `LevelFilter::Off` to `TRACE`, so the quietest
setting logged the most. Map it to `LevelFilter::OFF` and filter events by
level in the console layer.

TRUNK-22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As `tracing::error!`, each deprecation counted as an error in Sentry even
though nothing failed. Log them with `warn!` and tag them with a
`deprecated_flag` field. Sentry now records warnings with that field as
warning-level events, with the same tags as errors, so we can still see
which customers use deprecated flags. Other warnings stay breadcrumbs.

This also starts reporting `--use-quarantining`, which was already a
`warn!` and so never reached Sentry.

TRUNK-22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TRUNK-22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`run_test` didn't pass its `render_sender` to `run_upload`, so `test`
skipped the slow-request messages that `upload` shows.

TRUNK-22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dfrankland
dfrankland force-pushed the dylan/trunk-22400-fix-cli-output-inconsistencies-log-stream-qqq-deprecation branch from 1392d05 to 5c6f239 Compare October 29, 2026 17:40
@dfrankland
dfrankland added this pull request to stack #1279 October 29, 2026 22:47
@dfrankland
dfrankland removed this pull request from stack #1279 October 30, 2026 16:52
@dfrankland
dfrankland added this pull request to stack #1280 October 30, 2026 16:52

This branch has not been deployed

No deployments
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