Skip to content

Build the validate summary as data, separate from rendering - #1254

Merged
trunk-io[bot] merged 2 commits into
dylan/trunk-22401-build-the-upload-summary-as-data-separate-from-renderingfrom
dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering
Oct 29, 2026
Merged

trunk-io[bot] merged 2 commits into
dylan/trunk-22401-build-the-upload-summary-as-data-separate-from-renderingfrom
dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering

Conversation

@dfrankland

@dfrankland dfrankland commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #1236. Refs TRUNK-22402.

The validate summary is now built once as data, then rendered, the same way #1236 does it for upload. No output changes, and no JSON flag yet.

What changes.

  • New cli/src/report/validate.rs. ValidateReport::new works out everything the validate summary says: the matched files, one FileValidation per file, the CODEOWNERS check, the counts and the exit code. The types derive Serialize, with camelCase keys.
  • impl EndOutput for ValidateRunResult moves into report/text.rs as render_validate, which reads only the report. The impl stays on ValidateRunResult (built through the report) because the lock-down tests call it.
  • main.rs exits with report.exit_code; ValidateRunResult::exit_code is gone.
  • validate and upload's validation section now read the same FileValidation. It gains testSuiteCount and testCaseCount, null for a file that wasn't read as exactly one report. Those files are the ones the text lists under "File parse issues".
  • FileValidation.parseError is now {error, causes}, like ErrorSummary, instead of a {:#} string. validate has always printed parse errors the way anyhow's {:?} does, and that can't be rebuilt from the joined string. A unit test checks the rebuilt text against anyhow's own output.
  • run_validate collects the --hide-banner deprecation and the BEP parse errors as notices, like run_upload. The deprecation is still only logged.

Kept as-is.

  • "📚 Validating N files" counts a file once per glob that matches it, while the closing line counts each file once. counts.files is the deduplicated count.
  • upload and validate still collect per-file results differently: upload has no entry for a file with no reports and keeps the last of several, where validate reports both as issues.

#1246 is stacked on this. Its JSON test and doc comments are updated for parseError as an object and the two count fields.

Testing.

  • The lock-down tests in cli/tests/summary/ pass unchanged.
  • cargo test -p trunk-analytics-cli --lib --test summary --test test --test validate: all pass.
  • cargo test -p trunk-analytics-cli --test upload: all pass except the three Swift xunit tests, which fail the same way on the base branch locally.
  • cargo clippy -p trunk-analytics-cli --tests: no new warnings. cargo fmt --all --check: clean.

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.44262% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.27%. Comparing base (024bef3) to head (a408da5).

Files with missing lines Patch % Lines
cli/src/summary_output/text.rs 90.86% 17 Missing ⚠️
cli/src/validate_command.rs 57.14% 3 Missing ⚠️
Additional details and impacted files
@@                                              Coverage Diff                                               @@
##           dylan/trunk-22401-build-the-upload-summary-as-data-separate-from-rendering    #1254      +/-   ##
==============================================================================================================
+ Coverage                                                                       85.17%   85.27%   +0.09%     
==============================================================================================================
  Files                                                                              82       83       +1     
  Lines                                                                           18695    18781      +86     
==============================================================================================================
+ Hits                                                                            15923    16015      +92     
+ Misses                                                                           2772     2766       -6     

☔ 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 23, 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 test failed because it expected 2 + 2 to equal 5, but the result was 4. Logs ↗︎
multiple_exception_error_test nested context with multiple failures multiple expectations that fail The aggregated test failed because three expectations did not match and an additional RuntimeError was raised. Logs ↗︎
multiple_exception_error_test with before and after hook failures test execution with hook errors The test failed because both its before and after hooks raised errors, and RSpec could not match the failure to a backtrace line. Logs ↗︎

... and 3 more

View Full Report ↗︎ ⋅ Docs

@trunk-io

trunk-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

Comment thread cli/src/summary_output/mod.rs Resolved
@dfrankland
dfrankland force-pushed the dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering branch from 439f3aa to bcaa633 Compare October 27, 2026 20:42
@dfrankland
dfrankland added this pull request to stack #1268 October 28, 2026 15:54
dfrankland and others added 2 commits October 28, 2026 21:00
…ering

ValidateReport, in the report module, works out everything the validate
summary says once: the matched files, one FileValidation per file, the
CODEOWNERS check, the counts and the exit code. main exits with
report.exit_code, and the terminal output, including the EndOutput impl
for ValidateRunResult, moves into the text renderer. The report derives
Serialize, for the JSON output to come.

validate and upload's validation section now read the same
FileValidation. It gains test suite and test case counts, which are null
for a file that wasn't read as exactly one report. Its parse error is now
an error plus its causes, like ErrorSummary, because validate prints the
error the way anyhow's {:?} does. validate collects its --hide-banner
deprecation and BEP parse errors as notices, like upload.

The lock-down tests pass unchanged.

Refs TRUNK-22402

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dfrankland
dfrankland force-pushed the dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering branch from bcaa633 to a408da5 Compare October 28, 2026 21:28
@trunk-io
trunk-io Bot merged commit 4ea2447 into main Oct 29, 2026
74 of 86 checks passed
@trunk-io

trunk-io Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

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