fix(desktop): classify git credential prompt failures as authentication - #5561
Open
TheSeydiCharyyev wants to merge 1 commit into
Open
fix(desktop): classify git credential prompt failures as authentication#5561TheSeydiCharyyev wants to merge 1 commit into
TheSeydiCharyyev wants to merge 1 commit into
Conversation
`projectRepoUnavailableReason` had no pattern for git's `could not read Username/Password` error, so a failed credential lookup fell through to `unknown`. The Projects repo browser then showed "Repository unavailable — try again or contact the project owner" for what is a local credential problem, which sends the user after the wrong thing. This is reachable on any git older than 2.46: `git-credential-nostr` requires the credential-protocol `authtype` capability and exits silently without it, so git reports `could not read Username` and never reaches the relay's 401 that the existing patterns match on. The panel now shows "Repository access failed — Buzz could not authenticate with this repository." Refs block#5348 Signed-off-by: Seydi Charyyev <seydi.charyev@gmail.com>
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.
Summary
could not read Username/could not read Passwordasauthenticationinstead ofunknownThis is suggestion 3 from #5348. It is a subset, not the whole issue — see Scope below.
Why
projectRepoUnavailableReasonmatches401,403,authenticat,authoriz,permission deniedandaccess denied. git's credential-prompt failure looks like none of those:So it fell through to
unknown, and the panel blamed the project owner for a problem that is local to the user's machine.The path is easy to reach.
git-credential-nostrneeds the credential-protocolauthtypecapability, which arrived in git 2.46. On an older git the helper exits silently, no credential is supplied, and git prints the error above. The relay's 401 never reaches the classifier, so no existing pattern can match.Scope
Only the message classification. #5348 also suggests version-aware
gitresolution and a typed error from the snapshot command; both sit insrc-tauriand are larger changes. The reporter wrote "any subset", so I took the one that is self-contained.Worth saying plainly: this improves the message, it does not fix the underlying setup. A user on git 2.39 still cannot clone. But "Buzz could not authenticate" points at the right thing, and
unknowndid not.Validation
projectRepoAvailability.ts(expected 'unknown' to equal 'authentication') and passes with the change. The other 9 tests in the file are unaffected in both runs.pnpm --filter buzz test— 4,605 passedpnpm --filter buzz exec tsc --noEmitpnpm --filter buzz check— biome, file sizes, px-text, pubkey truncationI also checked the classifier by hand against four strings before writing the fix: both credential-prompt variants returned
unknown, whileThe requested URL returned error: 403returnedauthenticationandremote: Repository not foundreturnedmissing. Only the credential path was wrong.