fix(worker): allow the done toggle from any non-Running status
MarkDoneAsync was Idle-only, so a finished task (typically a list-handler run with no worktree to merge) could not be ticked off. Guard on Running instead and cover the other statuses with tests.
This commit is contained in:
@@ -98,6 +98,21 @@ public sealed class TaskDoneDequeueHubTests : IDisposable
|
||||
Assert.Equal(TaskStatus.Running, reloaded!.Status);
|
||||
}
|
||||
|
||||
// Regression: the guard was Idle-only, so a finished task (typically a list-handler run,
|
||||
// which has no worktree to merge) could no longer be ticked off from the task card.
|
||||
[Fact]
|
||||
public async Task SetTaskDone_FromWaitingForReview_TransitionsToDone()
|
||||
{
|
||||
var listId = await SeedListAsync();
|
||||
var task = await SeedTaskAsync(listId, TaskStatus.WaitingForReview);
|
||||
|
||||
var hub = CreateHub();
|
||||
await hub.SetTaskDone(task.Id);
|
||||
|
||||
var reloaded = await _tasks.GetByIdAsync(task.Id);
|
||||
Assert.Equal(TaskStatus.Done, reloaded!.Status);
|
||||
}
|
||||
|
||||
// ── UnsetTaskDone ──
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user