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

Function TestVerifyNudgeSkipsTrivialTurn

internal/tui/tui_test.go:2099–2119  ·  view source on GitHub ↗

TestVerifyNudgeSkipsTrivialTurn: a turn that did little work (toolRounds below the gate) must finish normally (finalized, no re-prompt, no system note) so quick answers and one-line edits aren't nagged.

(t *testing.T)

Source from the content-addressed store, hash-verified

2097 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2098 m.installTurnContext()
2099 m.phase = phaseStreaming
2100 m.toolRounds = verifyNudgeMinRounds
2101 m.history = []chmctx.Message{
2102 {Role: chmctx.RoleUser, Content: "build galaxy.html"},
2103 {Role: chmctx.RoleAssistant, Content: "Done - built galaxy.html with all features."},
2104 }
2105 out, cmd := m.handleStreamClosed()
2106 mm := out.(Model)
2107 if cmd == nil {
2108 t.Fatal("a substantial clean finish must re-prompt (non-nil chat cmd)")
2109 }
2110 if mm.phase != phaseThinking {
2111 t.Fatalf("re-prompt must leave phase thinking, got %v", mm.phase)
2112 }
2113 if !mm.verifyNudged {
2114 t.Fatal("verifyNudged must latch after the re-grounding nudge fires")
2115 }
2116 if n := countSystem(mm.history); n != 1 {
2117 t.Fatalf("expected exactly one re-grounding system note, got %d:\n%+v", n, mm.history)
2118 }
2119}
2120
2121// TestVerifyNudgeSkipsTrivialTurn: a turn that did little work (toolRounds below
2122// the gate) must finish normally (finalized, no re-prompt, no system note) so

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
countSystemFunction · 0.85
installTurnContextMethod · 0.80
handleStreamClosedMethod · 0.80

Tested by

no test coverage detected