feat(worker): allow cancelling a WaitingForChildren parent
Add WaitingForChildren to the CancelAsync guard so a parent waiting on its children can be cancelled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,27 @@ public sealed class WaitingForChildrenLifecycleTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WaitingForChildren_parent_can_be_cancelled()
|
||||
{
|
||||
using (var ctx = _db.CreateContext())
|
||||
{
|
||||
ctx.Lists.Add(new ListEntity { Id = "l1", Name = "L", CreatedAt = DateTime.UtcNow });
|
||||
ctx.Tasks.Add(new TaskEntity { Id = "par", ListId = "l1", Title = "Parent",
|
||||
Status = TaskStatus.WaitingForChildren, CreatedAt = DateTime.UtcNow });
|
||||
await ctx.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var result = await _built.State.CancelAsync("par", DateTime.UtcNow, default);
|
||||
|
||||
Assert.True(result.Ok);
|
||||
using (var ctx = _db.CreateContext())
|
||||
{
|
||||
var par = await new TaskRepository(ctx).GetByIdAsync("par");
|
||||
Assert.Equal(TaskStatus.Cancelled, par!.Status);
|
||||
}
|
||||
}
|
||||
|
||||
// ─── FinalizePlanningAsync ────────────────────────────────────────────
|
||||
|
||||
private async Task<string> SeedActivePlanningParentAsync(string id = "par")
|
||||
|
||||
Reference in New Issue
Block a user