MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestArgPopoverSkipsConfigReloadMidTurn

Function TestArgPopoverSkipsConfigReloadMidTurn

internal/tui/tui_test.go:907–934  ·  view source on GitHub ↗

TestArgPopoverSkipsConfigReloadMidTurn: typing is allowed mid-turn, but the cmd→arg popover transition must not reload config then: a reload can rebuildClient and swap the live llm.Client (and zero the budget) under the in-flight turn. The stale list is fine; submit is phase-gated and runSlash reloa

(t *testing.T)

Source from the content-addressed store, hash-verified

905// rebuildClient and swap the live llm.Client (and zero the budget) under the
906// in-flight turn. The stale list is fine; submit is phase-gated and runSlash
907// reloads once the turn is over.
908func TestArgPopoverSkipsConfigReloadMidTurn(t *testing.T) {
909 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
910 yaml := []byte(`active: local
911models:
912 local:
913 llm: local-model
914 url: ` + m.cfg.Models["local"].URL + `
915 key: ""
916 context_size: 256000
917 remote:
918 llm: cloud-model
919 url: http://remote:9000
920 key: sk-r
921 context_size: 128000
922`)
923 if err := os.WriteFile(filepath.Join(m.cfg.Dir, "config.yaml"), yaml, 0o600); err != nil {
924 t.Fatal(err)
925 }
926 m.phase = phaseThinking
927 mm := typeInto(m, "/models ")
928 names := suggestNames(mm)
929 if slices.Contains(names, "remote") {
930 t.Fatalf("mid-turn popover transition must not reload config, got %v", names)
931 }
932 if !slices.Contains(names, "local") {
933 t.Fatalf("popover should still list the in-memory profiles, got %v", names)
934 }
935}
936
937// TestRunSlashPicksUpExternalConfigEdits: runSlash re-reads

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
typeIntoFunction · 0.85
suggestNamesFunction · 0.85

Tested by

no test coverage detected