TestNewHandler_NoTelemetryOnValidInput pins the hot-path contract: a well-formed tool call must NOT emit tool_input_repaired. Without this, a regression in aijson's strict-first ordering would silently flood logs.
(t *testing.T)
| 155 | // well-formed tool call must NOT emit tool_input_repaired. Without this, |
| 156 | // a regression in aijson's strict-first ordering would silently flood logs. |
| 157 | func TestNewHandler_NoTelemetryOnValidInput(t *testing.T) { |
| 158 | var buf bytes.Buffer |
| 159 | prev := slog.Default() |
| 160 | slog.SetDefault(slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelInfo}))) |
| 161 | t.Cleanup(func() { slog.SetDefault(prev) }) |
| 162 | |
| 163 | type args struct { |
| 164 | Paths []string `json:"paths"` |
| 165 | } |
| 166 | handler := NewHandler(func(_ context.Context, _ args) (*ToolCallResult, error) { |
| 167 | return ResultSuccess("ok"), nil |
| 168 | }) |
| 169 | |
| 170 | _, err := handler(t.Context(), ToolCall{ |
| 171 | Type: "function", |
| 172 | Function: FunctionCall{ |
| 173 | Name: "read_multiple_files", |
| 174 | Arguments: `{"paths":["a.txt","b.txt"]}`, |
| 175 | }, |
| 176 | }) |
| 177 | require.NoError(t, err) |
| 178 | assert.NotContains(t, buf.String(), "tool_input_repaired") |
| 179 | } |
| 180 | |
| 181 | func TestToolCallResultWithoutPayload(t *testing.T) { |
| 182 | t.Parallel() |
nothing calls this directly
no test coverage detected