Add Seriatim normalize adapter support

This commit is contained in:
2026-05-10 21:35:11 +00:00
parent d1eb6d77ea
commit 5e2234e418
5 changed files with 581 additions and 12 deletions

View File

@@ -99,3 +99,52 @@ func TestFakeRunnerTrimError(t *testing.T) {
t.Fatal("expected error, got nil")
}
}
func TestFakeRunnerNormalizeCapturesRequestAndReturnsPath(t *testing.T) {
fake := &FakeRunner{}
dir := t.TempDir()
req := NormalizeRequest{
GeneratedConfigPath: filepath.Join(dir, "config", "seriatim.normalize.yml"),
InputTranscriptPath: filepath.Join(dir, "transcripts", "processed.json"),
OutputNormalizedPath: filepath.Join(dir, "transcripts", "normalized.json"),
OutputSchema: "seriatim-intermediate",
ReportPath: filepath.Join(dir, "artifacts", "seriatim.normalize.report.json"),
StdoutLogPath: filepath.Join(dir, "logs", "seriatim.normalize.stdout.log"),
StderrLogPath: filepath.Join(dir, "logs", "seriatim.normalize.stderr.log"),
}
res, err := fake.Normalize(context.Background(), req)
if err != nil {
t.Fatalf("Normalize() error = %v", err)
}
if len(fake.NormalizeRequests) != 1 || fake.NormalizeRequests[0].GeneratedConfigPath == "" {
t.Fatalf("normalize requests = %#v, want captured request", fake.NormalizeRequests)
}
if res.OutputNormalizedPath != req.OutputNormalizedPath {
t.Fatalf("normalized path = %q, want %q", res.OutputNormalizedPath, req.OutputNormalizedPath)
}
if res.OutputSchema != req.OutputSchema {
t.Fatalf("output schema = %q, want %q", res.OutputSchema, req.OutputSchema)
}
cfgData, err := os.ReadFile(req.GeneratedConfigPath)
if err != nil {
t.Fatalf("read generated config: %v", err)
}
if !strings.Contains(string(cfgData), "command: normalize") {
t.Fatalf("generated config = %q, want normalize command marker", string(cfgData))
}
for _, path := range []string{req.StdoutLogPath, req.StderrLogPath, req.ReportPath} {
if _, err := os.Stat(path); err != nil {
t.Fatalf("expected file %q to exist: %v", path, err)
}
}
}
func TestFakeRunnerNormalizeError(t *testing.T) {
fake := &FakeRunner{NormalizeErr: errors.New("boom")}
_, err := fake.Normalize(context.Background(), NormalizeRequest{})
if err == nil {
t.Fatal("expected error, got nil")
}
}