Preserve smoke observer failures independently of readiness

This commit is contained in:
2026-11-28 16:10:49 +00:00
parent 33e8309322
commit f4951b9bde
5 changed files with 60 additions and 6 deletions

View File

@@ -122,3 +122,29 @@ func TestPreflightDebugAllocationFailureAndDisable(t *testing.T) {
}
}
}
func TestPreflightCaptureFailureBeforeLastProfileIsNotReady(t *testing.T) {
probe := &runProbe{}
_, config, input, _ := runFixture(t, probe, func(configuration string) string {
return strings.Replace(configuration, "id: inspect-validator\n default_profile: partial", "id: inspect-validator\n default_profile: chosen", 1)
})
root := t.TempDir()
calls := 0
client := captureClient(func(context.Context, promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) {
calls++
if err := os.Mkdir(filepath.Join(root, "inspection", "smoke", "004.json"), 0o700); err != nil {
t.Fatal(err)
}
return &promptkit.GenerateResponse{Content: `{"status":"ok"}`}, nil
})
app, err := NewApplication("test", Options{Registries: runRegistries(t, probe), LLMClient: client, RunIDGenerator: func(time.Time) (string, error) { return "inspection", nil }})
if err != nil {
t.Fatal(err)
}
var out, stderr bytes.Buffer
outcome := app.Execute(context.Background(), []string{"preflight", "demo", "--config", config, "--input-file", input, "--cache", "bypass", "--debug", "--debug-dir", root, "--format", "json"}, commandkit.Streams{Out: &out, Err: &stderr})
var report preflightReport
if err := json.Unmarshal(out.Bytes(), &report); err != nil || report.Ready || outcome.Status == 0 || calls != 1 {
t.Fatalf("outcome=%+v report=%+v error=%v calls=%d", outcome, report, err, calls)
}
}