Skip to content

feat(cli)!: use only the Trunk API v2 routes (TRUNK-23148) - #1313

Merged
trunk-io[bot] merged 3 commits into
mainfrom
tylerbeebe/trunk-23148-v2-apis-only
Nov 16, 2026
Merged

trunk-io[bot] merged 3 commits into
mainfrom
tylerbeebe/trunk-23148-v2-apis-only

Conversation

@acatxnamedvirtue

@acatxnamedvirtue acatxnamedvirtue commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Part of TRUNK-23148

Based on main. #1328 (TRUNK-23773) merged on 2026-11-16, so upload telemetry already goes to public-api's v2 metrics route. That was what this PR waited for: "v2 APIs only" couldn't ship while telemetry still used v1 (decided 2026-11-11). #1314 is stacked on this PR.

What changes

1.0.0 always uses the Trunk API v2.

Removed:

  • The v1 client: api/src/client/v1.rs, with createBundleUpload and getQuarantineConfig.
  • The getUploadApiVersion decision call, its retry and its types.
  • GetQuarantineConfigResponse and the v1-only key field.
  • test_report's on-disk API-version cache.
  • Collection inference, and the "Trunk has no collection" upload skip with its UPLOAD_SKIPPED notice. 1.0.0 requires --test-collection-id (feat(cli)!: require --test-collection-id and remove the repo lane #1298).
  • is_fork_pr, and v1's org-slug hint on a 404.

Kept: #1293's v2 fork lane, the GITHUB_TOKEN swap at POST /v2/auth/github-actions/login, sent on x-trunk-token. With no v1 fallback, each of these now uploads nothing and logs why:

  • a refused swap;
  • a missing GITHUB_TOKEN;
  • --allow-forked-pr-uploads outside a fork PR.

Fixed: 4xx errors are now parsed from public-api's { error: { code, message } } envelope. The client read v1's top-level shape and never showed the v2 message.

Tests and docs:

  • The mock server in test_utils serves the three v2 routes by default, and every CLI, plugin and client test runs against them.
  • The v1-only short-link fallback, missing-metadata and version-cache tests are removed.
  • The v1 credential-free smoke steps are removed from perform_smoke_test. Those steps ran in this repo's own CI, which is never a fork pull request, so on v2 they could only upload nothing. The v2 fork lane is covered end to end by trunk-io/flake-farm-staging-fork-prs. A generator fork opens a pull request there every 30 minutes, and its runs exchange the job's GITHUB_TOKEN (ci_fork) and upload to staging on v2. That's 877 exchanges in the 24 hours to 2026-11-16, on 0.17.0-beta.3 with analytics-cli-use-api-v2 on for trunk-staging-org.
  • CONTRIBUTING and the --allow-forked-pr-uploads help text are updated.

Testing

Merge order

#1328 (merged), then this PR, then #1314 (stacked on this one). #1298, #1296 and #1295 have merged, and this PR is rebased on them:

🤖 Generated with Claude Code

@acatxnamedvirtue
acatxnamedvirtue changed the base branch from tylerbeebe/trunk-23150-analytics-cli-100-require-test to tylerbeebe/trunk-23773-otlp-upload-telemetry November 13, 2026 18:08
@acatxnamedvirtue
acatxnamedvirtue force-pushed the tylerbeebe/trunk-23148-v2-apis-only branch from 424ef8a to f475224 Compare November 13, 2026 18:10
@acatxnamedvirtue
acatxnamedvirtue marked this pull request as ready for review November 13, 2026 18:18
@acatxnamedvirtue
acatxnamedvirtue force-pushed the tylerbeebe/trunk-23148-v2-apis-only branch from f475224 to d12df0e Compare November 13, 2026 20:21
@codecov-commenter

codecov-commenter commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.18768% with 13 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (tylerbeebe/trunk-23773-otlp-upload-telemetry@75f2fd8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
test_utils/src/mock_server.rs 95.02% 9 Missing ⚠️
cli/src/upload_command.rs 92.30% 2 Missing ⚠️
api/src/client/v2.rs 95.83% 1 Missing ⚠️
cli/src/context_quarantine.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@                               Coverage Diff                               @@
##             tylerbeebe/trunk-23773-otlp-upload-telemetry    #1313   +/-   ##
===============================================================================
  Coverage                                                ?   85.86%           
===============================================================================
  Files                                                   ?       84           
  Lines                                                   ?    19211           
  Branches                                                ?        0           
===============================================================================
  Hits                                                    ?    16496           
  Misses                                                  ?     2715           
  Partials                                                ?        0           

☔ 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.

@acatxnamedvirtue
acatxnamedvirtue force-pushed the tylerbeebe/trunk-23148-v2-apis-only branch from d12df0e to efc52f8 Compare November 16, 2026 18:11
Comment thread api/src/client/mod.rs Resolved
Comment thread cli/tests/summary/upload.rs Resolved
acatxnamedvirtue and others added 3 commits November 16, 2026 22:47
analytics-cli 1.0.0 always uses v2. The CLI and the test-runner plugins
that share the `api` crate (`test_report`, and through it the rspec gem's
native extension) make no v1 call and no `getUploadApiVersion` call.

- The v1 upload and quarantine client (`createBundleUpload`,
  `getQuarantineConfig`) and the `getUploadApiVersion` decision are gone,
  with their types: `UploadApiVersion`, `UploadApiDecision`,
  `GetUploadApiVersionRequest/Response`, `GetQuarantineConfigResponse`
  and the v1-only `CreateBundleUploadResponse.key`.
- `test_report` drops its on-disk API-version cache. Its quarantine cache
  keeps the `#v2` key suffix, so a v1 entry from 0.17.x is never read.
- The collection inference and "Trunk has no collection" skip that 0.17.x
  read from the decision are gone, with the `UPLOAD_SKIPPED` notice.
- The fork lane keeps #1293's v2 path: a credential-free GitHub Actions
  fork PR run swaps its `GITHUB_TOKEN` at
  `POST /v2/auth/github-actions/login` and sends the login on
  `x-trunk-token`. There is no v1 fallback: a refused swap, a missing
  `GITHUB_TOKEN`, or `--allow-forked-pr-uploads` with no token outside a
  fork PR uploads nothing and says why.
- 4xx bodies are read as public-api's `{"error": {"code", "message"}}`
  envelope; v1's top-level shape and its org-slug 404 hint are gone.
- The mock server serves the v2 routes, and the CLI, plugin and client
  tests run against them. The smoke steps that exercised v1's
  credential-free lane are removed.

Telemetry is unchanged: it still goes to trunk1's telemetry service with
the token on `x-api-token`.

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

The flags it warned about are gone, so no run reports a deprecation. The
summary schema's notice kinds are now BEP_PARSE_ERROR only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t left (TRUNK-23148)

The rspec gem printed deprecation notices on stderr; with the variant gone,
there are none to print.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acatxnamedvirtue
acatxnamedvirtue force-pushed the tylerbeebe/trunk-23148-v2-apis-only branch from eb766c5 to 28d508f Compare November 16, 2026 22:52
@acatxnamedvirtue
acatxnamedvirtue changed the base branch from tylerbeebe/trunk-23773-otlp-upload-telemetry to main November 16, 2026 22:52
@trunk-io

trunk-io Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@trunk-io
trunk-io Bot merged commit 3130045 into main Nov 16, 2026
23 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