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

Function TestSystemPromptFitsFixedSystemReservation

internal/tui/tui_test.go:74–83  ·  view source on GitHub ↗

TestSystemPromptFitsFixedSystemReservation pins ctx.FixedSystem against the embedded prompt. Grow the prompt past the reservation and Pack over-allocates to history on small-ctx profiles, so the next request exceeds the server's limit and 400s (or is silently truncated). On failure, raise ctx.FixedS

(t *testing.T)

Source from the content-addressed store, hash-verified

72// to history on small-ctx profiles, so the next request exceeds the server's
73// limit and 400s (or is silently truncated). On failure, raise ctx.FixedSystem;
74// don't loosen the assertion.
75func TestSystemPromptFitsFixedSystemReservation(t *testing.T) {
76 cfg, _, _ := config.Bootstrap(t.TempDir())
77 m := New(cfg, llm.New("http://x", cfg.ActiveProfile().LLM, ""), "/workspaces/codehamr", "test")
78 cost := chmctx.Message{Role: chmctx.RoleSystem, Content: m.system}.Tokens()
79 if cost > chmctx.FixedSystem {
80 t.Fatalf("system prompt costs %d tokens, FixedSystem reserves only %d - "+
81 "raise ctx.FixedSystem so Budget() doesn't over-allocate to history",
82 cost, chmctx.FixedSystem)
83 }
84}
85
86// TestCtrlDEmptyQuits: Ctrl+D on empty textarea returns a Quit command.

Callers

nothing calls this directly

Calls 5

BootstrapFunction · 0.92
NewFunction · 0.92
ActiveProfileMethod · 0.80
TokensMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected