Skip to content

docs(merge-queue): document the v2 Merge Queue API and a v1 migration guide, behind a hidden tab - #372

Merged
pv72895 merged 6 commits into
mainfrom
phil/merge-queue-api-v2
Sep 29, 2026
Merged

pv72895 merged 6 commits into
mainfrom
phil/merge-queue-api-v2

Conversation

@pv72895

@pv72895 pv72895 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Documents the v2 Merge Queue API ahead of its release, with a guide for moving v1 integrations to it. The pages live in a tab marked "hidden": true, the same way Changelog works: they're in no navigation, but anyone with the URL can open them, so we can review before launch.

What's here

  • openapi-v2.json is resynced from trunk2 main's ts/apps/public-api/openapi-v2.json (identical to it, as of trunk-io/trunk2#6512). That includes the API-key wording, the orgKey → apiKey scheme rename, and the prose fixes from #6511 and its review. The Flaky Tests v2 pages built from the same file pick up the new authentication text and scheme name, plus one new ErrorCode value; their operations are unchanged.
  • docs.json adds the hidden "Merge Queue API v2" tab. It leads with the migration guide, then generates the 30 merge-queue operations under /merge-queue/reference/api-v2/…, split into Merge queues, Queue order, Pull requests, Testing, Impacted targets, Metrics and Repositories. Dynamic CI and Flaky Tests operations are left out.
  • merge-queue/reference/api-v2.mdx is the landing page. It covers:
    • authentication with API keys (Settings → Developer → API Keys) and what each permission allows;
    • how to resolve IDs, pagination, errors, retrying writes and compatibility;
    • a card per endpoint.
  • merge-queue/reference/api-v2/migrate-from-v1.mdx is the v1-to-v2 migration guide. It covers:
    • a copyable prompt for a coding agent, which reads the guide and each endpoint page as .md;
    • creating an API key, with a permissions table keyed by v1 calls;
    • an endpoint-by-endpoint map;
    • automation and dashboard examples;
    • the renames a port can't guess (pull request records, timelines, testing results, verification runs, settings);
    • behavior changes, and a checklist.
  • merge-queue/reference/api-v2/github-actions.mdx covers uploading impacted targets from GitHub Actions with trunk-io/login, including pull requests from forks.

The v1 reference is untouched. The v2 pages never mention the legacy org API token, which is deprecated along with v1.

Before merging

  • Nothing outstanding: trunk-io/trunk2#6511 and #6512 have both merged, and openapi-v2.json here matches trunk2 main. If the spec changes again before this merges, copy it over again.

At release

  • Move the group into the Merge Queue tab next to the v1 "API reference", and delete the hidden tab.
  • Release the Developer → API Keys settings page (SHOW_DEVELOPER_SETTINGS), which the authentication section and the migration guide send every reader to.
  • Turn on the GitHub Actions login in production (GITHUB_ACTIONS_LOGIN_ENABLED and trunk-io/trunk#34100), release the Fork PR CI access setting, and tag trunk-io/login@v1. The GitHub Actions page depends on all three.
  • Add a changelog entry, and link to v2 from the v1 page and setup-and-administration/apis.

Testing

  • mint broken-links reports the same 12 broken links as main, and none from these pages.
  • On the preview deployment: every v2 page, the migration guide and its .md version return 200. Every endpoint link and in-page anchor in the guide resolves. No visible text on any v2 page mentions an org token, and the API playground's credential picker reads apiKey.
  • The migration guide was reviewed by an agent porting three realistic v1 integrations (a CI submit-and-poll job, a dashboard and an incident script) using only the guide. Its findings were checked against both specs and fixed.

🤖 Generated with Claude Code

Publish the v2 Merge Queue API reference ahead of its release, in a tab
marked "hidden": true so it is in no navigation but reachable by URL for
review — the same mechanism the Changelog tab uses.

- openapi-v2.json is resynced from trunk2 (ts/apps/public-api), including
  trunk-io/trunk2#6511's prose corrections. The published Flaky Tests v2
  pages built from it change only by a new ErrorCode member.
- The tab's one group generates the 30 merge-queue operations under
  /merge-queue/reference/api-v2, split into queues, queue order, pull
  requests, testing, impacted targets, metrics and repositories. Dynamic CI
  and Flaky Tests operations stay out.
- merge-queue/reference/api-v2.mdx is the landing page: authentication,
  resolving IDs, pagination, errors, retrying writes, compatibility, and a
  card per endpoint.
- merge-queue/reference/api-v2/github-actions.mdx covers uploading impacted
  targets from GitHub Actions with trunk-io/login, forks included.

The v1 reference is untouched. At release, move the group into the Merge
Queue tab and drop the hidden tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
trunk 🟢 Ready View Preview Sep 29, 2026, 4:08 PM

The legacy org API token is deprecated along with v1, so the v2 docs no
longer mention it. Automation now creates an API key under Settings →
Developer → API Keys, and the landing page covers creating one and what each
merge-queue permission allows. That replaces the "reuse your v1 token", the
API-key exchange caveat and the "write access is broad" warning, none of
which describes a v2 API key.

openapi-v2.json is resynced from trunk-io/trunk2#6511, which makes the same
change to the spec's own copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up trunk-io/trunk2#6511's rename of the Bearer scheme from orgKey to
apiKey, which Mintlify's playground shows as the credential's name.

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

merge-queue/reference/api-v2/migrate-from-v1.mdx walks an engineer (or a
coding agent, via a copyable prompt that reads the guide and each endpoint's
.md page) from v1 to v2: creating an API key and choosing its permissions,
switching credential and base URL, resolving IDs, an endpoint-by-endpoint
map, automation and dashboard examples, the value and field renames a port
cannot guess, behavior changes, and a checklist. It leads the hidden v2 tab,
and the v2 landing page links to it.

The mapping follows the parity matrix in trunk2's api-v2-merge-queue TRD,
checked against both specs; where they disagree (v1's state spellings, the
missing base_branch culprit) the published specs win. A reviewer working
three real v1 integrations through the guide found the default page size of
25 truncating 50-ID batch lookups, the split pull request record, timeline
and testing-result shape changes, and /order's thin rows; all are covered.

openapi-v2.json is resynced for trunk-io/trunk2#6511's allowBatching
permission fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up the restored queue-position caveat and the linked webhooks note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous resync came from a trunk2 branch cut after #6511 merged at its
first commit, so it lost the API-key wording and the apiKey scheme rename
and brought back org-token references. trunk-io/trunk2#6512 now carries
those commits; this copy is from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pv72895 pv72895 changed the title docs(merge-queue): document the v2 Merge Queue API behind a hidden tab docs(merge-queue): document the v2 Merge Queue API and a v1 migration guide, behind a hidden tab Sep 29, 2026
@pv72895
pv72895 merged commit 4bd97cc into main Sep 29, 2026
3 checks passed
@mintlify

mintlify Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Docs PR opened: #374

Added a draft Merge Queue API v2 changelog post and updated the changelog pages, to be merged after release.

This branch was successfully deployed

1 active deployment
staging — f7917f48 Deployed Sep 29, 2026 by mintlify[bot]
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.

1 participant