Skip to content

feat(cli): count files with old timestamps in the summary - #1278

Open
dfrankland wants to merge 1 commit into
dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutputfrom
dylan/trunk-23000-make-dropped-test-runs-more-prominent-in-the-summary
Open

dfrankland wants to merge 1 commit into
dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutputfrom
dylan/trunk-23000-make-dropped-test-runs-more-prominent-in-the-summary

Conversation

@dfrankland

Copy link
Copy Markdown
Member

Fixes TRUNK-23000. Stacked on #1273.

Why

Trunk's ingestion drops every report that has old (> 24 hour) timestamps (flatten_reports_and_errors in trunk2's bundle-ingestion-lib). The summary said so only in each file's warnings, which the file limit cuts off. In this thread, a MongoDB upload of 112 JUnit files, partly restored from Bazel's cache, showed 1344 passing tests and "No test failures found". The warning that mattered was hidden behind …and 104 more, and Trunk then dropped those runs.

What changes

The upload summary says how many files have old timestamps, apart from the per-file warnings. It never truncates that line and shows it with --validation-report none too:

…and 104 more

📚 Test Report
   Total: 1344   Pass: 1344   Fail: 0   Quarantined: 0   Pass Ratio: 100.0%
   ⚠️  112 files have test results older than 24 hours. Trunk will drop these results, but the test counts above include them.
   If Bazel restored these files from its cache, upload with --bazel-bep-path to skip cached results: https://docs.trunk.io/flaky-tests/get-started/frameworks/bazel
  • JSON summary (--summary-output-file, summary-output-schema): a top-level filesWithOldTimestamps and a per-file oldTimestamps. Both default when absent, so summaries from older CLIs and the RSpec gem still parse.
  • github-annotations: a warning annotation with the same text. A passing run with old files now has something to say, so the command exits 0 for it.
  • validate: the same lines after its totals, and filesWithOldTimestamps in its counts.
  • A file counts when its report has JunitReportValidationIssueSubOptimal::OldTimestamps, the issue whose message ingestion matches (JunitReportValidation::has_old_timestamps).
  • Exit codes and what gets uploaded don't change.

The Bazel hint is worded conditionally and always shown: the file paths can't tell us the files came from Bazel (MongoDB's were /data/mci/.../results.xml).

Tests

  • cli/tests/summary: a 112-file run past the file limit, the JSON fields, the annotation, reading a summary without the new fields, and the validate output.
  • cli/tests/upload.rs: 10 old files past the 8-file limit. It checks that the warning shows once, that all 10 files are uploaded, and that filesWithOldTimestamps is 10.
  • The validator discards timestamps more than 30 days old as defaulted, so the tests write XML timestamped two days ago rather than using a fixed fixture.

🤖 Generated with Claude Code

Trunk drops every report that has old (> 24 hour) timestamps when it
ingests an upload. The summary only said so in each file's warnings,
which the file limit cuts off, so a run could show passing tests that
Trunk then dropped.

The upload and validate summaries now say how many files have old
timestamps, that Trunk will drop their results, and that the test
counts include them. They also suggest --bazel-bep-path, which skips
results that Bazel restored from its cache. The line is never truncated
and shows with --validation-report none too. The JSON summary gets
filesWithOldTimestamps and a per-file oldTimestamps, and
github-annotations adds a warning. Exit codes and uploads don't change.

Refs TRUNK-23000

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 quarantined variant 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 96.22642% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.75%. Comparing base (194d13a) to head (2a089c0).

Files with missing lines Patch % Lines
cli/src/summary_output/text.rs 92.30% 2 Missing ⚠️
Additional details and impacted files
@@                                            Coverage Diff                                             @@
##           dylan/trunk-22404-print-the-cli-summary-on-stdout-and-remove-endoutput    #1278      +/-   ##
==========================================================================================================
- Coverage                                                                   85.79%   82.75%   -3.04%     
==========================================================================================================
  Files                                                                          85       85              
  Lines                                                                       19208    19133      -75     
==========================================================================================================
- Hits                                                                        16479    15834     -645     
- Misses                                                                       2729     3299     +570     

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

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.

2 participants