Skip to content

Link to test collection pages when repo has migrated to test collections - #1156

Closed
TylerJang27 wants to merge 1 commit into
mainfrom
tyler/test-collection-links
Closed

Link to test collection pages when repo has migrated to test collections#1156
TylerJang27 wants to merge 1 commit into
mainfrom
tyler/test-collection-links

Conversation

@TylerJang27

Copy link
Copy Markdown
Collaborator

Why

The CLI always emits legacy repo-scoped test links (/{org}/flaky-tests/test/{id}?repo=owner/name), which resolve to the wrong page for repos that have migrated to test collections. Collection test pages live at /{org}/flaky-tests/collections/{shortId}/tests/{repoId}_{testId} — a different format that also needs the repo UUID, which only the server knows.

What

  • createBundleUpload response gains two optional fields (server change tracked separately):
    • testCollectionMigrationState (repo | test_collection | unspecified) — same server-side calculation as quarantine_resolution_mode. state ?? repo dictates which link format the end-of-run test tables use.
    • repoId — the repo UUID the collection URL is keyed by. When the state is test_collection but repoId is absent, links fall back to the legacy repo-name format.
  • getQuarantineConfig response gains repoId so the pre-upload failure log lines (which already key off quarantine_resolution_mode) can link to the collection page too.
  • url_for_test_case takes an optional collection target; None produces the exact legacy URL as before.
  • Deletes the unused CreateBundleUploadIntentRequest/Response messages (referenced by nothing).

Fully backward compatible: servers that omit the new fields (and dry runs / failed uploads, where no state is available) get today's legacy links unchanged.

Testing

  • New e2e test: migration state test_collection + repoId → stderr contains the collection link (/flaky-tests/collections/tc_123/tests/{repo-uuid}_...).
  • New e2e test: migration state test_collection without repoId → falls back to the legacy link, no collection URL emitted.
  • Unit tests for both URL shapes; full api/cli/test_report suites pass.

@trunk-io

trunk-io Bot commented Aug 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@trunk-staging-io

trunk-staging-io Bot commented Aug 13, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic 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 A test expected the sum of 2 + 2 to be 5, but it was actually 4, indicating a failing assertion. Logs ↗︎

View Full Report ↗︎Docs

@codecov-commenter

codecov-commenter commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.81657% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.36%. Comparing base (64052e5) to head (f7b6e94).

Files with missing lines Patch % Lines
api/src/message.rs 92.85% 1 Missing ⚠️
cli/src/context_quarantine.rs 97.95% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1156      +/-   ##
==========================================
+ Coverage   82.97%   83.36%   +0.39%     
==========================================
  Files          71       72       +1     
  Lines       16044    16149     +105     
==========================================
+ Hits        13312    13463     +151     
+ Misses       2732     2686      -46     

☔ 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 commented Aug 13, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@TylerJang27
TylerJang27 force-pushed the tyler/test-collection-links branch 2 times, most recently from b7c715d to 49c4d3f Compare August 13, 2026 20:08
The CLI always emitted legacy repo-scoped test links
(/{org}/flaky-tests/test/{id}?repo=owner/name), which land on the wrong
page for repos that have migrated to test collections. Collection test
pages live at /{org}/flaky-tests/collections/{shortId}/tests/{repoId}_{testId}
and need the repo UUID, which only the server knows.

- createBundleUpload response: add test_collection_migration_state
  (repo | test_collection | unspecified, mirroring
  quarantine_resolution_mode) and repo_id. The migration state (?? repo)
  dictates the link format for the end-of-run test tables; without
  repo_id we fall back to the legacy repo-name link. Older servers that
  omit both fields keep today's behavior.
- getQuarantineConfig response: add repo_id so the pre-upload failure
  log lines (which key off quarantine_resolution_mode) can also link to
  the collection page.
- Remove the unused CreateBundleUploadIntentRequest/Response messages.
@TylerJang27
TylerJang27 force-pushed the tyler/test-collection-links branch from 49c4d3f to f7b6e94 Compare August 13, 2026 20:45
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