feat(upload): link to test collection pages when a collection id is passed - #1165
Conversation
…assed
When --test-collection-id / TRUNK_TEST_COLLECTION_ID is provided, end-of-run
failure links now use the collection short-link form
/{org}/flaky-tests/collections/{short_id}/t/{test_case_id}?repo={owner}/{name};
the webapp resolves the repo name to a repo id and redirects to the canonical
collection test detail page. No RPC or response changes are needed since the
short id is a client-side input.
Pass --hide-test-collection-links / TRUNK_HIDE_TEST_COLLECTION_LINKS=true to
opt out and keep the legacy /{org}/flaky-tests/test/{test_case_id}?repo=...
links; without a collection id the legacy links are unchanged.
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1165 +/- ##
==========================================
+ Coverage 83.13% 83.41% +0.28%
==========================================
Files 72 72
Lines 16197 16241 +44
==========================================
+ Hits 13465 13548 +83
+ Misses 2732 2693 -39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Revert this commit before merging. The failing test makes CI's self-upload (built CLI + --test-collection-id) print the new collection short link in the end-of-run output so we can click through it.
|
|
…ks in CI" This reverts commit 52d7ddd.
Example run here:

and successful redirect
Summary
When
--test-collection-id/TRUNK_TEST_COLLECTION_IDis passed, end-of-run failure links (the⤷table and the quarantine "Learn more" log lines) now use the collection short-link form:The webapp resolves the repo name to a repo id server-side and redirects to the canonical collection test detail page (
/collections/{short_id}/tests/{repo_id}_{test_case_id}). No RPC or response changes — the short id is a client-side input, so the CLI already has everything it needs.Companion webapp PR (must deploy first, it hosts the redirect page): trunk-io/trunk2#5342
Behavior
--hide-test-collection-links/TRUNK_HIDE_TEST_COLLECTION_LINKS=true/collections/{short_id}/t/{test_case_id}?repo=.../flaky-tests/test/{test_case_id}?repo=...The hide flag follows the standard clap bool-flag pattern (same as
--show-failure-messages) and is a rendering preference only — it's threaded to the two URL-generation sites and never alters upload behavior. Intended for orgs dual-writing repo + collection uploads that want the old link experience.Test plan
cargo test -p api— URL unit tests for both link formscargo test -p trunk-analytics-cli— full suite green (96 tests), including 3 new integration tests covering the gate matrix above and the exported-but-blankTRUNK_TEST_COLLECTION_IDedge