TestBootstrapCoercesBogusContextSize: context_size 0 (or missing) is coerced to the default rather than degrading Pack() to "newest message only".
(t *testing.T)
| 550 | // TestBootstrapCoercesBogusContextSize: context_size 0 (or missing) is coerced |
| 551 | // to the default rather than degrading Pack() to "newest message only". |
| 552 | func TestBootstrapCoercesBogusContextSize(t *testing.T) { |
| 553 | dir := t.TempDir() |
| 554 | cdir := filepath.Join(dir, DirName) |
| 555 | if err := os.MkdirAll(cdir, 0o755); err != nil { |
| 556 | t.Fatal(err) |
| 557 | } |
| 558 | yaml := []byte(`active: local |
| 559 | models: |
| 560 | local: |
| 561 | llm: m |
| 562 | url: http://x |
| 563 | key: "" |
| 564 | context_size: 0 |
| 565 | `) |
| 566 | if err := os.WriteFile(filepath.Join(cdir, "config.yaml"), yaml, 0o644); err != nil { |
| 567 | t.Fatal(err) |
| 568 | } |
| 569 | cfg, _, err := Bootstrap(dir) |
| 570 | if err != nil { |
| 571 | t.Fatal(err) |
| 572 | } |
| 573 | if cfg.ActiveProfile().ContextSize != defaultContextSize { |
| 574 | t.Fatalf("context_size=0 should be coerced to %d, got %d", |
| 575 | defaultContextSize, cfg.ActiveProfile().ContextSize) |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | // TestBootstrapRejectsNilProfile: `models: { local: ~ }` decodes to a nil |
| 580 | // *Profile the ContextSize coercion loop would deref-panic on. Bootstrap must |
nothing calls this directly
no test coverage detected