Run downstream preflight after preparation

This commit is contained in:
2026-11-27 16:45:46 +00:00
parent b9b154e59e
commit d178e2c437
8 changed files with 256 additions and 34 deletions

View File

@@ -43,13 +43,13 @@ func preflightTestConfig(t *testing.T) *config.Config {
return cfg
}
func TestPreflightRunsBeforeAttemptsAndWarningsAllowExecution(t *testing.T) {
func TestPreflightFollowsPreparationAndWarningsAllowExecution(t *testing.T) {
cfg := preflightTestConfig(t)
var earlierRuns int
reporter := &warningRecorder{}
runner := &observingInspector{inspect: func(req scriptorium.RequirementsRequest) {
if earlierRuns != 0 {
t.Fatal("inspection ran after first attempt")
if earlierRuns != 1 {
t.Fatal("inspection did not follow preparation")
}
if req.PromptID != "recap" {
t.Fatalf("request = %+v", req)
@@ -126,7 +126,7 @@ func TestPreflightInspectionFailureAndUnrelatedSelection(t *testing.T) {
runner := &scriptorium.FakeRunner{RequirementsErr: want}
var attempts int
summary, err := executeStages(context.Background(), cfg, []stage.Stage{countingStage{name: "prepare", runs: &attempts}, mustSelectStage(t, "analyze")}, RunOptions{Env: &Env{Scriptorium: runner}})
if !errors.Is(err, want) || attempts != 0 || summary == nil || summary.StageResults[0].Attempted {
if !errors.Is(err, want) || attempts != 1 || summary == nil || !summary.StageResults[0].Attempted || summary.StageResults[1].Attempted {
t.Fatalf("summary = %+v, attempts = %d, error = %v", summary, attempts, err)
}
runner.RequirementsRequests = nil