MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestEmbeddedPromptFitsFixedSystem

Function TestEmbeddedPromptFitsFixedSystem

internal/ctx/ctx_test.go:17–24  ·  view source on GitHub ↗

TestEmbeddedPromptFitsFixedSystem guards the invariant the packer relies on: FixedSystem must reserve enough budget for the embedded system prompt PLUS the "\n\nWorking directory: " anchor buildSystem appends. If a prompt edit pushes the embedded text past this, the reservation under-counts an

(t *testing.T)

Source from the content-addressed store, hash-verified

15// silently over-fills the real context, a bug with no other test to catch it.
16// anchorAllowance covers a generously long working-directory path (~384 chars).
17func TestEmbeddedPromptFitsFixedSystem(t *testing.T) {
18 const anchorAllowance = 96 // tokens; "\n\nWorking directory: " + a deep container path
19 used := Tokens(config.DefaultSystemPrompt) + anchorAllowance
20 if used > FixedSystem {
21 t.Fatalf("embedded prompt (%d tok) + anchor allowance (%d) = %d exceeds FixedSystem=%d; trim the prompt or bump FixedSystem",
22 Tokens(config.DefaultSystemPrompt), anchorAllowance, used, FixedSystem)
23 }
24}
25
26func TestTokensHeuristic(t *testing.T) {
27 cases := map[string]int{

Callers

nothing calls this directly

Calls 1

TokensFunction · 0.85

Tested by

no test coverage detected