Skip to content

errors: add source-aware auth error hints#123

Merged
somanshreddy merged 4 commits intomainfrom
04-27-errors_add_source-aware_auth_error_hints
Apr 28, 2026
Merged

errors: add source-aware auth error hints#123
somanshreddy merged 4 commits intomainfrom
04-27-errors_add_source-aware_auth_error_hints

Conversation

@somanshreddy
Copy link
Copy Markdown
Collaborator

@somanshreddy somanshreddy commented Apr 27, 2026

Description

PostHog analytics (Apr 21-27) showed 103 installs hitting auth_error or unauthorized
across commands like video list, avatar list, and lipsync get. Only auth status
had any auth hint; every other command returned the bare API message with no guidance
on what to fix.

This PR centralizes auth hint enrichment so every command that hits a 401/403 gets
source-aware guidance:

  • env key: tells the user their HEYGEN_API_KEY env var is invalid/expired and
    links to the API key page
  • file key: points to the credentials file path and suggests heygen auth login
  • no key configured: preserves the existing full auth guidance (unchanged)

Enrichment runs once in the centralized error path (main.go after ExecuteC()),
not scattered across individual commands. auth status's manual hint injection is
removed since it's now handled centrally.

Testing

  • chain_resolver_test.go: ResolveWithSource returns correct source for env, file, and neither-configured cases
  • context_test.go: env-source 401, file-source 401, non-auth errors are untouched, existing hints are preserved
  • Updated auth_status_test.go to verify centralized hint
  • make test passes (Linux, macOS, Windows)

🤖 Generated with Claude Code

somanshreddy and others added 4 commits April 27, 2026 22:18
…e resolved credentials path

Co-Authored-By: Claude Opus 4.6 <[email protected]>
JSON-encode the expected path before matching against stderr output.
On Windows, filepath backslashes are doubled in JSON but not in the
Go filepath string.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Tests for enrichAuthHint live alongside their source in context.go.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@somanshreddy somanshreddy force-pushed the 04-27-errors_add_source-aware_auth_error_hints branch from 32d8eef to 7788985 Compare April 27, 2026 22:18
@somanshreddy somanshreddy merged commit a04bec5 into main Apr 28, 2026
9 checks passed
@somanshreddy somanshreddy deleted the 04-27-errors_add_source-aware_auth_error_hints branch April 28, 2026 05:37
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.

2 participants