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

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
typeIntoFunction · 0.85
suggestNamesFunction · 0.85

Tested by

no test coverage detected