DelegateAPIViewFeedbackTool: RevisionLabel not populated for staging APIView URLs
- Dominant language
- C#
- Stars
- 135
- Forks
- 260
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 144
Description
## Problem
When `DelegateAPIViewFeedbackTool` is invoked with a staging APIView URL (e.g. `https://spa.apiviewstagingtest.com/...`), the `RevisionLabel` field is never populated, which means `DetectShaAndTspPath` cannot determine the commit SHA or TypeSpec project path.
## Root Cause
`ParseRevisionLabel` in `APIViewFeedbackService.cs` constructs the URL passed to the Resolve endpoint by hardcoding `https://apiview.dev`:
```csharp
var resolveUrl = $"https://apiview.dev/review/{metadata.ReviewId}?activeApiRevisionId={revisionId}";
```
When the input URL is `https://spa.apiviewstagingtest.com/...`, the staging backend receives a production `apiview.dev` URL as the query parameter, returns a response with no `revisionLabel` field, and `RevisionLabel` stays null.
This is confirmed by the dry-run log:
```
Calling Resolve endpoint for URL: https://apiview.dev/review/85abc443...
Resolve response received: {"packageName":"com.azure:azure-ai-contentsafety","language":"Java","reviewId":"...","version":"1.1.0-beta.1","revisionId":"..."}
Resolve response does not contain revisionLabel field
```
## Fix
Derive the host from `originalApiViewUrl` instead of hardcoding `apiview.dev`:
1. Thread the original APIView URL through `ParseReviewMetadata` → `ParseRevisionLabel`
2. In `ParseRevisionLabel`, derive the base URL from it:
```csharp
var uri = new Uri(originalApiViewUrl);
var resolveUrl = $"{uri.Scheme}://{uri.Host}/review/{metadata.ReviewId}?activeApiRevisionId={revisionId}";
```
## Impact
Staging URLs produce issues without a commit SHA or TypeSpec path, forcing Copilot to search for the spec directory manually instead of targeting the exact revision.
Contributor guide
Assessment
This issue has not been assessed yet.