Repository navigation
Add --summary-output-file to upload and test - #1246
Merged
trunk-io[bot] merged 6 commits intoOct 29, 2026
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering #1246 +/- ##
================================================================================================================
+ Coverage 82.12% 85.45% +3.33%
================================================================================================================
Files 83 84 +1
Lines 18654 18927 +273
================================================================================================================
+ Hits 15320 16175 +855
+ Misses 3334 2752 -582 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dfrankland
commented
Oct 23, 2026
This was referenced Oct 23, 2026
dfrankland
force-pushed
the
dylan/trunk-22403-add-summary-output-file-to-upload-and-test
branch
from
October 23, 2026 23:56
6de6e28 to
868861c
Compare
dfrankland
changed the base branch from
dylan/trunk-22401-build-the-upload-summary-as-data-separate-from-rendering
to
dylan/trunk-22402-build-the-validate-summary-as-data-separate-from-rendering
October 23, 2026 23:56
TylerJang27
approved these changes
Oct 26, 2026
dfrankland
force-pushed
the
dylan/trunk-22403-add-summary-output-file-to-upload-and-test
branch
from
October 27, 2026 20:42
868861c to
3b4c2ba
Compare
--summary-output-file <path> (or TRUNK_SUMMARY_OUTPUT_FILE) writes the upload report as JSON to a file. The terminal output doesn't change. The file carries a schemaVersion and a type: "upload" with the same report the text is rendered from, or "error" with the ErrorSummary when the run fails outright. The flag is in UploadArgs, so `test` gets it too. The JSON goes to a temporary file next to the target, which is then renamed into place. Missing parent directories are created. On success, "Summary written to <path>" follows the summary on stderr. If the write fails, a warning goes there instead and the exit code doesn't change. Refs TRUNK-22403 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`trunk-analytics-cli summary-output-schema` prints the JSON Schema for what --summary-output-file writes. schemars generates it from the report types, so it follows the serde attributes (camelCase, the `type` tag) and takes its descriptions from their doc comments. It is generated for serialization, so the fields that are always written, even as null, are required. Refs TRUNK-22403 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
When TRUNK_SUMMARY_OUTPUT_FILE is set, the RSpec gem writes the same JSON summary as `upload --summary-output-file` after uploading, or the error object when the upload fails outright. "Summary written to <path>" goes to stderr, as with the CLI, because the gem's own logs only reach the console at error level. The gem's summary has no exitCode, because RSpec decides the exit code. UploadCommand::RSpec leaves the report's exit_code unset, and the field is skipped when unset. `upload` and `test` always set it. The upload trusts the gem's quarantine results without looking them up again, so quarantineLookupFailed comes from the gem's own lookup. ErrorReport::unlogged builds the error object without logging it, since the gem already logs that error to Sentry. Refs TRUNK-22403 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The summary gets dryRun, from --dry-run (TRUNK_DRY_RUN in the RSpec gem). A dry run still checks quarantining but uploads nothing, so its summary has no upload ID or upload link and no error. dryRun says why. Refs TRUNK-22403 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`quarantining` replaces `quarantineLookupFailed` in the summary. Its
value is one of:
- CHECKED
- NOT_NEEDED
- DISABLED_VIA_CLI (--disable-quarantining)
- DISABLED_VIA_API (quarantining is turned off for the repo in Trunk)
- LOOKUP_FAILED
So a reader can tell why no failure was quarantined. Telemetry's
quarantine query result now comes from the same status. The RSpec gem
takes the status from its own lookup, because it quarantines during
the run even when TRUNK_DISABLE_QUARANTINING is set.
Every enum value in the summary is now SCREAMING_SNAKE_CASE: `type`,
`outcome`, the error and notice `kind`, and `quarantining`. Keys stay
camelCase, as in the protobuf JSON mapping. A group's key becomes
{"type": "FILE", "name": ...} or {"type": "OTHER"}, so its kind is a
value rather than a key.
Refs TRUNK-22403
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dfrankland
force-pushed
the
dylan/trunk-22403-add-summary-output-file-to-upload-and-test
branch
from
October 28, 2026 21:28
3b4c2ba to
ad00eed
Compare
|
This pull request was merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1254, which is stacked on #1236.
uploadandtestnow take--summary-output-file <path>(orTRUNK_SUMMARY_OUTPUT_FILE). The summary is also written to that file as JSON, for a step that comments on the pull request. The terminal output doesn't change. The RSpec gem writes the same file whenTRUNK_SUMMARY_OUTPUT_FILEis set.trunk-analytics-cli summary-output-schemaprints the file's JSON Schema. This replaces #1122.What changes.
UploadArgs, so both commands get it.UploadReportfrom Build the upload summary as data, separate from rendering #1236 withschemaVersion: 1andtype: "UPLOAD". When the run fails outright, it holds theErrorSummaryinstead, withtype: "ERROR"(report/json.rs).validationshas Build the validate summary as data, separate from rendering #1254's shape:parseErroris{"error": …, "causes": […]}, andtestSuiteCountandtestCaseCountare included (null when the file couldn't be parsed).type,outcome,kind,quarantining), and keys are camelCase, as in protobuf's JSON mapping. A group'skeyis{"type": "FILE", "name": …},{"type": "SUITE", "name": …}or{"type": "OTHER"}.dryRunsays the run uploaded nothing (--dry-run). A dry run still checks quarantining, so its summary has quarantine results but no upload ID or upload link.quarantiningsays whether failed tests could be checked for quarantining, and if not, why:CHECKED,NOT_NEEDED,DISABLED_VIA_CLI(--disable-quarantining),DISABLED_VIA_API(turned off for the repo in Trunk) orLOOKUP_FAILED. Telemetry's quarantine query result now comes from the same status.-v.summary-output-schemaprints a JSON Schema that schemars generates from the report types. Doc comments on the report fields become its descriptions. It's generated for serialization, so fields that are always written, even asnull, are required.test_report'spublish) writes the file after uploading. Its messages go to stderr, because the gem's own logs only reach the console at error level.exitCode, because RSpec decides the exit code.UploadCommand::RSpecleaves it unset, and the field is skipped when unset.quarantiningcomes from the gem's own lookup.ErrorReport::unloggedbuilds the error object without logging it, since the gem already sends that error to Sentry.Shape (shortened):
{ "schemaVersion": 1, "type": "UPLOAD", "error": null, "dryRun": false, "bundleUploadId": "4b1d2c3e-…", "uploadUrl": null, "validations": [{ "file": "junit.xml", "parseError": null, "errors": [], "warnings": ["…"] }], "counts": { "total": 3, "passed": 1, "failed": 2, "quarantined": 0, "passRatio": 0.3333333333333333 }, "quarantining": "CHECKED", "quarantined": [], "failures": [ { "key": { "type": "FILE", "name": "src/math.rs" }, "tests": [{ "name": "subtracts", "suite": "MathTests", "className": "MathTests", "file": "src/math.rs", "id": "1a028561-…", "variant": "", "failureMessage": "assertion failed", "quarantined": false, "link": "https://app.trunk.io/…/flaky-tests/test/1a028561-…?repo=…" }] } ], "outcome": "FAILURES_NOT_QUARANTINED", "exitCode": 1, "notices": [] }Differences from #1122.
bundle::Testfields plus its link: no line number, duration or Bazel target.counts.passed,link,suite,quarantined), and failures are grouped, with quarantined ones in their own list.Worth a look.
TRUNK_DISABLE_QUARANTININGduring the run. It still checks and quarantines failures, and only the upload sees the setting. That's existing behavior and isn't changed here; the gem'squarantiningreports what it actually did.variantis""rather thannullwhen a run has no variant, because that's whatbundle::Testholds.exitCodeis the code the error calls for, andnullmeans a run that fails outright exits 0. The schema describes this.Testing.
cargo test -p trunk-analytics-cli --lib --test summary --test test --test validate: all pass. New tests check the exact JSON for an upload report and for an error,testwriting the file via the env var, andsummary-output-schemaprinting the schema.cargo test -p trunk-analytics-cli --test upload: all pass except the three Swift xunit tests, which need a Swift toolchain and fail the same way on the base branch locally. New tests check that the file is written (to a nested path), that a dry run checks quarantining and writesdryRun: truewithout uploading, that an outright failure writes the error object, that--disable-quarantiningwritesDISABLED_VIA_CLI, and that a failed write keeps the exit code and leaves no temporary file. A summary test covers everyquarantiningvalue.check-jsonschema.cargo test -p test_report: all pass. New tests check that the gem writes the summary withoutexitCode, thatTRUNK_DRY_RUNwritesdryRun: true, writes the error object when the run fails outright, and reportsLOOKUP_FAILEDandDISABLED_VIA_APIfrom its own lookup.rake test) passes.cargo clippy -p trunk-analytics-cli -p test_report --all-targets: no new warnings.🤖 Generated with Claude Code