Repository navigation
fix(doctor): report the token the push actually uses, and say the Gitea fallback is push-only - #1155
Conversation
…ea fallback is push-only
There was a problem hiding this comment.
The Gitea push-only wording matches what github_token_fallback and build_forge_instance actually do, and token_check taking is_set as a closure makes the five new tests honest (no env mutation, no ENV_LOCK). token_env_vars is the right source for the variable list: FORGEJO_TOKEN counting for Gitea and the unknown-forge case no longer going green on GITHUB_TOKEN are both real fixes.
One blocking gap: the forge resolution here still differs from the one the push uses, so a self-hosted GitLab gets the wrong answer. Details inline, plus a nit on probing when the forge is configured explicitly.
There was a problem hiding this comment.
Both findings from the previous review are fixed in db2c6e0, threads replied to and resolved.
resolve_forge puts the push, the preview and doctor on one resolution order, and the three new tests pin it (explicit over host name, gitlab host without a probe, unknown host staying None when probing is skipped). Nothing new in the changed code.
## [7.24.4] - 2026-09-22 ### Bug Fixes - fix(doctor): report the token the push actually uses, and say the Gitea fallback is push-only (#1155)
Closes #1154. Follow-up to the review on #1152. The third point from that review, the probe now carrying security weight, is filed as #1153.
The Gitea fallback warning says it is push-only
On Gitea / Forgejo with only
GITHUB_TOKEN, the push still falls back to it, but release creation readsGITEA_TOKEN/FORGEJO_TOKENand is skipped (build_forge_instancereturnsNoneand the release block is anif let Some). The warning now says so:doctorreports the token the push actually usestoken_envbecomestoken_check(forge, is_set), which returns theCheckitself. It takes the "is this variable set" test as a closure so it can be tested without touching the environment.GITHUB_TOKENno longer turns the check green. It warns that the token is only sent to a remote recognised as GitHub, and points atworkspace.forgeorFERRFLOW_TOKEN. Before,doctorprintedauth token: GITHUB_TOKEN is setright under its own "could not detect the forge" warning.ForgeKind::token_env_vars, the list the push and the API use.FORGEJO_TOKENnow counts for Gitea, where it was reported as missing.GITHUB_TOKEN: a warning that it covers the push until the next major, but releases needGITEA_TOKEN or FORGEJO_TOKEN.--online: the forge is detected with the same probe the push uses, so a self-hosted forge the probe recognises is reported as that forge. Offline, the "could not detect" warning now mentions--online.One forge resolver for push, API and doctor
Review found that
doctorstill resolved the forge differently from the push. The push (git::auth::forge_of) treated a host containinggitlabas GitLab before probing.doctorhad no such shortcut, so ongitlab.corp.com, offline or with the probe blocked, it reported "forge unknown, only FERRFLOW_TOKEN is used" while the push authenticated withGITLAB_TOKEN.monorepo::preview::forge_target, the API side, also probed without the shortcut.forge::resolve_forge(url, configured, Probe)is now the one resolver, used by all three:workspace.forgegitlabProbe::AllowedThe push and the API always allow the probe.
doctorallows it only with--online, and never probes whenforgeis set explicitly (the probe used to run and be discarded).git::auth::forge_ofandis_gitlabare gone.One visible effect on the API side: a host containing
gitlabis now taken as GitLab without probing, as the push already did since #1124.Tests
Five new
doctortests ontoken_check:GITHUB_TOKENalone on an unknown forge warnsFERRFLOW_TOKENis enough for any forgeFORGEJO_TOKENcounts for GiteaGITHUB_TOKENwarns that releases need their own tokenThree
resolve_forgetests: a configured forge beats the host name, a host naminggitlabresolves without a probe, and an unknown host stays unresolved when probing is skipped while a SaaS host still resolves.Full suite: 2513 passed.
Docs: the
doctorsection ofreference/cli.md(EN, FR) describes the Forge check and--onlineaccordingly.