Explain native preflight failures
This commit is contained in:
@@ -17,7 +17,12 @@ success criteria. No implementation fixes were made during this review.
|
|||||||
|
|
||||||
## R1 — Present actionable native smoke errors
|
## R1 — Present actionable native smoke errors
|
||||||
|
|
||||||
**Priority:** P2. **Stage:** 7. **Status:** Open.
|
**Priority:** P2. **Stage:** 7. **Status:** Complete.
|
||||||
|
|
||||||
|
**Completion:** Native smoke errors now appear beside their profile and safe
|
||||||
|
observations while the original cause remains attached. The missing-model CLI
|
||||||
|
regression passes in ordinary, quiet, and debug modes; preflight tests pass with
|
||||||
|
Go 1.27.4.
|
||||||
|
|
||||||
**Locations:** `internal/cli/preflight.go:38` and `:53`;
|
**Locations:** `internal/cli/preflight.go:38` and `:53`;
|
||||||
`internal/framework/llm/smoke.go:72`.
|
`internal/framework/llm/smoke.go:72`.
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ func runPreflight(inv commandkit.Invocation, input processInput) commandkit.Outc
|
|||||||
|
|
||||||
func verificationLine(result llm.ProfileVerification) string {
|
func verificationLine(result llm.ProfileVerification) string {
|
||||||
line := fmt.Sprintf("Profile %q: %s", result.ProfileID, result.Status)
|
line := fmt.Sprintf("Profile %q: %s", result.ProfileID, result.Status)
|
||||||
|
if result.Err != nil {
|
||||||
|
line += ": " + result.Err.Error()
|
||||||
|
}
|
||||||
if result.Report == nil {
|
if result.Report == nil {
|
||||||
return line + "; smoke usage: unknown"
|
return line + "; smoke usage: unknown"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,3 +197,29 @@ func TestPreflightUsagePreservesUnknownAndCompleteness(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPreflightExplainsNativePreparationError(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
for name, body := range map[string]string{
|
||||||
|
"config.yml": "version: 3\nllm: {proposal_profile: selected}\npipeline: {stages: [{module: grammar}]}\nreporting: {enabled: false}\n",
|
||||||
|
"prompts.yml": "profiles: [{id: selected, endpoint: 'http://example.invalid/v1'}]\n",
|
||||||
|
"transcript.json": `[{"speaker":"A","start":0,"end":1,"text":"hello"}]`,
|
||||||
|
} {
|
||||||
|
if err := os.WriteFile(filepath.Join(dir, name), []byte(body), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app, err := buildApplication()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, flags := range [][]string{nil, {"--quiet"}, {"--debug"}} {
|
||||||
|
var out, diagnostic bytes.Buffer
|
||||||
|
args := append([]string{"preflight"}, flags...)
|
||||||
|
args = append(args, "--config", filepath.Join(dir, "config.yml"), "--output", filepath.Join(dir, "out.json"), filepath.Join(dir, "transcript.json"))
|
||||||
|
result := app.Execute(context.Background(), args, commandkit.Streams{Out: &out, Err: &diagnostic})
|
||||||
|
if result.Status != 1 || result.Cause == nil || !strings.Contains(diagnostic.String(), `Profile "selected"`) || !strings.Contains(diagnostic.String(), "model is required") {
|
||||||
|
t.Fatalf("status=%d cause=%v diagnostic=%s", result.Status, result.Cause, diagnostic.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user