| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "reasonix/internal/boot" |
| 5 | "reasonix/internal/config" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | func TestCLISwitchAndReloadKeepEffortBoundToCurrentModel(t *testing.T) { |
| 10 | cfg := &config.Config{Providers: []config.ProviderEntry{{Name: "gateway", Kind: "openai", BaseURL: "https://unknown.invalid/v1", Models: []string{"a", "b"}}}} |
| 11 | high := "high" |
| 12 | overrides := cliBuildOverrides{Effort: &high, EffortModel: "gateway/a"} |
| 13 | for _, model := range []string{"gateway/b", "gateway/a", "gateway/a"} { |
| 14 | overrides = overrides.forSelection(cfg, controllerBuildSpec{ModelRef: model}) |
| 15 | if overrides.Effort != nil { |
| 16 | t.Fatal("switch/reload revived another model's effort") |
| 17 | } |
| 18 | if err := boot.ValidateReasoningSnapshot(cfg, cliProfileBuildOptions(model, 0, false, nil, overrides)); err != nil { |
| 19 | t.Fatal(err) |
| 20 | } |
| 21 | } |
| 22 | overrides = overrides.forSelection(cfg, controllerBuildSpec{ModelRef: "gateway/a", EffortOverride: &high}) |
| 23 | if err := boot.ValidateReasoningSnapshot(cfg, cliProfileBuildOptions("gateway/a", 0, false, nil, overrides)); err == nil { |
| 24 | t.Fatal("explicit invalid effort was hidden") |
| 25 | } |
| 26 | } |
| 27 |