Fix misleading auth status output and a status panic on malformed API URLs - #152
Merged
Conversation
When auth resolution fails, auth status now still validates the API URL and shows Account/Org/Project as "not verified" using values already known from the profile, instead of blanking every downstream row as "skipped". Also fixes a nil-pointer panic in checkAPIUrl on a malformed API URL, and sorts profile names when writing the credentials file so it doesn't reshuffle on every save. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> AI-Session-Id: 5b600f1c-f662-436c-8248-71924c58b6db AI-Tool: claude-code AI-Model: unknown
A profile that was never created shouldn't print a table full of skipped/not-verified rows -- that's for profiles that exist but have bad or missing credentials. Return the clean "not found"/"not logged in" error directly instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> AI-Session-Id: 5b600f1c-f662-436c-8248-71924c58b6db AI-Tool: claude-code AI-Model: unknown
# Conflicts: # modules/core/auth/status.go
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
harness auth statusnow validates the API URL independently even when authresolution fails (e.g. missing/mismatched token) — it doesn't need a credential,
so there's no reason to skip it.
blanking to "skipped" when we have the value from the profile but couldn't
confirm it against the API.
checkAPIUrl:url.Parsereturns(nil, err)ona malformed API URL (e.g. hand-edited
api_url: "://bad"), and the old codedereferenced the nil result via
u.Hostname().SaveCredentialsnow writes profiles in sorted order instead of Go's randomizedmap iteration order, so the credentials file doesn't reshuffle on every write.
Test plan
go build ./...,go vet ./...,go test ./...all passHARNESS_CLI_HOME:Account/Org/Project now show
✗ <value> — not verifiedinstead ofskippednot setcorrectlyskippedapi_url→ no longer panics; shows a proper validation errorCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com
AI-Session-Id: 5b600f1c-f662-436c-8248-71924c58b6db
AI-Tool: claude-code
AI-Model: unknown