fix(auth): provide ADO-specific authentication error message for dev.…#742
Conversation
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Pull request overview
This PR improves authentication failure diagnostics for Azure DevOps (dev.azure.com) by emitting ADO-specific remediation guidance (instead of GitHub-centric steps) when no token is available, and suppressing the per-org GitHub token hint for ADO hosts.
Changes:
- Update
AuthResolver.build_error_context()to detect ADO hosts and print anADO_APM_PAT/Code (Read) guidance message when no token is found. - Suppress the per-org GitHub PAT hint for ADO hosts.
- Add unit tests covering ADO-specific error context behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/apm_cli/core/auth.py | Adds ADO-specific error messaging in build_error_context() and suppresses GitHub per-org hint for ADO. |
| tests/unit/test_auth.py | Adds tests to assert ADO-specific remediation text and absence of GitHub-specific hints. |
…azure.com PR Copilot suggestions
…azure.com PR.2 Implementing Copilot suggestions
sergio-sisternes-epam
left a comment
There was a problem hiding this comment.
Clean fix! Good use of the existing host_info classification to branch the error context. The test coverage is thorough -- covering both dev.azure.com and legacy visualstudio.com hosts, with-token and no-token paths, and properly asserting that GitHub-specific hints (SAML, gh auth login, per-org PAT) are suppressed for ADO.
Approving -- thanks @coakenfold!
Description
When authentication fails against an Azure DevOps (
dev.azure.com) host, the error message incorrectly displayed generic GitHub remediation steps (Set GITHUB_APM_PAT or GITHUB_TOKEN, or run 'gh auth login'). This is confusing for ADO users who need to setADO_APM_PATinstead.The fix detects ADO hosts in
build_error_contextand emits an ADO-specific message:The per-org GitHub token hint is also suppressed for ADO hosts since it doesn't apply.
Fixes #625
Type of change
Testing