feat(worker): surface task numbers in MCP tool return payloads

Adds Number alongside every task id in External/'s DTOs -- the two
central mappers (ToDto/ToRefDto -> TaskDto/TaskRefDto) plus every
DTO that carries a bare task id and bypasses them (batch results,
queue state, wait-for-change, config, attachments, handoff,
lifecycle, merge-preview-set, worktree list). Input resolution
(#123 as an argument) stays for slice 3.
This commit is contained in:
mika kuns
2026-08-11 11:59:51 +02:00
parent 8da1a12389
commit 106c964410
12 changed files with 129 additions and 64 deletions
@@ -217,6 +217,18 @@ public sealed class ExternalMcpServiceTests : IDisposable
Assert.Equal("new title", dto.Title);
}
[Fact]
public async Task GetTask_ReturnsTaskNumber()
{
var listId = await SeedListAsync();
var task = await SeedTaskAsync(listId);
var sut = BuildSut(CreateQueue());
var dto = await sut.GetTask(task.Id, CancellationToken.None);
Assert.Equal(task.Number, dto.Number);
}
[Fact]
public async Task GetTask_ReturnsFullDtoIncludingDescription()
{
@@ -1281,6 +1293,7 @@ public sealed class ExternalMcpServiceTests : IDisposable
Assert.Null(result.TasksFull);
Assert.Single(result.Tasks!);
Assert.Equal(task.Id, result.Tasks![0].Id);
Assert.Equal(task.Number, result.Tasks![0].Number);
}
[Fact]
@@ -1299,6 +1312,7 @@ public sealed class ExternalMcpServiceTests : IDisposable
Assert.NotNull(result.TasksFull);
Assert.Single(result.TasksFull!);
Assert.Equal("the full description", result.TasksFull![0].Description);
Assert.Equal(task.Number, result.TasksFull![0].Number);
}
// ── MergeTask allowWaitingForReview ───────────────────────────────────────
@@ -2341,6 +2355,19 @@ public sealed class ExternalMcpServiceTests : IDisposable
Assert.Equal("dotnet build", fakeVerify.CapturedCommand);
}
[Fact]
public async Task AddTask_ReturnsAllocatedTaskNumber()
{
var listId = await SeedListAsync();
var sut = NewService();
var dto = await sut.AddTask(listId, "t", cancellationToken: CancellationToken.None);
var loaded = await _tasks.GetByIdAsync(dto.Task.Id);
Assert.True(dto.Task.Number > 0);
Assert.Equal(loaded!.Number, dto.Task.Number);
}
// ── AddTask model override ────────────────────────────────────────────────
[Fact]