Azure / Azure/azure-sdk-tools

[APIView] WI-10: PR Version Backfill & Status Tracking

Open
#15,001 0 comments 0 reactions 1 assignee Claimed by @tjprescott View on GitHub
APIView
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
144

Description

## Goal

Every PR revision in the database has an `APIVersionId`, and PR versions have `PRStatus`.

**Area:** PR Lifecycle · **Depends on:** WI-3 · **Stable alone:** ✅ Yes — backfills FK on historical PR revisions; nothing reads via new paths yet

## Deliverables

### Backfill existing PR versions

WI-2 forward-tagged new PR revisions. This covers pre-WI-2 PR revisions:
1. Query PR revisions where `APIVersionId == null`
2. Group by `PullRequestNo` (or `SourceBranch` where PR number absent) per review
3. Create `APIVersionModel` with `Kind = PullRequest`, `VersionIdentifier = "PR#{pullRequestNo}"`
4. Set `APIVersionId` on each revision and its associated comments

### Populate `PRStatus`

- Query GitHub API (via existing Octokit integration) for current state of each PR
- Set `PRStatus = Open`, `Merged`, or `Closed`
- For new PRs going forward, `PullRequestManager.CreateAPIRevisionIfAPIHasChanges` sets `PRStatus = Open`

### Tests

- `PRBackfillTests.cs` — PR revisions grouped by PR number; PRStatus populated; comments linked

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.