feat(review): add Azure DevOps PR review support#414
Open
jmbp1999 wants to merge 1 commit intobacknotprop:mainfrom
Open
feat(review): add Azure DevOps PR review support#414jmbp1999 wants to merge 1 commit intobacknotprop:mainfrom
jmbp1999 wants to merge 1 commit intobacknotprop:mainfrom
Conversation
Adds full Azure DevOps pull request review support as a first-class platform alongside GitHub and GitLab, following the same provider pattern (pr-provider.ts dispatch → platform-specific implementation). ## What's new ### URL parsing - `https://dev.azure.com/{org}/{project}/_git/{repo}/pullrequest/{id}` - `https://{org}.visualstudio.com/{project}/_git/{repo}/pullrequest/{id}` (legacy) - URL-encoded project/repo names decoded automatically - Case-insensitive `pullrequest` segment ### PR diff strategy 1. Try `git diff <baseSha>..<headSha>` locally (fast path) 2. If commits not present, try `git fetch origin` + retry 3. Fall back to ADO REST API: iterates PR change entries, fetches old/new file content at the base/head SHAs, builds a git-style unified diff using a self-contained LCS diff engine (no deps) ### Submitting reviews - General comments → `POST /threads` via ADO REST API - Inline file comments → `POST /threads` with `threadContext` position - Approve → `PUT /reviewers/{userId}` with `vote: 10` - User ID resolved from `_apis/connectionData` at submit time ### Auth - All `az rest` calls use `--resource 499b84ac-1321-427f-aa17-267ca6975798` to acquire an ADO-scoped token (ARM token rejected by ADO APIs) - `az repos pr show` uses ADO extension which handles auth natively ### UI - `AzureDevOpsIcon` component added to `packages/ui/components/` - Review destination button shows the ADO icon when reviewing ADO PRs - `@plannotator/ui/config` export added to `packages/ui/package.json` (was missing — `config/index.ts` existed but was undeclared) ### Types - `AzureDevOpsPRRef` and `AzureDevOpsPRMetadata` added to `pr-provider.ts` - `Platform` union extended to `"github" | "gitlab" | "azuredevops"` - All label helpers (`getPlatformLabel`, `getMRLabel`, etc.) updated - New types re-exported from `packages/server/pr.ts` ### Tests (22 new) - Full URL parsing coverage (dev.azure.com, visualstudio.com, encoded, case-insensitive, large IDs) - GitHub/GitLab regression tests - `buildFilePatch`: add/edit/delete/rename, empty diff, no-trailing-newline, hunk merging for nearby changes, hunk splitting for distant changes - `computeHunks`: identical, add, delete, replace ## Prerequisites (user-side) ```bash brew install azure-cli az extension add --name azure-devops az login ``` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Adds full Azure DevOps pull request review as a first-class platform alongside GitHub and GitLab, following the same provider pattern used throughout the codebase.
What's included
New platform support
dev.azure.comand legacyvisualstudio.comPR URLspullrequestsegmentDiff fetching (two-stage fallback)
git diff <baseSha>..<headSha>locally (fast path — works when repo is cloned)Review submission
POST /threadsvia ADO REST APIPOST /threadswiththreadContextposition infoPUT /reviewers/{userId}withvote: 10; user ID resolved from_apis/connectionDataaz restcalls use--resource 499b84ac-1321-427f-aa17-267ca6975798to get an ADO-scoped token (ARM token is rejected by ADO APIs)UI
AzureDevOpsIconcomponent added@plannotator/ui/configexport inpackages/ui/package.json(theconfig/directory existed but was not declared in exports)New types
AzureDevOpsPRRef,AzureDevOpsPRMetadatainpr-provider.tsPlatformunion extended:github | gitlab | azuredevopsgetPlatformLabel,getMRLabel,getMRNumberLabel,getDisplayRepo,getCliName,getCliInstallUrl) updatedpackages/server/pr.tsTests
22 new tests in
packages/shared/pr-azuredevops.test.ts:dev.azure.com,visualstudio.com, URL-encoded names, case-insensitive, large IDsbuildFilePatch: add/edit/delete/rename, identical files, no trailing newline, hunk merging, hunk splittingcomputeHunks: identical, add, delete, replaceAll 170 tests pass (148 pre-existing + 22 new).
Prerequisites (user-side)
Usage
Test plan