Skip to content

ci: upload test results to a Trunk test collection - #1202

Open
EliSchleifer wants to merge 3 commits into
mainfrom
claude/test-collections-migration
Open

EliSchleifer wants to merge 3 commits into
mainfrom
claude/test-collections-migration

Conversation

@EliSchleifer

Copy link
Copy Markdown
Member

Problem

Every test job in CI ends red even when all tests pass. trunk-analytics-cli 1.x uploads only to a test collection, so the "Upload prod results" step fails with:

error: the following required arguments were not provided:
  --test-collection-id <TEST_COLLECTION_SHORT_ID>

Change

  • Bump trunk-io/analytics-uploader from v2.1.1 to v3.0.0 (pinned by SHA) in the linter_tests, tool_tests and action_tests actions.
  • Add a test-collection-id input to those actions and pass it to the uploader. Uploads still go to prod, org trunk.
  • Workflows pass vars.TRUNK_TEST_COLLECTION_ID as the collection ID.
  • Workflows pass secrets.TRUNK_UPLOAD_API_KEY instead of secrets.TRUNK_ORG_PROD_TOKEN. Uploader v3 refuses organization tokens and needs a v2 API key (trunk_v2_...) with the "Upload test results" permission.
  • The upload step is skipped while the key or the collection ID is unset, so test jobs reflect the test results.

Required before uploads resume

Neither of these exists yet as far as I can tell (this session cannot read repository variables or secrets):

  1. Repository variable TRUNK_TEST_COLLECTION_ID: the 8-character ID from app.trunk.io → Flaky Tests → Collections.
  2. Repository secret TRUNK_UPLOAD_API_KEY: a v2 API key from Settings → Developer → API Keys.

Until both are set, CI runs the tests and skips the upload. TRUNK_ORG_PROD_TOKEN is no longer referenced and can be removed afterwards.

Testing

  • All workflow and action YAML parses.
  • The v3.0.0 SHA was checked against the upstream tag with git ls-remote.
  • The upload itself is untested: it needs the variable and secret above. PRs from forks never receive either, so they skip the upload as before.

Generated by Claude Code

trunk-analytics-cli 1.x only uploads to a test collection and requires
--test-collection-id, so the upload step fails after the tests finish
and marks every test job red.

Move to trunk-io/analytics-uploader v3, which takes the collection ID
and a v2 API key instead of an organization token. The ID comes from
the TRUNK_TEST_COLLECTION_ID repository variable and the key from the
TRUNK_UPLOAD_API_KEY secret. The upload step is skipped while either is
unset.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdsoH3X377cYtfd7BXCc7m
@trunk-io

trunk-io Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

❌ This pull request was removed from the merge queue because it failed tests. PR #1205 was used for testing. See more details here.

Failed Required Status Conclusion
Aggregate Test Results Failure
  • 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

The collection id is not a secret, so carry it in the repository rather
than in a repo variable someone has to create before the uploads work.
Each test action now defaults test-collection-id to L6rxKpAC, and the
13 call sites that passed vars.TRUNK_TEST_COLLECTION_ID are gone; a
caller that wants a different collection, or none, still passes the
input.

TRUNK_UPLOAD_API_KEY is still a secret and still has to be set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdsoH3X377cYtfd7BXCc7m

Copy link
Copy Markdown
Member Author

This PR was dropped from the merge queue, but none of the failures come from it — this is a CI-config change and every failing suite also fails on main.

ubuntu-latest — semgrep, nixpkgs-fmt, brakeman, grype, trunk-toolbox
macos-latest — semgrep, nixpkgs-fmt, grype, phpstan

Fixes for four of them are on claude/fix-linter-failures, verified locally:

  • grype — a real bug, not a stale snapshot. grype emits "uri": "/Gemfile.lock"; the leading slash resolves outside the workspace, so every finding was dropped. A new parser recovers the real path from logicalLocations[0].fullyQualifiedName. The regenerated snapshot has 133 findings where it would otherwise have recorded none.
  • semgrep — the lint block's known_good_version trailed its tools entry at 1.142.0; moved to 1.222.0.
  • nixpkgs-fmt — test pinned rust@1.85.1, no longer fetchable; now 1.99.1.
  • trunk-toolbox — fails downstream of semgrep, no change needed.

Two are not fixed:

  • brakeman — needs known_good_version 5.4.0 → 8.1.1 (5.4.0 can't load racc on the pinned Ruby) plus a regenerated snapshot. I couldn't verify it: hermetic Ruby needs a ruby-build tarball from GitHub that my sandbox can't fetch, so no Ruby linter runs there. Someone with a normal checkout can finish it with npx jest linters/brakeman -u.
  • phpstan (macOS only) — not a code failure. phive got HTTP Code 403 from api.github.com/repos/composer/composer/releases, an unauthenticated rate limit on the runner. phpstan passed on macOS in earlier runs; this should clear on a retry.

Generated by Claude Code

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