Verify imported products through publication and local execution

This commit is contained in:
2026-12-02 16:33:08 +00:00
parent e7fada4372
commit 56483f9064
7 changed files with 334 additions and 33 deletions

View File

@@ -94,24 +94,27 @@ func TestFullRunWithSuppliedTranscriptPreparesAndRendersSelectedVariant(t *testi
cfg.Session.Inputs.AudioS3 = nil
cfg.Pipeline.Render.Variants = []string{"trimmed"}
cfg.ArtifactCatalog.Artifacts = map[string]config.ScriptoriumArtifactConfig{"recap": {Enabled: true, PromptID: "dnd.recap", OutputPath: "artifacts/recap.md", Inputs: map[string]config.ScriptoriumInputConfig{"party": {Source: artifactpolicy.SourceInputParty, Required: true}, "transcript": {Source: artifacts.ArtifactTranscriptFinalTrimmed, Required: true}}}}
paths := artifacts.NewLocalStore(root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
transcript := filepath.Join(paths.Root, filepath.FromSlash(artifacts.TranscriptPathFinalTrimmed))
if err := os.MkdirAll(filepath.Dir(transcript), 0755); err != nil {
fake := &storage.FakeBackend{}
seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"transcripts/final.trimmed.json": []byte(`{"segments":[]}`)})
if _, err := restoreSessionState(context.Background(), cfg, RestorePlanOptions{}, normalizeCommandDependencies(restoreCommandDependencies(fake))); err != nil {
t.Fatal(err)
}
body := []byte(`{"segments":[]}`)
if err := os.WriteFile(transcript, body, 0600); err != nil {
t.Fatal(err)
}
checksum, err := artifacts.SHA256File(transcript)
plan := mustBoundedPlan(t, "", "analyze")
effective, err := resolveEffectiveArtifacts(cfg, nil)
if err != nil {
t.Fatal(err)
}
m := manifest.New(cfg.Session.SessionID, time.Now())
m.Campaign = cfg.Session.Campaign
m.SuppliedProducts = &manifest.SuppliedProductCollection{Version: manifest.SuppliedProductVersion, Products: map[string]manifest.SuppliedProduct{artifacts.ArtifactTranscriptFinalTrimmed: {Path: artifacts.TranscriptPathFinalTrimmed, Checksum: checksum, Size: int64(len(body))}}}
saveBoundedManifest(t, cfg, m)
plan := mustBoundedPlan(t, "", "analyze")
preview, err := buildSessionPlan(context.Background(), cfg, &executionInput{plan: plan}, nil, effective, commandDependencies{})
if err != nil {
t.Fatal(err)
}
for _, item := range preview.Stages {
if item.Name == "transcribe" || item.Name == "merge" || item.Name == "polish" || item.Name == "normalize" || item.Name == "trim" {
if item.Action != "skip" {
t.Fatalf("covered stage planned as %s: %#v", item.Action, item)
}
}
}
sf := &scriptorium.FakeRunner{}
ser := &seriatim.FakeRunner{}
result, err := executePlan(context.Background(), cfg, plan, RunOptions{Env: &Env{Scriptorium: sf, Seriatim: ser}})
@@ -131,7 +134,7 @@ func TestFullRunWithSuppliedTranscriptPreparesAndRendersSelectedVariant(t *testi
forced := mustBoundedPlan(t, "transcribe", "transcribe")
input := &executionInput{plan: forced}
input.Force.Value = true
effective, err := resolveEffectiveArtifacts(cfg, nil)
effective, err = resolveEffectiveArtifacts(cfg, nil)
if err != nil {
t.Fatal(err)
}
@@ -222,23 +225,11 @@ func TestStandalonePreflightWithSuppliedTranscriptStillProbesProviders(t *testin
cfg.Session.Inputs.AudioDir = ""
cfg.Session.Inputs.AudioFiles = nil
cfg.Session.Inputs.AudioS3 = nil
paths := artifacts.NewLocalStore(root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
path := filepath.Join(paths.Root, filepath.FromSlash(artifacts.TranscriptPathFinalTrimmed))
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
fake := &storage.FakeBackend{}
seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{"transcripts/final.trimmed.json": []byte(`{"segments":[]}`)})
if _, err := restoreSessionState(context.Background(), cfg, RestorePlanOptions{}, normalizeCommandDependencies(restoreCommandDependencies(fake))); err != nil {
t.Fatal(err)
}
body := []byte(`{"segments":[]}`)
if err := os.WriteFile(path, body, 0600); err != nil {
t.Fatal(err)
}
checksum, err := artifacts.SHA256File(path)
if err != nil {
t.Fatal(err)
}
m := manifest.New(cfg.Session.SessionID, time.Now())
m.Campaign = cfg.Session.Campaign
m.SuppliedProducts = &manifest.SuppliedProductCollection{Version: manifest.SuppliedProductVersion, Products: map[string]manifest.SuppliedProduct{artifacts.ArtifactTranscriptFinalTrimmed: {Path: artifacts.TranscriptPathFinalTrimmed, Checksum: checksum, Size: int64(len(body))}}}
saveBoundedManifest(t, cfg, m)
provider := &audita.FakeRunner{}
deps := fakeCommandDependencies(&storage.FakeBackend{}, nil)
deps.newAudita = func(*config.Config) (audita.Runner, error) { return provider, nil }