refactor: delete unreachable members and redundant package refs
Eight public members had no caller anywhere in src: GitService.GetFileDiffAsync, SubtaskRepository.DeleteByTaskIdAsync, TaskRepository.GetByListAsync (a backwards-compat alias for GetByListIdAsync) and .GetByCreatorAsync, WorktreeRepository.GetByStatesAsync, TaskMonitorViewModel.SetPendingQuestion (a duplicate of the live-event lambda), PrimeClaudeTabViewModel.ApplyFiredEvent, and StreamLineFormatter.FormatFile. TaskAttachmentRepository.DeleteAllForTaskAsync was reachable only from its own test; the ON DELETE CASCADE on task_attachments already covers it. Tests for the deleted members go with them. Dropped two package refs the platform already provides: EntityFrameworkCore.Design in Worker (the design-time factory and the migrations live in Data, which has its own ref) and System.IO.FileSystem.AccessControl in Installer.Tests (net8.0-windows ships the ACL APIs in the shared framework).
This commit is contained in:
@@ -86,19 +86,6 @@ public sealed class TaskAttachmentRepositoryTests : IDisposable
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteAllForTask_clears_all_rows_for_task()
|
||||
{
|
||||
await _repo.AddAsync(MakeAttachment("a.txt"));
|
||||
await _repo.AddAsync(MakeAttachment("b.txt"));
|
||||
await _repo.AddAsync(MakeAttachment("c.txt"));
|
||||
|
||||
await _repo.DeleteAllForTaskAsync(TaskId);
|
||||
|
||||
var list = await _repo.ListByTaskIdAsync(TaskId);
|
||||
Assert.Empty(list);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ListByTaskId_ordered_by_created_at()
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -91,48 +91,5 @@ public class StreamLineFormatterTests
|
||||
Assert.Null(_formatter.FormatLine(delta));
|
||||
}
|
||||
|
||||
// --- FormatFile and Trim ---
|
||||
|
||||
[Fact]
|
||||
public void FormatFile_ParsesAllLinesAndReturnsFormattedText()
|
||||
{
|
||||
var lines = new[]
|
||||
{
|
||||
"""{"type":"assistant","message":{"content":[{"type":"text","text":"Hello"}]}}""",
|
||||
"""{"type":"assistant","message":{"content":[{"type":"tool_use","id":"x","name":"Bash","input":{"command":"ls"}}]}}""",
|
||||
"""{"type":"result","result":"Done."}""",
|
||||
};
|
||||
var file = Path.GetTempFileName();
|
||||
try
|
||||
{
|
||||
File.WriteAllLines(file, lines);
|
||||
var result = _formatter.FormatFile(file);
|
||||
Assert.Contains("Hello", result);
|
||||
Assert.Contains("[Bash]", result);
|
||||
Assert.Contains("Done.", result);
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FormatFile_TrimsLargeContent()
|
||||
{
|
||||
var chunk = new string('x', 1000);
|
||||
var line = "{\"type\":\"assistant\",\"message\":{\"content\":[{\"type\":\"text\",\"text\":\"" + chunk + "\"}]}}";
|
||||
var lines = Enumerable.Repeat(line, 65).ToArray();
|
||||
var file = Path.GetTempFileName();
|
||||
try
|
||||
{
|
||||
File.WriteAllLines(file, lines);
|
||||
var result = _formatter.FormatFile(file);
|
||||
Assert.True(result.Length <= 50_200, $"Expected <= 50200 but got {result.Length}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
// --- Trim ---
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user