Repository navigation
feat(cli): use the test collection Trunk infers from the repository - #1287
Merged
trunk-io[bot] merged 4 commits intoNov 4, 2026
Merged
Conversation
A run without --test-collection-id now asks the decision route too, by its repository. When trunk1 answers v2 with a testCollectionShortId, the run uses that collection for the v2 quarantine lookup and upload, as if it had been passed, and warns that 1.0.0 requires the id. A v2 answer with no collection falls back to v1. A run that names its collection ignores any inferred one. The test-runner plugins keep the inferred collection in their API version cache, so every worker process uses it, and print the warning on stderr. Deprecation notices now show in the upload's text output, since the console shows tracing only when verbose. Part of TRUNK-23145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
😎 Merged successfully - details. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1287 +/- ##
==========================================
+ Coverage 85.58% 85.76% +0.18%
==========================================
Files 86 86
Lines 19259 19405 +146
==========================================
+ Hits 16482 16642 +160
+ Misses 2777 2763 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TylerJang27
approved these changes
Nov 4, 2026
TylerJang27
left a comment
Collaborator
There was a problem hiding this comment.
Some notes on clarity/correctness
When getUploadApiVersion answers missingTestCollection, the run named no collection and Trunk could not infer one for a fully migrated org, so ingestion would drop a v1 upload. The CLI and the test-runner plugins now skip the upload and its telemetry and warn, with an UPLOAD_SKIPPED notice in the summary. The quarantine lookup is unchanged. Part of TRUNK-23145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UploadApiDecision::from_response holds the rules: a run that named its collection takes the answer's version as it is, and only a run that named none reads testCollectionShortId (with v2) or missingTestCollection (with v1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With missingTestCollection the CLI now skips the quarantine lookup as well as the upload, and the test-runner plugins report a test as not quarantined without a lookup. v1 answers that lookup for a fully migrated org with 404 "A test collection is required", which quarantined nothing, so the exit code is the same as before. Part of TRUNK-23145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trunk-io Bot
pushed a commit
that referenced
this pull request
Nov 4, 2026
* feat(cli): print the summary on stdout and remove EndOutput run() returns a Report, and main sends each part of it to its own stream: the summary goes to stdout with superconsole's emit_aux, while notices (deprecation warnings, BEP parse errors), the error of a run that fails outright, the test command header and the summary file message go to stderr. DisplayMessage::Final and the EndOutput trait are replaced by Report and Notice variants that carry the rendered lines. Scripts that capture only stderr will lose the summary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): show UploadSkipped notices with the others on stderr main's #1287 printed Deprecation and UploadSkipped notices inside the upload summary. This branch already prints every notice on stderr through render_notices, so render UploadSkipped there and drop the copy in the summary, which would have printed each notice twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Dylan Frankland <2488926+dfrankland@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of TRUNK-23145.
What
A run without
--test-collection-idnow asksPOST /v1/metrics/getUploadApiVersiontoo, sending itsrepo(still one decision per run, 2 s timeout, any failure is v1). The response gains an optional, additivetestCollectionShortId, which trunk1 sends only withv2for a run that named no collection, when it inferred the org's collection from the repository (TRUNK-23144).--test-collection-idv2+testCollectionShortId--test-collection-idv2without an id (old server or bug)--test-collection-idv1(or anything else, or a failure)--test-collection-idThe warning:
The test-runner plugins (
test_report) get the same behaviour. Their wording saysSet TRUNK_TEST_COLLECTION_ID=<id>instead of naming the flag. The inferred id is stored in the on-disk API version cache, so every worker process's quarantine lookup and the final upload use the same collection. The gem's console shows only error-level logs, so the plugin prints the warning on stderr, as it already does for the summary-file line.Parsing ignores an absent field and unknown fields.
Also: deprecation notices now show in the upload output
The CLI's console shows tracing output only with
--verbose, so atracing::warn!deprecation, this one or the existing--team/--print-files/--hide-banner/--use-quarantiningones, was visible only in--summary-output-file.render_uploadnow prints eachDeprecationnotice at the top of the upload report. So those existing flag deprecations become visible too.Rollout
This depends on trunk1's TRUNK-23144 change to the decision route. Until that ships, servers never send
testCollectionShortIdand never answerv2for a run without a collection, so behaviour is unchanged. Safe to merge first.The version bump and release are separate (TRUNK-23146). 0.17.0 must be cut before Dylan's summary-output change (#1273) lands.
Tests
api/tests/v2_client.rs: the inferred id is used, unknown fields are tolerated, av2with no id (absent, null, blank) or av1carrying one reads as v1, an explicit id ignores the inferred one, and there is no call without a token, or without both a collection and a named repo.cli/tests/upload.rs: end-to-end upload to the inferred collection (both v2 routes take that id, the bundle meta names it, the warning is printed).v2with no id uploads on v1. An explicit id ignores an inferred one and prints no warning.test_report/tests/quarantine.rs: two plugin "processes" both look up quarantine on v2 under the inferred id, with one decision call.cli/tests/summary/upload.rs: deprecation notices render first in the text report.🤖 Generated with Claude Code