Route autolink requests through api.Client - #14013
Merged
Merged
Conversation
webjema
pushed a commit
to webjema/firstmate
that referenced
this pull request
Jul 30, 2026
…at (#46) * review: mark a blocking verdict on the PR, not only in firstmate's chat PR #44 merged carrying seven confirmed defects while its crew was still fixing them. The review had found all seven and firstmate had said not to merge, but that verdict existed only in the firstmate session's chat, so whoever clicked merge never saw it. AGENTS.md section 6 step 3 now requires the verdict to land on the PR when one is already open: draft a firstmate-authored PR with `gh pr ready --undo`, which blocks the merge button mechanically instead of merely advising, plus a comment carrying the reason; never draft a bot's PR, where a comment and a `do-not-merge` label are used instead. docs/pr-block-signal.md owns the commands, the per-repo label setup, and the verification record - including the check that drafting does NOT suppress this repo's PR CI, which is what makes the draft path safe for the fix loop. * docs(pr-block-signal): replace inferred draft-CI reasoning with live evidence The event reference does not document whether workflows run on draft PRs, so the claim now rests on a live draft PR in a public repo whose workflow has the same bare `pull_request:` trigger shape as ours (cli/cli#14013, 15 completed check runs while isDraft). Also records that GitHub's current stage-change docs carry no plan or visibility restriction on drafts at all, which makes gh's "If supported by your plan" caveat conservative rather than a live constraint. * docs(pr-block-signal): record the bot-versus-firstmate discriminator check Verified on live PRs of both kinds that .author.is_bot separates the two mechanisms, and stated the two commands that close the one gap left in the record - the live draft conversion - on any open firstmate PR.
williammartin
force-pushed
the
williammartin-migrate-repo-autolink
branch
from
July 31, 2026 11:24
8606f36 to
6d4e36a
Compare
williammartin
force-pushed
the
williammartin-migrate-repo-autolink
branch
from
August 1, 2026 07:52
6d4e36a to
540985a
Compare
williammartin
force-pushed
the
williammartin-migrate-repo-autolink
branch
from
August 4, 2026 08:25
540985a to
a6548bc
Compare
williammartin
force-pushed
the
williammartin-migrate-repo-autolink
branch
from
August 4, 2026 08:35
a6548bc to
d30ab8d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Routes the repo autolink REST call sites through api.Client.REST instead of direct httpClient.Do, consolidating GitHub API URL derivation and unblocking per-host API routing work.
Changes:
- Migrate
create,delete,list, andviewautolink HTTP helpers to useapi.NewClientFromHTTP(...).REST(...). - Reconstruct the existing custom 404 error branches via
errors.Asonapi.HTTPError, keeping legacy messages intact. - Expand unit/acceptance coverage for autolink operations (including new acceptance flow).
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/repo/autolink/view/http.go | Switch view request to api.Client.REST and preserve the custom 404 message via errors.As. |
| pkg/cmd/repo/autolink/view/http_test.go | Update stubs/assertions to reflect api.Client behavior and add coverage for unexpected errors. |
| pkg/cmd/repo/autolink/list/http.go | Switch list request to api.Client.REST and preserve the custom 404 message via errors.As. |
| pkg/cmd/repo/autolink/list/http_test.go | Update list tests to assert on api.HTTPError details for non-404 failures. |
| pkg/cmd/repo/autolink/delete/http.go | Switch delete request to api.Client.REST and preserve the custom 404 message via errors.As. |
| pkg/cmd/repo/autolink/delete/http_test.go | Update delete tests to assert on api.HTTPError details for unexpected errors. |
| pkg/cmd/repo/autolink/create/http.go | Switch create request to api.Client.REST and preserve the custom 404 behavior while accepting any 2xx as success. |
| pkg/cmd/repo/autolink/create/http_test.go | Update create tests to assert on api.HTTPError status codes for failure responses. |
| acceptance/testdata/repo/repo-autolink.txtar | Add an end-to-end acceptance script covering autolink create/list/view/delete. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Suppressed comments (1)
pkg/cmd/repo/autolink/create/http_test.go:35
- Create now succeeds for any 2xx response (per the PR description, HTTP 200 is now treated as success). The tests only cover a 201 response, so the new success behavior isn’t locked in and could regress back to an error for 200.
Add a table entry that stubs an HTTP 200 response and asserts it decodes successfully.
{
name: "201 successful creation",
req: AutolinkCreateRequest{
IsAlphanumeric: true,
KeyPrefix: "TICKET-",
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 598c3576-22dc-4d7f-a72d-4f84922174a1
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d5151527-3286-43fd-a420-38f496a076fa
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 598c3576-22dc-4d7f-a72d-4f84922174a1
williammartin
force-pushed
the
williammartin-migrate-repo-autolink
branch
from
August 4, 2026 09:09
fed5df9 to
c47bc92
Compare
tidy-dev
approved these changes
Aug 4, 2026
tidy-dev
approved these changes
Aug 4, 2026
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Aug 21, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.97.0` → `v2.98.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.98.0`](https://github.com/cli/cli/releases/tag/v2.98.0): GitHub CLI 2.98.0 [Compare Source](cli/cli@v2.97.0...v2.98.0) #### Security A security vulnerability has been identified, and fixed, that binds the local forwarded port to all available network interfaces by default. Users of `gh codespace ports forward` are advised to update `gh` to version `v2.98.0` as soon as possible. For more information see: <GHSA-vfhh-p7hm-pxfh> #### Support worktrees in `pr checkout` Users can now checkout a pull request into a git worktree by using the new `--worktree PATH` flag in `gh pr checkout`: ```shell gh pr checkout 12 --worktree ../wt-feature ``` #### Add semantic search to `search issues` The `gh search issues` command now supports semantic search for issues. Users can select the search type by passing the `--search-type` flag: ```shell gh search issues --search-type semantic ... gh search issues --search-type hybrid ... ``` For more information about semantic search see: ["Improved Search for github issues is now generally available"](https://github.blog/changelog/2026-04-02-improved-search-for-github-issues-is-now-generally-available/). #### What's Changed ##### ✨ Features - Add --worktree flag to gh pr checkout by [@​tidy-dev](https://github.com/tidy-dev) in [#​13946](cli/cli#13946) - Set GH\_EXTENSION=1 when gh invokes an extension by [@​williammartin](https://github.com/williammartin) in [#​14072](cli/cli#14072) - Add --search-type flag for semantic and hybrid issue search by [@​michaeljacholke](https://github.com/michaeljacholke) in [#​14006](cli/cli#14006) ##### 🐛 Fixes - Fix `RESTWithNext` error type, repairing `gh status` and attestation retries by [@​williammartin](https://github.com/williammartin) in [#​13988](cli/cli#13988) - Trim spaces when parsing X-Oauth-Scopes in `gh release create` by [@​williammartin](https://github.com/williammartin) in [#​14065](cli/cli#14065) - Fix project item-add output for non-TTY by [@​zwick](https://github.com/zwick) in [#​14056](cli/cli#14056) ##### 📚 Docs & Chores - Slim down dependabot triage comments by [@​williammartin](https://github.com/williammartin) in [#​14019](cli/cli#14019) - Require explicit MR review ownership by [@​williammartin](https://github.com/williammartin) in [#​14028](cli/cli#14028) - Collapse spam triage into the agentic issue-triage workflow by [@​williammartin](https://github.com/williammartin) in [#​14027](cli/cli#14027) - Run Dependabot triage every hour by [@​sergiou87](https://github.com/sergiou87) in [#​14030](cli/cli#14030) - Route deploy key requests through api.Client by [@​williammartin](https://github.com/williammartin) in [#​13989](cli/cli#13989) - Route ssh key requests through api.Client by [@​williammartin](https://github.com/williammartin) in [#​13994](cli/cli#13994) - Route gpg key requests through api.Client by [@​williammartin](https://github.com/williammartin) in [#​13997](cli/cli#13997) - Route autolink requests through api.Client by [@​williammartin](https://github.com/williammartin) in [#​14013](cli/cli#14013) - Route extension requests through api.Client by [@​williammartin](https://github.com/williammartin) in [#​14059](cli/cli#14059) - Route release creation through api.Client by [@​williammartin](https://github.com/williammartin) in [#​14062](cli/cli#14062) - Tell agents to use the MR template in AGENTS.md by [@​williammartin](https://github.com/williammartin) in [#​14074](cli/cli#14074) - Make Dependabot triage cheaper and more decisive by [@​williammartin](https://github.com/williammartin) in [#​14079](cli/cli#14079) - Route release deletions through api.Client by [@​williammartin](https://github.com/williammartin) in [#​14077](cli/cli#14077) - Give Dependabot triage a real reachability check by [@​williammartin](https://github.com/williammartin) in [#​14087](cli/cli#14087) - Restore automatic spam issue closure by [@​williammartin](https://github.com/williammartin) in [#​14088](cli/cli#14088) - Add a scheduled tech debt burndown skill by [@​williammartin](https://github.com/williammartin) in [#​14095](cli/cli#14095) - Use reflect.Pointer instead of deprecated reflect.Ptr by [@​williammartin](https://github.com/williammartin) in [#​14098](cli/cli#14098) - Clarify what belongs in the MR template's testing section by [@​williammartin](https://github.com/williammartin) in [#​14103](cli/cli#14103) - Rename cli-code-reviewer skill to code-review by [@​BagToad](https://github.com/BagToad) in [#​14116](cli/cli#14116) - Add aw-actions group to dependabot configuration by [@​babakks](https://github.com/babakks) in [#​14123](cli/cli#14123) - Isolate tests from local machine's auth and git configuration by [@​BagToad](https://github.com/BagToad) in [#​14128](cli/cli#14128) - Don't ask for feature detection cleanup comments when not needed by [@​babakks](https://github.com/babakks) in [#​14139](cli/cli#14139) - Accept pre-release tags in deployment validation by [@​BagToad](https://github.com/BagToad) in [#​14193](cli/cli#14193) - ci: add temporary step to verify Linux repo signing keys by [@​babakks](https://github.com/babakks) in [#​14202](cli/cli#14202) - Revert "ci: add temporary step to verify Linux repo signing keys" by [@​babakks](https://github.com/babakks) in [#​14203](cli/cli#14203) - Fix issue triage action compatibility \[skip changelog] by [@​tidy-dev](https://github.com/tidy-dev) in [#​14207](cli/cli#14207) #####Dependencies - chore(deps): bump github.com/sigstore/sigstore-go from 1.2.2 to 1.3.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14047](cli/cli#14047) - chore(deps): bump the codeql-actions group across 1 directory with 3 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14049](cli/cli#14049) - chore(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14048](cli/cli#14048) - chore(deps): bump github.com/google/go-containerregistry from 0.21.7 to 0.21.8 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14066](cli/cli#14066) - chore(deps): bump actions/attest from 4.2.1 to 4.2.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14100](cli/cli#14100) - chore(deps): bump azure/login from 3.0.0 to 3.0.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14101](cli/cli#14101) - chore(deps): bump the codeql-actions group across 1 directory with 3 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14091](cli/cli#14091) - chore(deps): bump github/gh-aw-actions/setup-cli from 0.83.4 to 0.85.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14068](cli/cli#14068) - chore(deps): bump github.com/google/go-containerregistry from 0.21.8 to 0.21.9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14119](cli/cli#14119) - chore(deps): bump github.com/klauspost/compress from 1.19.1 to 1.19.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14120](cli/cli#14120) - chore(deps): bump the aw-actions group with 2 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14147](cli/cli#14147) - chore: sign APT repository with both keys by [@​babakks](https://github.com/babakks) in [#​13271](cli/cli#13271) - chore(deps): bump github.com/yuin/goldmark from 1.8.4 to 1.8.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14029](cli/cli#14029) - chore(deps): bump actions/attest from 4.2.0 to 4.2.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14050](cli/cli#14050) - Bump golangci-lint in CI to v2.12.2 by [@​williammartin](https://github.com/williammartin) in [#​14102](cli/cli#14102) - chore(deps): bump the aw-actions group with 2 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14124](cli/cli#14124) - chore(deps): bump google.golang.org/protobuf from 1.36.11 to 1.36.12 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14140](cli/cli#14140) - Upgrade gh-aw workflows to v0.85.4 by [@​tidy-dev](https://github.com/tidy-dev) in [#​14141](cli/cli#14141) - Bump Go to 1.26.6 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​14143](cli/cli#14143) - chore: bump go to 1.26.7 by [@​babakks](https://github.com/babakks) in [#​14205](cli/cli#14205) - chore(deps): bump github.com/stretchr/testify from 1.11.1 to 1.12.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14204](cli/cli#14204) - chore(deps): bump the codeql-actions group across 1 directory with 3 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14169](cli/cli#14169) - chore(deps): bump golang.org/x/crypto from 0.54.0 to 0.55.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14164](cli/cli#14164) - chore(deps): bump charm.land/lipgloss/v2 from 2.0.5 to 2.0.6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​14166](cli/cli#14166) - Bump gh-aw-actions to v0.87.1 and recompile agentic workflows by [@​BagToad](https://github.com/BagToad) in [#​14210](cli/cli#14210) #### New Contributors - [@​sergiou87](https://github.com/sergiou87) made their first contribution in [#​14030](cli/cli#14030) - [@​michaeljacholke](https://github.com/michaeljacholke) made their first contribution in [#​14006](cli/cli#14006) **Full Changelog**: <cli/cli@v2.97.0...v2.98.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #13991
This PR migrates
repo autolink create,repo autolink delete,repo autolink listandrepo autolink viewto use theapi.Clientfor API interactions. There should be no user visible change.Paths are now built with
safeurl.JoinPathrather thansafeurl.JoinPathWithHostPrefix, becauseapi.Clientprepends the REST prefix itself.The 404 messages for
delete,listandviewpreviously interpolated a locally built URL. They now usehttpErr.RequestURL, which is the URL actually requested. The rendered message is unchanged, and the existing assertions pass untouched.Two status handling details changed. Both are inert against the real API, but are worth recording:
createpreviously treated only201as success (case http.StatusCreated), so any other 2xx fell through toapi.HandleHTTPErrorand surfaced as, for example,HTTP 200 (https://api.github.com/repos/OWNER/REPO/autolinks).api.Client.RESTreturnsnilfor every 2xx, so such a response now decodes normally. GitHub returns201.deletepreviously never read the response body, so any 2xx succeeded.api.Client.RESTreturns early only for204and205, so another 2xx with an empty body would now fail withunexpected end of JSON input. GitHub returns204.listandviewusedif resp.StatusCode > 299, which is already a range check, so they migrate without any change in accepted statuses.We also backfill assertions for the 404 and 500 error paths.
Acceptance Test
There was no acceptance test for
gh repo autolink, so this PR adds one. It needs no third party service: theurlTemplateis an opaque string that GitHub stores and returns, and is never resolved by either GitHub orgh.Notes
This is a stacked PR. It targets #13997.