Skip to content

fix(ado): detect ADO sign-in HTML response in list and report auth error#1044

Merged
jamesadevine merged 1 commit into
mainfrom
copilot/update-ado-aw-version
Jun 15, 2026
Merged

fix(ado): detect ADO sign-in HTML response in list and report auth error#1044
jamesadevine merged 1 commit into
mainfrom
copilot/update-ado-aw-version

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

ado-aw list failed with Failed to parse definitions response as JSON ... the PAT is invalid or expired even when authenticating via the Azure CLI. ADO serves its AAD sign-in HTML page with a 203 Non-Authoritative Information status; because 203 is a 2xx, is_success() passed and the JSON parser then choked on HTML, producing a misleading, PAT-specific error.

Changes (src/ado/mod.rs):

  • looks_like_ado_signin(status, content_type, body) — flags the sign-in response via 203 status, text/html content type, or an HTML body.
  • ado_signin_error(auth) — auth-method-specific guidance: ****** CLI) advises az login + org/project access; PAT advises regenerating the token.
  • list_definitions — checks the response before JSON parsing and returns the accurate auth error instead of a parse failure.
  • Unit tests for 203, HTML content-type, HTML body, valid-JSON negative case, and per-auth messages.

Scope is limited to the reported list path; the helper is reusable for the other JSON-parsing call sites in src/ado/mod.rs as a follow-up.

Test plan

  • cargo test --bin ado-aw ado:: (90 pass, including 5 new detection tests)
  • cargo clippy --all-targets --all-features (clean)

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review June 15, 2026 22:03
@jamesadevine jamesadevine merged commit 77bee77 into main Jun 15, 2026
@jamesadevine jamesadevine deleted the copilot/update-ado-aw-version branch June 15, 2026 22:04
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