(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestBuildLogsObservabilityInsights(t *testing.T) { |
| 59 | processedRuns := []ProcessedRun{ |
| 60 | { |
| 61 | Run: WorkflowRun{WorkflowName: "triage", Conclusion: "failure", Turns: 3, SafeItemsCount: 0}, |
| 62 | MissingTools: []MissingToolReport{{Tool: "terraform"}}, |
| 63 | FirewallAnalysis: &FirewallAnalysis{TotalRequests: 10, BlockedRequests: 1}, |
| 64 | }, |
| 65 | { |
| 66 | Run: WorkflowRun{WorkflowName: "triage", Conclusion: "failure", Turns: 9, SafeItemsCount: 1}, |
| 67 | MCPFailures: []MCPFailureReport{{ServerName: "github"}}, |
| 68 | FirewallAnalysis: &FirewallAnalysis{TotalRequests: 10, BlockedRequests: 7}, |
| 69 | }, |
| 70 | { |
| 71 | Run: WorkflowRun{WorkflowName: "docs", Conclusion: "success", Turns: 2, SafeItemsCount: 1}, |
| 72 | }, |
| 73 | } |
| 74 | |
| 75 | toolUsage := []ToolUsageSummary{ |
| 76 | {Name: "bash", TotalCalls: 14}, |
| 77 | {Name: "github_issue_read", TotalCalls: 6}, |
| 78 | } |
| 79 | |
| 80 | insights := buildLogsObservabilityInsights(processedRuns, toolUsage) |
| 81 | require.NotEmpty(t, insights, "expected aggregated logs insights") |
| 82 | |
| 83 | var combined []string |
| 84 | for _, insight := range insights { |
| 85 | combined = append(combined, insight.Title+" "+insight.Summary) |
| 86 | } |
| 87 | text := strings.Join(combined, "\n") |
| 88 | |
| 89 | assert.Contains(t, text, "Failure hotspot identified") |
| 90 | assert.Contains(t, text, "Execution drift observed") |
| 91 | assert.Contains(t, text, "Capability hotspot identified") |
| 92 | assert.Contains(t, text, "Network friction hotspot identified") |
| 93 | assert.Contains(t, text, "Actuation mix summarized") |
| 94 | assert.Contains(t, text, "Tool concentration observed") |
| 95 | } |
| 96 | |
| 97 | func TestBuildAuditObservabilityInsightsSuppressesHighSeverityAtFirewallCap(t *testing.T) { |
| 98 | // blocked == firewallBlockedRequestCap: the absolute-count trigger (>=10) should |
nothing calls this directly
no test coverage detected