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

@@ -28,12 +28,13 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
seedRestoreObject(fake, sessionPrefix+"artifacts/session_recap.md", []byte("# restored recap\n"))
executeRestore := restoreCommandExecutor(fake)
scriptoriumRunner := &scriptorium.FakeRunner{}
executor := func(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions) (*RunSummary, error) {
if opts.Env == nil {
opts.Env = &Env{}
}
opts.Env.Scriptorium = &scriptorium.NoopRunner{}
opts.Env.Scriptorium = scriptoriumRunner
return executePlan(ctx, cfg, plan, opts)
}
@@ -99,6 +100,9 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
if !runCountsMatch(t, stdout.Bytes(), 1, 0, "analyze") {
t.Fatalf("single-stage run stdout = %q, want analyze execution summary", stdout.String())
}
if len(scriptoriumRunner.RunRequests) != 1 || scriptoriumRunner.RunRequests[0].InputPaths["recap"] != filepath.Join(sessionRoot, "artifacts", "session_recap.md") {
t.Fatalf("analysis did not reuse imported prerequisite: %#v", scriptoriumRunner.RunRequests)
}
playerHandoutPath := filepath.Join(sessionRoot, "artifacts", "player_handout.md")
if _, err := os.Stat(playerHandoutPath); err != nil {
@@ -116,6 +120,9 @@ func TestRestoreThenForcedAnalyzeUsesRestoredDurableState(t *testing.T) {
if analyzeRec == nil || analyzeRec.Status != manifest.StatusSucceeded {
t.Fatalf("post-analyze stage record = %#v, want succeeded", analyzeRec)
}
if analyzeRec.AnalyzeArtifacts["player_handout"].Status != manifest.AnalyzeArtifactCurrent || analyzeRec.AnalyzeArtifacts["player_handout"].Fingerprint == "" {
t.Fatalf("generated analysis lacks local evidence: %#v", analyzeRec)
}
runRoot := artifacts.SessionRunRootForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID, afterAnalyze.RunID)
if info, statErr := os.Stat(runRoot); statErr != nil || !info.IsDir() {