Document and verify published product imports
This commit is contained in:
@@ -156,16 +156,24 @@ func TestLockedProductsRemainUsableAfterImportAndRepublish(t *testing.T) {
|
||||
if _, err := artifacts.ResolveSessionArtifactWithCatalog(importedPaths, imported, artifacts.ConfiguredArtifactSourceID("session_recap"), catalog); err != nil {
|
||||
t.Fatalf("carried configured product unavailable: %v", err)
|
||||
}
|
||||
downstream := &scriptorium.FakeRunner{}
|
||||
result, err := executePlan(ctx, cfg, mustBoundedPlan(t, "analyze", "analyze"), RunOptions{Force: true, SelectedArtifacts: []string{"player_handout"}, Env: &Env{Scriptorium: downstream}})
|
||||
if err != nil {
|
||||
t.Fatalf("consume carried product in downstream work: %v", err)
|
||||
}
|
||||
if len(downstream.RunRequests) != 1 || downstream.RunRequests[0].InputPaths["recap"] != filepath.Join(importedPaths.ArtifactsDir, "session_recap.md") {
|
||||
t.Fatalf("downstream work did not reuse the carried recap: %#v", downstream.RunRequests)
|
||||
}
|
||||
imported, err = (&manifest.LocalStore{}).Load(ctx, result.ManifestPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, rule := range rules {
|
||||
if err := artifacts.RemoveRemoteLock(ctx, fake, prefix, rule.Source); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
imported.RunID = "20260521T010203Z-a1b2c3d4"
|
||||
imported.LocalWorkDir = artifacts.SessionRunRootForCampaign(cfg.Pipeline.Workspace.Root, imported.Campaign, imported.SessionID, imported.RunID)
|
||||
if err := os.MkdirAll(imported.LocalWorkDir, 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
publishedRun := imported.RunID
|
||||
env.ArtifactStore = artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root)
|
||||
if _, err := publish.Run(ctx, env, imported); err != nil {
|
||||
t.Fatalf("republish imported products: %v", err)
|
||||
@@ -174,6 +182,7 @@ func TestLockedProductsRemainUsableAfterImportAndRepublish(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
imported.RunID = "20260522T010203Z-a1b2c3d4"
|
||||
imported.S3RunPrefix = artifacts.S3RunPrefix(prefix, imported.RunID)
|
||||
imported.LocalWorkDir = artifacts.SessionRunRootForCampaign(cfg.Pipeline.Workspace.Root, imported.Campaign, imported.SessionID, imported.RunID)
|
||||
if err := os.MkdirAll(imported.LocalWorkDir, 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -182,7 +191,7 @@ func TestLockedProductsRemainUsableAfterImportAndRepublish(t *testing.T) {
|
||||
t.Fatal("republish accepted a tampered required product")
|
||||
}
|
||||
current, err := artifacts.LoadCurrentInventory(ctx, fake, prefix, artifacts.CurrentStateValidation{})
|
||||
if err != nil || current.RunID != "20260521T010203Z-a1b2c3d4" {
|
||||
if err != nil || current.RunID != publishedRun {
|
||||
t.Fatalf("failed republish changed current publication: %#v, %v", current, err)
|
||||
}
|
||||
}
|
||||
@@ -222,6 +231,18 @@ func TestImportedPartialExtractionRegeneratesCompleteBundle(t *testing.T) {
|
||||
if artifacts.SuppliedExtractionComplete(paths, before, artifacts.ExtractionDefinitionsFromConfig(cfg.Pipeline.Notarius)) {
|
||||
t.Fatal("partial extraction was treated as complete")
|
||||
}
|
||||
definitions := artifacts.ExtractionDefinitionsFromConfig(cfg.Pipeline.Notarius)
|
||||
catalog := artifacts.NewArtifactCatalog()
|
||||
if err := catalog.RegisterExtractionArtifacts(definitions); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
catalog.HydrateExtractionArtifacts(paths, before, definitions)
|
||||
if _, err := artifacts.ResolveSessionArtifactWithCatalog(paths, before, artifacts.ExtractionArtifactSourceID("npc_registry"), catalog); err != nil {
|
||||
t.Fatalf("imported extraction product unavailable: %v", err)
|
||||
}
|
||||
if _, err := artifacts.ResolveSessionArtifactWithCatalog(paths, before, artifacts.ExtractionArtifactSourceID("encounters"), catalog); err == nil {
|
||||
t.Fatal("missing extraction product became available")
|
||||
}
|
||||
runner := &materializingNotariusRunner{cfg: cfg.Pipeline.Notarius}
|
||||
result, err := executePlan(ctx, cfg, mustBoundedPlan(t, "extract", "extract"), RunOptions{Env: &Env{Notarius: runner}})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user