feat(ui,worker): surface task numbers in row/detail UI and worker log

Slice 4/5 of task-numbers: TaskRowViewModel.Number renders as a dimmed
"#123" before the row title; DetailsIslandViewModel.TaskIdBadge now
shows "#123" instead of the unusable "#T<guid-prefix>" handle; and the
curated WorkerLog business events in TaskRunner, TaskMergeService, and
TaskResetService prefix their quoted title with "#<Number>".
This commit is contained in:
mika kuns
2026-08-11 13:51:20 +02:00
parent a1aeb21481
commit 38af549a80
11 changed files with 361 additions and 38 deletions
@@ -143,6 +143,55 @@ public class TaskResetServiceTests : IDisposable
Assert.Contains(proxy.Calls, i => i.Method == "WorktreeUpdated" && i.Args[0] is string s && s == task.Id);
}
[Fact]
public async Task ResetAsync_BroadcastsWorkerLog_ContainingTaskNumber()
{
if (!GitRepoFixture.IsGitAvailable()) return;
var repo = NewRepo();
var db = NewDb();
var wtMgr = BuildWorktreeManager(db);
var list = new ListEntity
{
Id = Guid.NewGuid().ToString(),
Name = "reset-number-test",
WorkingDir = repo.RepoDir,
DefaultCommitType = "feat",
CreatedAt = DateTime.UtcNow,
};
var task = new TaskEntity
{
Id = Guid.NewGuid().ToString(),
ListId = list.Id,
Title = "numbered task",
Number = 321,
Status = TaskStatus.Failed,
StartedAt = DateTime.UtcNow.AddMinutes(-5),
FinishedAt = DateTime.UtcNow.AddMinutes(-1),
Result = "some error",
CreatedAt = DateTime.UtcNow,
};
using (var ctx = db.CreateContext())
{
// Bypass TaskRepository.AddAsync — it allocates its own Number via
// TaskNumberAllocator and would silently overwrite the one this test sets.
ctx.Lists.Add(list);
ctx.Tasks.Add(task);
await ctx.SaveChangesAsync();
}
var wtCtx = await wtMgr.CreateAsync(task, list, CancellationToken.None);
_worktreeCleanups.Add((repo.RepoDir, wtCtx.WorktreePath));
var (svc, proxy) = BuildService(db, wtMgr);
await svc.ResetAsync(task.Id, CancellationToken.None);
Assert.Contains(proxy.Calls, c => c.Method == "WorkerLog"
&& c.Args[0] is string s && s.Contains("#321"));
}
[Fact]
public async Task ResetAsync_RunningTask_Throws_AndDoesNotMutate()
{