에이전트 루프 진단과 문서 golden 회귀를 마감한다
- AgentLoopService의 컨텍스트 압축 완료 메시지와 query-view 요약 문자열 조립을 AgentLoopDiagnosticsFormatter로 분리해 루프 본체의 책임을 더 줄였다. - ChatStorageService 로드 경로에서 legacy .axchat의 누락된 tool_result preview를 synthetic preview로 즉시 복원하도록 보강했다. - HTML/DOCX golden 회귀와 legacy 저장 경로 회귀 테스트를 추가해 PPTX/XLSX에 이어 문서 품질 고정 범위를 확대했다. - 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\verify_loop_storage_golden\ -p:IntermediateOutputPath=obj\verify_loop_storage_golden\ (경고 0, 오류 0) - 검증: dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter AgentLoopDiagnosticsFormatterTests|ChatStorageServiceTests|HtmlSkillGoldenReportTests|DocxSkillGoldenDocumentTests|AgentMessageInvariantHelperTests|PptxSkillGoldenDeckTests|ExcelSkillGoldenWorkbookTests -p:OutputPath=bin\verify_loop_storage_golden_tests\ -p:IntermediateOutputPath=obj\verify_loop_storage_golden_tests\ (통과 10)
This commit is contained in:
65
src/AxCopilot.Tests/Services/ChatStorageServiceTests.cs
Normal file
65
src/AxCopilot.Tests/Services/ChatStorageServiceTests.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
using AxCopilot.Models;
|
||||
using AxCopilot.Services;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace AxCopilot.Tests.Services;
|
||||
|
||||
public class ChatStorageServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void Load_ShouldRestoreMissingToolResultPreviewFromLegacyStoredConversation()
|
||||
{
|
||||
var conversationId = "legacy-preview-" + Guid.NewGuid().ToString("N");
|
||||
var storagePath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"AxCopilot",
|
||||
"conversations",
|
||||
conversationId + ".axchat");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(storagePath)!);
|
||||
|
||||
var conversation = new ChatConversation
|
||||
{
|
||||
Id = conversationId,
|
||||
Title = "Legacy conversation",
|
||||
Messages = new()
|
||||
{
|
||||
new ChatMessage
|
||||
{
|
||||
MsgId = "tool-result-1",
|
||||
Role = "user",
|
||||
Content = $$"""{"type":"tool_result","tool_use_id":"call-legacy","tool_name":"file_read","content":"{{new string('L', 900)}}" }""",
|
||||
QueryPreviewContent = null,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(conversation);
|
||||
CryptoService.EncryptToFile(storagePath, json);
|
||||
|
||||
try
|
||||
{
|
||||
var storage = new ChatStorageService();
|
||||
|
||||
var loaded = storage.Load(conversationId);
|
||||
|
||||
loaded.Should().NotBeNull();
|
||||
loaded!.Messages.Should().ContainSingle();
|
||||
loaded.Messages[0].QueryPreviewContent.Should().NotBeNullOrWhiteSpace();
|
||||
loaded.Messages[0].QueryPreviewContent.Should().Contain("call-legacy");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
var storage = new ChatStorageService();
|
||||
storage.Delete(conversationId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user