Skip to content

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

Open
dfrankland wants to merge 1 commit 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
Open

dfrankland wants to merge 1 commit 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 84.85%. Comparing base (f907dd1) to head (bcaa633).

Files with missing lines Patch % Lines
cli/src/report/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                                                                       84.74%   84.85%   +0.10%     
==============================================================================================================
  Files                                                                              78       79       +1     
  Lines                                                                           18058    18144      +86     
==============================================================================================================
+ Hits                                                                            15304    15396      +92     
+ Misses                                                                           2754     2748       -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 ↗︎

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/report/mod.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

report/test_report is a bit of an overloaded term in this repo. Can we either:

  1. Rename the rspec test_report stuff to gem or integration or something
  2. and/or rename this cli/src/report to cli/src/summary_output or something

…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>
@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

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