Implement real transcribe stage

This commit is contained in:
2026-05-03 15:42:44 -05:00
parent 24833194db
commit 2438a0b7a5
7 changed files with 660 additions and 26 deletions

View File

@@ -75,6 +75,15 @@ func TestExecuteStagesPlaceholderSuccessUpdatesManifest(t *testing.T) {
}
continue
}
if name == "transcribe" {
if sr.Metadata == nil || sr.Metadata["stage"] != "transcribe" {
t.Fatalf("transcribe metadata missing stage=transcribe: %#v", sr.Metadata)
}
if len(sr.Outputs) == 0 {
t.Fatalf("transcribe outputs missing")
}
continue
}
if sr.Metadata == nil || sr.Metadata["placeholder"] != true {
t.Fatalf("stage %q missing placeholder metadata", name)
}
@@ -202,6 +211,17 @@ func TestExecuteStagesLoadsExistingManifest(t *testing.T) {
existing := manifest.New(cfg.Session.SessionID, time.Date(2026, 5, 3, 1, 0, 0, 0, time.UTC))
existing.MarkStageSucceeded("prepare", time.Date(2026, 5, 3, 1, 1, 0, 0, time.UTC), nil)
audioPath := filepath.Join(cfg.Pipeline.Workspace.Root, "work", cfg.Session.SessionID, "audio", "alice.flac")
if err := os.MkdirAll(filepath.Dir(audioPath), 0o755); err != nil {
t.Fatalf("MkdirAll() error = %v", err)
}
if err := os.WriteFile(audioPath, []byte("audio"), 0o644); err != nil {
t.Fatalf("WriteFile() error = %v", err)
}
existing.Inputs = append(existing.Inputs, manifest.InputRecord{
Kind: "audio",
Path: audioPath,
})
if err := os.MkdirAll(filepath.Dir(manifestPath), 0o755); err != nil {
t.Fatalf("MkdirAll() error = %v", err)
}
@@ -251,6 +271,21 @@ func TestAdapterBackedStageFailureMarksManifestFailed(t *testing.T) {
tc.env.Config = cfg
tc.env.ArtifactStore = artifactStore
tc.env.ManifestStore = &manifest.LocalStore{}
if tc.name == "transcribe" {
paths, ensureErr := artifactStore.EnsureLayout(cfg.Session.SessionID)
if ensureErr != nil {
t.Fatalf("EnsureLayout() error = %v", ensureErr)
}
audioPath := filepath.Join(paths.AudioDir, "alice.flac")
if err := os.WriteFile(audioPath, []byte("audio"), 0o644); err != nil {
t.Fatalf("write transcribe fixture audio: %v", err)
}
m := manifest.New(cfg.Session.SessionID, time.Now().UTC())
m.Inputs = append(m.Inputs, manifest.InputRecord{Kind: "audio", Path: audioPath})
if err := tc.env.ManifestStore.Save(context.Background(), manifestPathFor(cfg), m); err != nil {
t.Fatalf("seed manifest: %v", err)
}
}
_, runErr := executeStages(context.Background(), cfg, []stage.Stage{selected}, RunOptions{Env: tc.env})
if runErr == nil {