Skip to content

feat(upload): link failing tests by GUID when only the quarantine lookup named the collection - #1295

Merged
trunk-io[bot] merged 3 commits into
mainfrom
tylerbeebe/trunk-21084-analytics-cli-render-guid-test-case
Nov 12, 2026
Merged

trunk-io[bot] merged 3 commits into
mainfrom
tylerbeebe/trunk-21084-analytics-cli-render-guid-test-case

Conversation

@acatxnamedvirtue

Copy link
Copy Markdown
Contributor

The failing-tests table in the upload summary (text, JSON and GitHub output) links each test to {app}/{org}/flaky-tests/collections/{shortId}/tests/{guid}. The guid is the ADR-0019 test-case GUID, computed in-process with gen_test_case_guid from the collection uuid, the repository id and the test's id. Until now the table took that pair only from the upload response. A failed upload, or a dry run on v2, has no upload ids, so the table fell back to the /t/<id>?repo= short link, even when the v2 quarantine lookup had already returned the same testCollectionUuid and repositoryId.

Most of TRUNK-21084 already landed in #1196 (GUID collection links) and #1256 (v2 upload and quarantine). This closes the remaining gap.

What changes

  • QuarantineContext keeps the quarantine lookup's ids.
  • The upload summary uses the upload's ids, or the lookup's when the upload gives none.
  • The "Learn more" lines already used the lookup's ids on v2, so they are unchanged.

What does not change

  • Runs with no collection keep the repo-scoped /flaky-tests/test/<id>?repo= link, and a run with a collection but no ids from either response keeps the short link. TRUNK-23150 removes the repo-only paths separately.
  • v1 "Learn more" lines, and a plain --dry-run (which never asks for the API version), keep the short link. Changing that means moving the version call, which feat(cli): upload fork PRs on v2 by swapping the job's GITHUB_TOKEN #1293 is reworking.
  • No API client or response changes.

Tests

  • New CLI test: a v2 run whose upload is refused still prints GUID links, using the quarantine lookup's ids. It fails without this change.
  • New URL test: pins ADR-0019's --no-repo golden vector (943a80af-66b0-84bb-ad01-56b3b72fe363) next to the existing with-repo vector. Both match context/src/meta/id.rs, the bindings and trunk2's ingest contract test.
  • Locally 372 of 375 pass; the 3 failures are Swift xunit tests that need a Swift language server.

Part of TRUNK-21084

🤖 Generated with Claude Code

@trunk-io

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

Comment thread cli/tests/upload.rs Outdated
.assert()
.failure()
.stdout(predicate::str::contains(
"/test-org/flaky-tests/collections/tc_123/tests/",

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.

I would think we could get a stronger assertion on the actual guid here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Fixed in 859cd87: the test now pins the exact link, …/test-org/flaky-tests/collections/tc_123/tests/ae979ba6-6f93-8657-9f84-0265e5ac404c.

  • Fixture: generate_mock_valid_junit_xmls uses a random seed, so its test ids and GUIDs changed on every run. The test now uses the checked-in junit0_fail.xml, which has one failing test, HelloTest.Hello.
  • Where the GUID comes from: the quarantine lookup's testCollectionUuid (MOCK_TEST_COLLECTION_ID), its repositoryId (MOCK_REPO_ID), and the test case id the CLI sent. I checked it independently against gen_test_case_guid's hash rule.
  • Also asserted: exactly one /tests/ link, and both existing negative checks are kept.
  • Mutation check: making the code hash the short id tc_123 or a nil repo id now fails the test. The old prefix-only assertion passed with a nil repo id.

acatxnamedvirtue and others added 3 commits November 12, 2026 19:48
…kup named the collection

The failing-tests table built its GUID links only from the upload's ids. A dry run
or a failed upload has none, so it fell back to the `/t/<id>?repo=` short link even
when the v2 quarantine lookup had already returned the collection uuid and
repository id. The run now uses the lookup's pair when the upload gives none.

Also pins ADR-0019's `--no-repo` golden vector at the URL layer.

Part of TRUNK-21084

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce (TRUNK-21084)

The test only checked the `/collections/tc_123/tests/` prefix, so a link
built from the short id, a nil repo id or the wrong test still passed. It
now uploads the checked-in junit0_fail.xml instead of the randomly seeded
mock, so the one failing test's id is stable, and asserts the full URL and
that it is the only test link printed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1084)

#1298 made test_case_url's short_id required, so the no-repo GUID test no
longer compiled once rebased onto main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acatxnamedvirtue
acatxnamedvirtue force-pushed the tylerbeebe/trunk-21084-analytics-cli-render-guid-test-case branch from 859cd87 to d7a2383 Compare November 12, 2026 19:52
@codecov-commenter

codecov-commenter commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.90%. Comparing base (4aefa5a) to head (d7a2383).

Files with missing lines Patch % Lines
cli/src/context_quarantine.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1295      +/-   ##
==========================================
+ Coverage   85.68%   85.90%   +0.21%     
==========================================
  Files          85       85              
  Lines       19440    19461      +21     
==========================================
+ Hits        16658    16717      +59     
+ Misses       2782     2744      -38     

☔ 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-io
trunk-io Bot merged commit d283d2a into main Nov 12, 2026
33 checks passed
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