--- Tool calls diff in RunMetricsDiff integration test ---
(t *testing.T)
| 1417 | // --- Tool calls diff in RunMetricsDiff integration test --- |
| 1418 | |
| 1419 | func TestComputeRunMetricsDiff_WithToolCallsDiff(t *testing.T) { |
| 1420 | m1 := LogMetrics{ |
| 1421 | ToolCalls: []ToolCallInfo{ |
| 1422 | {Name: "bash", CallCount: 5}, |
| 1423 | {Name: "gh", CallCount: 3}, |
| 1424 | }, |
| 1425 | Turns: 4, |
| 1426 | } |
| 1427 | m2 := LogMetrics{ |
| 1428 | ToolCalls: []ToolCallInfo{ |
| 1429 | {Name: "bash", CallCount: 12}, |
| 1430 | {Name: "gh", CallCount: 3}, |
| 1431 | {Name: "edit", CallCount: 4}, |
| 1432 | }, |
| 1433 | Turns: 6, |
| 1434 | } |
| 1435 | summary1 := &RunSummary{ |
| 1436 | Run: WorkflowRun{TokenUsage: 5000, Turns: 4}, |
| 1437 | Metrics: m1, |
| 1438 | } |
| 1439 | summary2 := &RunSummary{ |
| 1440 | Run: WorkflowRun{TokenUsage: 9000, Turns: 6}, |
| 1441 | Metrics: m2, |
| 1442 | } |
| 1443 | |
| 1444 | diff := computeRunMetricsDiff(summary1, summary2) |
| 1445 | require.NotNil(t, diff, "Should produce metrics diff") |
| 1446 | require.NotNil(t, diff.ToolCallsDiff, "Should include tool calls diff") |
| 1447 | |
| 1448 | assert.Len(t, diff.ToolCallsDiff.NewTools, 1, "Should have 1 new tool (edit)") |
| 1449 | assert.Len(t, diff.ToolCallsDiff.ChangedTools, 1, "Should have 1 changed tool (bash)") |
| 1450 | assert.Empty(t, diff.ToolCallsDiff.RemovedTools, "Should have no removed tools") |
| 1451 | |
| 1452 | require.NotNil(t, diff.ToolCallsDiff.BashDiff, "Should have bash diff") |
| 1453 | assert.Equal(t, 5, diff.ToolCallsDiff.BashDiff.Run1TotalCalls, "Bash run1 total should be 5") |
| 1454 | assert.Equal(t, 12, diff.ToolCallsDiff.BashDiff.Run2TotalCalls, "Bash run2 total should be 12") |
| 1455 | } |
| 1456 | |
| 1457 | // findToolCallDiffEntry is a test helper to find a tool entry by name |
| 1458 | func findToolCallDiffEntry(entries []ToolCallDiffEntry, name string) *ToolCallDiffEntry { |
nothing calls this directly
no test coverage detected