Skip to content

docs(core): give key_for the reason that still holds - #1823

Merged
mergify[bot] merged 2 commits into
mainfrom
devs/sileht/mrgfy-8703-cli-auth-commands/give-key-reason-still-holds--bd81a3c5
Sep 11, 2026
Merged

docs(core): give key_for the reason that still holds#1823
mergify[bot] merged 2 commits into
mainfrom
devs/sileht/mrgfy-8703-cli-auth-commands/give-key-reason-still-holds--bd81a3c5

Conversation

@sileht

@sileht sileht commented Sep 10, 2026

Copy link
Copy Markdown
Member

key_for files https://host/api and https://host/api/ under one
entry, and its comment justified that by saying every request "replaces
the base path outright". That stopped being true with #1819, which made
Client::join() append a request path to the base's path prefix
instead of replacing it, so GitHub Enterprise's /api/v3 survives.

The conclusion did not change, only the reason. join() now gives the
base a trailing slash and strips the path's leading one, so both
spellings send /v1/user to https://host/api/v1/user, and one
credential entry for both is still right. The comment now says that.

Comment only.

Fixes MRGFY-8703

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

Depends-On: #1808

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 10, 2026 12:58 Failure
@sileht

sileht commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(core): never send a Mergify user token to GitHub #1808
2 docs(core): give key_for the reason that still holds #1823 👈

@sileht
sileht deployed to func-tests-live September 10, 2026 12:58 — with GitHub Actions Active
@mergify

mergify Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 7 merge protections satisfied — ready to merge.

Show 7 satisfied protections

🟢 ⛓️ Depends-On Requirements

Requirement based on the presence of Depends-On in the body of the pull request

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot requested a review from a team September 10, 2026 13:05
@sileht
sileht marked this pull request as ready for review September 10, 2026 15:30
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba branch from a87db99 to 5ca96d3 Compare September 11, 2026 13:04
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/give-key-reason-still-holds--bd81a3c5 branch from a251656 to 1af1f28 Compare September 11, 2026 13:04
@sileht

sileht commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial a251656 2026-09-11 13:04 UTC
2 rebase a251656 → 1af1f28 (rebase only) 2026-09-11 13:04 UTC
3 rebase 1af1f28 → d097def (rebase only) 2026-09-11 13:37 UTC

@sileht
sileht deployed to func-tests-live September 11, 2026 13:04 — with GitHub Actions Active
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 11, 2026 13:05 Failure
sileht and others added 2 commits September 11, 2026 15:26
`MERGIFY_TOKEN` is the natural place to put the credential
`mergify auth login` mints, and `stack` reads that same variable for its
GitHub calls. A user who exports one would get `401 Bad credentials` from
api.github.com, which says nothing about why.

Skip it there. The cost is nothing: `mut_` is Mergify's prefix,
registered with GitHub's own secret scanning, so a value carrying it was
never going to authenticate against GitHub. `stack` falls through to
`GITHUB_TOKEN` or `gh auth token` as it would have if the variable were
unset.

`gh auth token` needs the same check, and not only because somebody
could have logged `gh` in with the wrong string: it prints
`$GITHUB_TOKEN` when that variable is set, so skipping the variable
does not, on its own, keep its value out of the request -- the
fallback hands the same token straight back. That is the GitHub
Actions case, where `GITHUB_TOKEN` is exported for you. So the check
is on the value, wherever it came from.

The failure says so, and names the variable it actually skipped.
Telling someone to set `MERGIFY_TOKEN` when they have set it, and it
was skipped for a reason visible only at `-vv`, is the worst version
of this message -- and `GITHUB_TOKEN` can carry a `mut_` value too,
since it is the variable GitHub Actions already exports and therefore
at least as likely a place to paste an `auth login` token. There the
old wording named `MERGIFY_TOKEN`, which is unset, and prescribed
`GITHUB_TOKEN`, which is the broken one. Where `gh` is one of the
sources skipped it is installed and authenticated already, so the
message asks for a login to a GitHub account rather than an install.

An explicit `--token` is not second-guessed. The user aimed it at this
command, and quietly using a different credential instead would be the
more surprising failure of the two.

This is a failure mode the rest of this stack creates -- there was no
reason to hold a `mut_` token before it -- which is why it lands here
rather than as a separate ticket.

Fixes MRGFY-8703

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: If3c422baf7dde5e912971015b991046ccbc886eb
`key_for` files `https://host/api` and `https://host/api/` under one
entry, and its comment justified that by saying every request "replaces
the base path outright". That stopped being true with #1819, which made
`Client::join()` append a request path to the base's path prefix
instead of replacing it, so GitHub Enterprise's `/api/v3` survives.

The conclusion did not change, only the reason. `join()` now gives the
base a trailing slash and strips the path's leading one, so both
spellings send `/v1/user` to `https://host/api/v1/user`, and one
credential entry for both is still right. The comment now says that.

Comment only.

Fixes MRGFY-8703

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: Ibd81a3c529cb558d9e67d061ffe1d3d02dad2e34
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/give-key-reason-still-holds--bd81a3c5 branch from 1af1f28 to d097def Compare September 11, 2026 13:37
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba branch from 5ca96d3 to b93aca3 Compare September 11, 2026 13:37
@sileht
sileht deployed to func-tests-live September 11, 2026 13:37 — with GitHub Actions Active
@mergify
mergify Bot deployed to Mergify Merge Protections September 11, 2026 13:37 Active
Base automatically changed from devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba to main September 11, 2026 13:58
@mergify
mergify Bot requested a review from a team September 11, 2026 14:28
@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 7 minutes 36 seconds in the queue, including 7 minutes 15 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Sep 11, 2026
@mergify
mergify Bot merged commit 5d8b1c1 into main Sep 11, 2026
22 of 42 checks passed
@mergify
mergify Bot deleted the devs/sileht/mrgfy-8703-cli-auth-commands/give-key-reason-still-holds--bd81a3c5 branch September 11, 2026 15:34
@mergify mergify Bot removed the queued label Sep 11, 2026
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