TestBootstrapRejectsEmptyModels: an empty `models:` block leaves Active nothing to point at; Bootstrap must error readably (how to recover) rather than panic in the Active coercer.
(t *testing.T)
| 512 | // nothing to point at; Bootstrap must error readably (how to recover) rather |
| 513 | // than panic in the Active coercer. |
| 514 | func TestBootstrapRejectsEmptyModels(t *testing.T) { |
| 515 | dir := t.TempDir() |
| 516 | cdir := filepath.Join(dir, DirName) |
| 517 | if err := os.MkdirAll(cdir, 0o755); err != nil { |
| 518 | t.Fatal(err) |
| 519 | } |
| 520 | yaml := []byte("active: none\nmodels: {}\n") |
| 521 | if err := os.WriteFile(filepath.Join(cdir, "config.yaml"), yaml, 0o644); err != nil { |
| 522 | t.Fatal(err) |
| 523 | } |
| 524 | _, _, err := Bootstrap(dir) |
| 525 | if err == nil { |
| 526 | t.Fatal("empty models map must be rejected, not silently coerced") |
| 527 | } |
| 528 | if !strings.Contains(err.Error(), "no profiles configured") { |
| 529 | t.Fatalf("error should explain the problem, got: %v", err) |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | // TestStrictYAMLRejectsUnknownKey: unknown top-level keys in config.yaml |
| 534 | // must fail loud, not be silently ignored: surfaces typos immediately. |