Azure / Azure/azure-sdk-tools

[APIView] WI-13: PR Cleanup via Retention

Open
#15,004 0 comments 0 reactions 0 assignees View on GitHub
APIView
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 2h
Merged PRs (30d)
130

Description

## Goal

Use the unified retention system for PR version lifecycle instead of ad-hoc `CleanupPullRequestData`.

**Area:** PR Lifecycle · **Depends on:** WI-5, WI-10 · **Stable alone:** ✅ Yes

## Deliverables

### Replace `CleanupPullRequestData` with version-level retention

1. PR transitions to `Merged` (non-promoted): set `RetainUntil = now + MergedPullRequestDays` (default 60d)
2. PR transitions to `Closed`: set `RetainUntil = now + ClosedPullRequestDays` (default 30d)
3. WI-5 purge loop handles actual deletion
4. Promoted PRs: `RetainUntil` cleared (become `Stable`/`Preview`, follow those rules)

Existing `PullRequestBackgroundHostedService` (async PR comment posting) unchanged.

### Tests

- `PullRequestCleanupTests.cs` — Merged non-promoted gets 60d; closed gets 30d; promoted clears `RetainUntil`

Contributor guide

Open the contributing guide

Research direction

Start with PullRequestCleanupTests.cs and trace the PR lifecycle code that currently uses CleanupPullRequestData. Check how merged, closed, and promoted transitions interact with the WI-5 purge loop, while leaving PullRequestBackgroundHostedService unchanged. Done means the tests verify 60-day merged retention, 30-day closed retention, and cleared retention for promoted PRs.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.