Skip to content

Fix misleading auth status output and a status panic on malformed API URLs - #152

Merged
sawka-harness merged 3 commits into
mainfrom
sawka/auth-fixes
Aug 26, 2026
Merged

Fix misleading auth status output and a status panic on malformed API URLs#152
sawka-harness merged 3 commits into
mainfrom
sawka/auth-fixes

Conversation

@sawka-harness

Copy link
Copy Markdown
Collaborator

Summary

  • harness auth status now validates the API URL independently even when auth
    resolution fails (e.g. missing/mismatched token) — it doesn't need a credential,
    so there's no reason to skip it.
  • Account/Org/Project rows show their known value with "not verified" instead of
    blanking to "skipped" when we have the value from the profile but couldn't
    confirm it against the API.
  • Fixed a nil-pointer panic in checkAPIUrl: url.Parse returns (nil, err) on
    a malformed API URL (e.g. hand-edited api_url: "://bad"), and the old code
    dereferenced the nil result via u.Hostname().
  • SaveCredentials now writes profiles in sorted order instead of Go's randomized
    map iteration order, so the credentials file doesn't reshuffle on every write.

Test plan

  • go build ./..., go vet ./..., go test ./... all pass
  • Manually reproduced and verified against a fake HARNESS_CLI_HOME:
    • SSO credentials present but profile configured as PAT (the original repro) →
      Account/Org/Project now show ✗ <value> — not verified instead of skipped
    • Profile with no org/project set → still shows not set correctly
    • No profile at all → unaffected, still shows skipped
    • Malformed api_url → no longer panics; shows a proper validation error

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

AI-Session-Id: 5b600f1c-f662-436c-8248-71924c58b6db
AI-Tool: claude-code
AI-Model: unknown

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
@sawka-harness
sawka-harness merged commit be9826c into main Aug 26, 2026
1 check 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.

1 participant