Skip to content

fix(switch): point Enterprise PR 404s at the API host setting - #4734

Merged
max-sixty merged 3 commits into
max-sixty:mainfrom
xunguangzlj-cloud:fix/github-enterprise-404-hint
Nov 21, 2026
Merged

max-sixty merged 3 commits into
max-sixty:mainfrom
xunguangzlj-cloud:fix/github-enterprise-404-hint

Conversation

@xunguangzlj-cloud

@xunguangzlj-cloud xunguangzlj-cloud commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

When a GitHub Enterprise PR lookup has no selected API hostname, a 404 only points at gh repo set-default. That can already be correct even though gh api used its default host.

For a 404 on an explicit Enterprise PR URL, when no API host was selected, the hint names the host for gh auth login and points to forge.hostname if the API host differs. Short PR references keep the ordinary 404 hint because a Git remote can use an SSH alias. Host selection itself stays as in #4710 and #4722.

Checked with the 107 switch PR integration tests, including the new URL, remote, and configured-host cases, and with rustfmt, all-target/all-feature Clippy, doctests, and documentation generation. The full pre-merge hook could not complete locally because pre-commit and cargo insta were unavailable. The tests use a stub gh and do not require an Enterprise account.

Refs #4709

AI assistance was used for the patch and tests.

Review follow-up: the SSH alias and missing-login cases reproduced against the previous head. All 104 matching switch integration tests, all-target/all-feature Clippy, rustfmt, documentation generation, and doctests passed. The full local pre-merge hook still lacks pre-commit and cargo insta.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remote branch of missing_enterprise_hostname also fires for an SSH alias on github.com, the #1790 setup the host selection comment above already calls out. ForgeKind::from_host classifies github-work as GitHub, so with origin = git@github-work:owner/repo.git and no forge.hostname, wt switch pr:<wrong number> now tells a github.com user to set an Enterprise API host. The 404 really is "no such PR", so the old hint was the right one there. Details are inline.

Comment thread src/git/remote_ref/github.rs Resolved
Comment thread src/git/remote_ref/github.rs Resolved
@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot please make this one hint, per writing-user-outputs: the suggestions joined with semicolons, with the command most people need last. Then it can merge.

This was written by Claude Code on behalf of max-sixty

Semicolon-joined per writing-user-outputs, with gh auth login last as the
command most readers need.
@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Done in 794cc67. The Enterprise 404 hint is now one line, with gh auth login last:

To query a different repository, run gh repo set-default; if the {host} API uses a different host, set forge.hostname to that host; to sign in to {host}, run gh auth login --hostname {host}

CI, including codecov/patch, is green at that head. Merge mode here is restricted, so I'm leaving the merge to you.

@max-sixty
max-sixty merged commit d425061 into max-sixty:main Nov 21, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants