Merge imported products into local session state
This commit is contained in:
@@ -69,13 +69,12 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
|
||||
if _, err := os.Stat(producerRun); !os.IsNotExist(err) {
|
||||
t.Fatalf("restore unexpectedly required producer run: %v", err)
|
||||
}
|
||||
upstreamCompletedAt := map[string]time.Time{}
|
||||
for _, stageName := range []string{"prepare", "transcribe", "merge", "polish", "normalize", "trim", "render", "extract"} {
|
||||
rec := beforeAnalyze.Stages[stageName]
|
||||
if rec == nil || rec.Status != manifest.StatusSucceeded || rec.CompletedAt == nil {
|
||||
t.Fatalf("restored manifest stage %q = %#v, want succeeded with completion timestamp", stageName, rec)
|
||||
}
|
||||
upstreamCompletedAt[stageName] = *rec.CompletedAt
|
||||
paths := artifacts.NewLocalStore(workspaceRoot).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
if !artifacts.SuppliedTranscriptCoverage(paths, beforeAnalyze.SuppliedProducts)["trim"] {
|
||||
t.Fatalf("imported transcript is unavailable: %#v", beforeAnalyze.SuppliedProducts)
|
||||
}
|
||||
if beforeAnalyze.Stages["trim"] != nil {
|
||||
t.Fatal("import invented a trim execution")
|
||||
}
|
||||
|
||||
stdout.Reset()
|
||||
@@ -110,19 +109,8 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("load session manifest after single-stage analysis: %v", err)
|
||||
}
|
||||
for _, stageName := range []string{"prepare", "transcribe", "merge", "polish", "normalize", "trim", "render", "extract"} {
|
||||
rec := afterAnalyze.Stages[stageName]
|
||||
if rec == nil || rec.Status != manifest.StatusSucceeded || rec.CompletedAt == nil {
|
||||
t.Fatalf("post-analyze manifest stage %q = %#v, want succeeded with completion timestamp", stageName, rec)
|
||||
}
|
||||
if !rec.CompletedAt.Equal(upstreamCompletedAt[stageName]) {
|
||||
t.Fatalf(
|
||||
"stage %q completion changed: before=%s after=%s",
|
||||
stageName,
|
||||
upstreamCompletedAt[stageName].Format(time.RFC3339Nano),
|
||||
rec.CompletedAt.Format(time.RFC3339Nano),
|
||||
)
|
||||
}
|
||||
if !artifacts.SuppliedTranscriptCoverage(paths, afterAnalyze.SuppliedProducts)["trim"] {
|
||||
t.Fatal("analysis lost the imported transcript baseline")
|
||||
}
|
||||
analyzeRec := afterAnalyze.Stages["analyze"]
|
||||
if analyzeRec == nil || analyzeRec.Status != manifest.StatusSucceeded {
|
||||
@@ -135,7 +123,7 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestoreThenAnalyzeUsesRestoredPreviousCacheWithoutObjectStore(t *testing.T) {
|
||||
func TestRestoreThenAnalyzePreparesPreviousCache(t *testing.T) {
|
||||
workspaceRoot := t.TempDir()
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFiles(t, workspaceRoot)
|
||||
appendRestoreWorkflowScriptoriumConfig(t, pipelinePath, `
|
||||
@@ -217,7 +205,7 @@ previous_session_id: 2026-04-26
|
||||
return executePlanWithDependencies(ctx, cfg, plan, opts, invocationDependencies{
|
||||
newObjectStore: func(context.Context, *config.Config) (storage.ObjectStore, error) {
|
||||
objectStoreConstructed = true
|
||||
return nil, context.Canceled
|
||||
return fakeStore, nil
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -241,8 +229,8 @@ previous_session_id: 2026-04-26
|
||||
if stderr.Len() != 0 {
|
||||
t.Fatalf("single-stage run stderr = %q, want empty", stderr.String())
|
||||
}
|
||||
if objectStoreConstructed {
|
||||
t.Fatal("single-stage analysis should not construct object store for previous-session input resolution")
|
||||
if !objectStoreConstructed {
|
||||
t.Fatal("reference preparation did not resolve previous-session inputs")
|
||||
}
|
||||
if len(scriptoriumFake.RunRequests) != 2 {
|
||||
t.Fatalf("scriptorium run requests = %d, want 2", len(scriptoriumFake.RunRequests))
|
||||
|
||||
Reference in New Issue
Block a user