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:
@@ -108,7 +108,7 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var sut = BuildSut(parent.Id);
|
||||
|
||||
var result = await sut.CreateChildTask("My child", "desc", null, null, CancellationToken.None);
|
||||
var result = await sut.CreateChildTask("My child", "desc", null, CancellationToken.None);
|
||||
|
||||
Assert.Equal("Idle", result.Status);
|
||||
var child = await _tasks.GetByIdAsync(result.TaskId);
|
||||
@@ -122,8 +122,8 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var other = await SeedPlanningParentAsync();
|
||||
|
||||
await _tasks.CreateChildAsync(parent.Id, "mine", null, null, null);
|
||||
await _tasks.CreateChildAsync(other.Id, "theirs", null, null, null);
|
||||
await _tasks.CreateChildAsync(parent.Id, "mine", null, null);
|
||||
await _tasks.CreateChildAsync(other.Id, "theirs", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
var list = await sut.ListChildTasks(CancellationToken.None);
|
||||
@@ -136,18 +136,18 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var other = await SeedPlanningParentAsync();
|
||||
var otherChild = await _tasks.CreateChildAsync(other.Id, "x", null, null, null);
|
||||
var otherChild = await _tasks.CreateChildAsync(other.Id, "x", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
sut.UpdateChildTask(otherChild.Id, "new", null, null, null, null, CancellationToken.None));
|
||||
sut.UpdateChildTask(otherChild.Id, "new", null, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateChildTask_AfterFinalize_Throws()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
// Simulate post-finalize state directly: parent.PlanningPhase=Finalized
|
||||
// is the gate the MCP service checks.
|
||||
var sut = BuildSut(parent.Id);
|
||||
@@ -155,47 +155,18 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
Assert.True(result.Ok, result.Reason);
|
||||
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
sut.UpdateChildTask(c.Id, "new", null, null, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateChildTask_SetsTags()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
var result = await sut.UpdateChildTask(c.Id, null, null, new[] { "agent", "custom-tag" }, null, null, CancellationToken.None);
|
||||
|
||||
Assert.Contains("agent", result.Tags);
|
||||
Assert.Contains("custom-tag", result.Tags);
|
||||
Assert.Equal(2, result.Tags.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateChildTask_ReplacesTagSet()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, new[] { "agent" }, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
var result = await sut.UpdateChildTask(c.Id, null, null, new[] { "manual" }, null, null, CancellationToken.None);
|
||||
|
||||
Assert.Single(result.Tags);
|
||||
Assert.Equal("manual", result.Tags[0]);
|
||||
sut.UpdateChildTask(c.Id, "new", null, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateChildTask_SetsStatus()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
var result = await sut.UpdateChildTask(c.Id, null, null, null, null, "Queued", CancellationToken.None);
|
||||
var result = await sut.UpdateChildTask(c.Id, null, null, null, "Queued", CancellationToken.None);
|
||||
|
||||
Assert.Equal("Queued", result.Status);
|
||||
var loaded = await _tasks.GetByIdAsync(c.Id);
|
||||
@@ -206,31 +177,31 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
public async Task UpdateChildTask_DisallowedStatus_Throws()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
sut.UpdateChildTask(c.Id, null, null, null, null, "Running", CancellationToken.None));
|
||||
sut.UpdateChildTask(c.Id, null, null, null, "Running", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateChildTask_UnknownStatus_Throws()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
sut.UpdateChildTask(c.Id, null, null, null, null, "NotARealStatus", CancellationToken.None));
|
||||
sut.UpdateChildTask(c.Id, null, null, null, "NotARealStatus", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteChildTask_RemovesDraft()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await sut.DeleteChildTask(c.Id, CancellationToken.None);
|
||||
@@ -255,8 +226,8 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
public async Task Finalize_PromotesDraftsAndInvalidatesToken()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
await _tasks.CreateChildAsync(parent.Id, "c1", null, null, null);
|
||||
await _tasks.CreateChildAsync(parent.Id, "c2", null, null, null);
|
||||
await _tasks.CreateChildAsync(parent.Id, "c1", null, null);
|
||||
await _tasks.CreateChildAsync(parent.Id, "c2", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
var count = await sut.Finalize(true, CancellationToken.None);
|
||||
@@ -273,7 +244,7 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var sut = BuildSut(parent.Id);
|
||||
|
||||
var result = await sut.CreateChildTask("c", null, null, null, CancellationToken.None);
|
||||
var result = await sut.CreateChildTask("c", null, null, CancellationToken.None);
|
||||
|
||||
var ids = TaskUpdatedIds();
|
||||
Assert.Contains(result.TaskId, ids);
|
||||
@@ -284,11 +255,11 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
public async Task UpdateChildTask_BroadcastsBothChildAndParent()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
_ctx.ChangeTracker.Clear();
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await sut.UpdateChildTask(c.Id, "new title", null, null, null, null, CancellationToken.None);
|
||||
await sut.UpdateChildTask(c.Id, "new title", null, null, null, CancellationToken.None);
|
||||
|
||||
var ids = TaskUpdatedIds();
|
||||
Assert.Contains(c.Id, ids);
|
||||
@@ -299,7 +270,7 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
public async Task DeleteChildTask_BroadcastsBothChildAndParent()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||
var c = await _tasks.CreateChildAsync(parent.Id, "c", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await sut.DeleteChildTask(c.Id, CancellationToken.None);
|
||||
@@ -313,8 +284,8 @@ public sealed class PlanningMcpServiceTests : IDisposable
|
||||
public async Task Finalize_BroadcastsEachChildAndParent()
|
||||
{
|
||||
var parent = await SeedPlanningParentAsync();
|
||||
var c1 = await _tasks.CreateChildAsync(parent.Id, "c1", null, null, null);
|
||||
var c2 = await _tasks.CreateChildAsync(parent.Id, "c2", null, null, null);
|
||||
var c1 = await _tasks.CreateChildAsync(parent.Id, "c1", null, null);
|
||||
var c2 = await _tasks.CreateChildAsync(parent.Id, "c2", null, null);
|
||||
|
||||
var sut = BuildSut(parent.Id);
|
||||
await sut.Finalize(true, CancellationToken.None);
|
||||
|
||||
Reference in New Issue
Block a user