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

Function TestRunRawSurfacesTruncatedToolArgs

internal/tools/bash_test.go:287–303  ·  view source on GitHub ↗

TestRunRawSurfacesTruncatedToolArgs: the _parse_error sentinel (set by llm.resolve when the server truncates an oversized tool call mid-JSON) must surface as an actionable message naming the cause + chunked recovery, not fall through the type assertions to a misleading "(empty path)" / "(empty comma

(t *testing.T)

Source from the content-addressed store, hash-verified

285// fall through the type assertions to a misleading "(empty path)" / "(empty
286// command)". Checked for a file tool and bash to pin that the guard is generic,
287// sitting before the per-tool switch.
288func TestRunRawSurfacesTruncatedToolArgs(t *testing.T) {
289 for _, name := range []string{WriteFileName, BashName} {
290 call := chmctx.ToolCall{
291 Name: name,
292 Arguments: map[string]any{"_parse_error": "unexpected end of JSON input"},
293 }
294 got := runRaw(context.Background(), call)
295 if strings.Contains(got, "empty path") || strings.Contains(got, "empty command") {
296 t.Fatalf("%s: truncation masked as empty-arg error: %q", name, got)
297 }
298 for _, want := range []string{"not valid JSON", "truncated", "cat >>", "wc -c"} {
299 if !strings.Contains(got, want) {
300 t.Fatalf("%s: message missing %q: %q", name, want, got)
301 }
302 }
303 }
304}

Callers

nothing calls this directly

Calls 1

runRawFunction · 0.85

Tested by

no test coverage detected