refactor(tags): remove tag entity and all references

Drops TagEntity, TagRepository, and tag wiring across data layer, worker,
and UI. Adds RemoveTags migration to clean up schema.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-19 08:07:24 +02:00
parent 8d34db3f9b
commit 623ebf147b
42 changed files with 333 additions and 1118 deletions

View File

@@ -28,7 +28,6 @@ public sealed class PlanningChainCoordinator
// chain leaves history alone but still reshapes the tail.
// - Running children abort the operation — the chain cannot be reshaped while
// one of its members is mid-flight.
// The "agent" tag is auto-attached to every child so the picker can claim them.
// Returns the number of children placed in the chain.
internal async Task<int> SetupChainAsync(string parentTaskId, CancellationToken ct = default)
{
@@ -37,7 +36,6 @@ public sealed class PlanningChainCoordinator
?? throw new InvalidOperationException($"Task {parentTaskId} not found.");
var children = await ctx.Tasks
.Include(t => t.Tags)
.Where(t => t.ParentTaskId == parentTaskId)
.OrderBy(t => t.SortOrder).ThenBy(t => t.CreatedAt)
.ToListAsync(ct);
@@ -49,18 +47,6 @@ public sealed class PlanningChainCoordinator
throw new InvalidOperationException(
$"Child {running.Id} is running; cannot reshape chain.");
// Worker queue picker requires the "agent" tag — attach it so children are pickable.
var agentTag = await ctx.Tags.FirstOrDefaultAsync(t => t.Name == "agent", ct);
if (agentTag is not null)
{
foreach (var c in children)
{
if (!c.Tags.Any(t => t.Id == agentTag.Id))
c.Tags.Add(agentTag);
}
await ctx.SaveChangesAsync(ct);
}
// Re-shape over Idle and Queued children only; leave Done/Failed/Cancelled
// (terminal) results in place.
var sequenceable = children

View File

@@ -8,7 +8,7 @@ using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Worker.Planning;
public sealed record ChildTaskDto(string TaskId, string Title, string? Description, string Status, IReadOnlyList<string> Tags);
public sealed record ChildTaskDto(string TaskId, string Title, string? Description, string Status);
public sealed record CreatedChildDto(string TaskId, string Status);
[McpServerToolType]
@@ -41,12 +41,11 @@ public sealed class PlanningMcpService
public async Task<CreatedChildDto> CreateChildTask(
string title,
string? description,
IReadOnlyList<string>? tags,
string? commitType,
CancellationToken cancellationToken)
{
var ctx = _contextAccessor.Current;
var child = await _tasks.CreateChildAsync(ctx.ParentTaskId, title, description, tags, commitType, cancellationToken);
var child = await _tasks.CreateChildAsync(ctx.ParentTaskId, title, description, commitType, cancellationToken);
await BroadcastTaskUpdatedAsync(child.Id, cancellationToken);
await BroadcastTaskUpdatedAsync(ctx.ParentTaskId, cancellationToken);
return new CreatedChildDto(child.Id, child.Status.ToString());
@@ -58,24 +57,19 @@ public sealed class PlanningMcpService
{
var ctx = _contextAccessor.Current;
var children = await _tasks.GetChildrenAsync(ctx.ParentTaskId, cancellationToken);
var list = new List<ChildTaskDto>(children.Count);
foreach (var c in children)
{
var tagList = await _tasks.GetTagsAsync(c.Id, cancellationToken);
list.Add(new ChildTaskDto(c.Id, c.Title, c.Description, c.Status.ToString(), tagList.Select(t => t.Name).ToList()));
}
return list;
return children
.Select(c => new ChildTaskDto(c.Id, c.Title, c.Description, c.Status.ToString()))
.ToList();
}
private static readonly TaskStatus[] EditableStatuses =
{ TaskStatus.Idle, TaskStatus.Queued };
[McpServerTool, Description("Update a child task in the active planning session. Can change title, description, tags (replaces the full set), commit type, and status. Status must be one of: Idle, Queued.")]
[McpServerTool, Description("Update a child task in the active planning session. Can change title, description, commit type, and status. Status must be one of: Idle, Queued.")]
public async Task<ChildTaskDto> UpdateChildTask(
string taskId,
string? title,
string? description,
IReadOnlyList<string>? tags,
string? commitType,
string? status,
CancellationToken cancellationToken)
@@ -101,13 +95,12 @@ public sealed class PlanningMcpService
newStatus = parsed;
}
await _tasks.UpdateChildAsync(taskId, title, description, commitType, tags, newStatus, cancellationToken);
await _tasks.UpdateChildAsync(taskId, title, description, commitType, newStatus, cancellationToken);
var reload = (await _tasks.GetByIdAsync(taskId, cancellationToken))!;
var tagList = await _tasks.GetTagsAsync(reload.Id, cancellationToken);
await BroadcastTaskUpdatedAsync(reload.Id, cancellationToken);
await BroadcastTaskUpdatedAsync(ctx.ParentTaskId, cancellationToken);
return new ChildTaskDto(reload.Id, reload.Title, reload.Description, reload.Status.ToString(), tagList.Select(t => t.Name).ToList());
return new ChildTaskDto(reload.Id, reload.Title, reload.Description, reload.Status.ToString());
}
[McpServerTool, Description("Delete a child task in the active planning session.")]