feat(worker): add PlanningAggregator.CleanupIntegrationBranchAsync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-24 16:34:25 +02:00
parent 1aead9dad0
commit 389d9045d5
3 changed files with 48 additions and 0 deletions

View File

@@ -194,6 +194,26 @@ public class PlanningAggregatorTests : IDisposable
return (parentId, subA, subB);
}
[Fact]
public async Task CleanupIntegrationBranchAsync_RemovesBranchIfPresent()
{
var db = NewDb();
var repo = NewRepo();
GitRepoFixture.RunGit(repo.RepoDir, "branch", "-m", "main");
var (parentId, _, _) = await SeedPlanningWithTwoChildrenAsync(db, repo);
var git = new GitService();
var svc = new PlanningAggregator(db.CreateFactory(), git, NullLogger<PlanningAggregator>.Instance);
var built = await svc.BuildIntegrationBranchAsync(parentId, "main", CancellationToken.None);
var ok = Assert.IsType<CombinedDiffResult.Ok>(built);
await svc.CleanupIntegrationBranchAsync(parentId, CancellationToken.None);
var branches = await git.ListLocalBranchesAsync(repo.RepoDir, CancellationToken.None);
Assert.DoesNotContain(branches, b => b == ok.Value.IntegrationBranch);
}
private void SeedWorktreeWithFile(ClaudeDoDbContext ctx, GitRepoFixture repo, string taskId, string filename, string content)
{
var wtPath = Path.Combine(Path.GetTempPath(), $"wt_{Guid.NewGuid():N}");