(t *testing.T)
| 304 | } |
| 305 | |
| 306 | func TestBuildLogsDataAggregatesDispatchEpisode(t *testing.T) { |
| 307 | tmpDir := testutil.TempDir(t, "test-episode-*") |
| 308 | processedRuns := []ProcessedRun{ |
| 309 | { |
| 310 | Run: WorkflowRun{ |
| 311 | DatabaseID: 2001, |
| 312 | WorkflowName: "orchestrator", |
| 313 | WorkflowPath: ".github/workflows/orchestrator.yml", |
| 314 | Status: "completed", |
| 315 | Conclusion: "success", |
| 316 | Duration: 2 * time.Minute, |
| 317 | TokenUsage: 300, |
| 318 | CreatedAt: time.Date(2024, 2, 1, 12, 0, 0, 0, time.UTC), |
| 319 | StartedAt: time.Date(2024, 2, 1, 12, 0, 0, 0, time.UTC), |
| 320 | UpdatedAt: time.Date(2024, 2, 1, 12, 2, 0, 0, time.UTC), |
| 321 | LogsPath: filepath.Join(tmpDir, "run-2001"), |
| 322 | }, |
| 323 | AgenticAssessments: []AgenticAssessment{{Kind: "resource_heavy_for_domain", Severity: "medium"}}, |
| 324 | }, |
| 325 | { |
| 326 | Run: WorkflowRun{ |
| 327 | DatabaseID: 2002, |
| 328 | WorkflowName: "worker", |
| 329 | WorkflowPath: ".github/workflows/worker.yml", |
| 330 | Status: "completed", |
| 331 | Conclusion: "success", |
| 332 | Duration: 4 * time.Minute, |
| 333 | TokenUsage: 700, |
| 334 | MissingToolCount: 1, |
| 335 | CreatedAt: time.Date(2024, 2, 1, 12, 3, 0, 0, time.UTC), |
| 336 | StartedAt: time.Date(2024, 2, 1, 12, 3, 0, 0, time.UTC), |
| 337 | UpdatedAt: time.Date(2024, 2, 1, 12, 7, 0, 0, time.UTC), |
| 338 | LogsPath: filepath.Join(tmpDir, "run-2002"), |
| 339 | }, |
| 340 | AwContext: &AwContext{ |
| 341 | Repo: "github/gh-aw", |
| 342 | RunID: "2001", |
| 343 | WorkflowID: "github/gh-aw/.github/workflows/orchestrator.yml@refs/heads/main", |
| 344 | WorkflowCallID: "2001-1", |
| 345 | EventType: "workflow_dispatch", |
| 346 | }, |
| 347 | BehaviorFingerprint: &BehaviorFingerprint{ActuationStyle: "selective_write"}, |
| 348 | AgenticAssessments: []AgenticAssessment{{Kind: "resource_heavy_for_domain", Severity: "high"}}, |
| 349 | MCPFailures: []MCPFailureReport{{ServerName: "github", Status: "failed"}}, |
| 350 | }, |
| 351 | } |
| 352 | |
| 353 | logsData := buildLogsData(processedRuns, tmpDir, nil) |
| 354 | |
| 355 | if logsData.Summary.TotalEpisodes != 1 { |
| 356 | t.Fatalf("Expected 1 episode, got %d", logsData.Summary.TotalEpisodes) |
| 357 | } |
| 358 | if logsData.Summary.HighConfidenceEpisodes != 1 { |
| 359 | t.Fatalf("Expected 1 high-confidence episode, got %d", logsData.Summary.HighConfidenceEpisodes) |
| 360 | } |
| 361 | if len(logsData.Edges) != 1 { |
| 362 | t.Fatalf("Expected 1 edge, got %d", len(logsData.Edges)) |
| 363 | } |
nothing calls this directly
no test coverage detected