[Fix] Azure DevOps connectionData requests always fail with a 400 - #896
Merged
Conversation
Azure DevOps only serves /_apis/connectionData at preview api-versions: plain 7.1 (and 7.0) always answer 400 with "The -preview flag must be supplied". That made getAdoDeploymentUser throw on every call, silently degrading Roomote's own-comment detection on ADO PR and work item comments (isDeploymentTokenAuthor fails open), and broke ADO approve/request-changes reviewer votes, which resolve the voting identity through the same resource. Use a dedicated ADO_CONNECTION_DATA_API_VERSION = '7.1-preview' for the two connectionData call sites, matching the constant apps/web already uses for its vssps connectionData probe. The shared ADO_API_VERSION stays 7.1 for the GA resources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
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.
Problem
Azure DevOps only serves
/_apis/connectionDataat preview api-versions. Requesting it with the shared GA version fails on every call:Two features depended on that call and were silently broken:
getAdoDeploymentUserthrew on every call, soisDeploymentTokenAuthorfailed open (aconsole.warnandfalse), leaving only the name-prefix check to keep Roomote from reacting to comments it posted itself.submit_pull_request_reviewwith approve/request_changes resolves the voting identity through the same resource before casting the vote, so ADO reviewer votes always failed.Fix
A dedicated
ADO_CONNECTION_DATA_API_VERSION = '7.1-preview'constant for the two connectionData call sites (packages/adoandpackages/sdk), matching the constantapps/web/src/lib/server/auth.tsalready uses for its vssps connectionData probe. The sharedADO_API_VERSIONstays7.1for the GA resources. Test URL assertions now pin the-previewsuffix so this cannot regress silently.Verification
getAdoDeploymentUserlive: it resolves the deployment identity where it previously threw.isDeploymentTokenAuthordetects Roomote's own comments. (The existingnormalizeAdoLinkedAccountKeydocblock caveat about vssps vs org identity ids applies to Entra OAuth, not PAT.)@roomote/adosuite (41), sdk pull-request-writes tests (13), and all ADO handler tests inapps/api(60) pass;tsc --noEmitclean on both packages.Context: found as a follow-up to #888, whose credential probe hit the same 400 and deliberately switched to
/_apis/git/repositoriesinstead of touchinggetAdoDeploymentUser.🤖 Generated with Claude Code