Skip to content

Commit 96b9f06

Browse files
Copilotpelikhan
andcommitted
Fix Go linting issues - remove unused functions and test references
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 4505508 commit 96b9f06

3 files changed

Lines changed: 0 additions & 138 deletions

File tree

pkg/cli/logs_report.go

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -651,111 +651,12 @@ func buildRedactedDomainsSummary(processedRuns []ProcessedRun) *RedactedDomainsL
651651

652652
// logErrorAggregator and related functions have been removed since error patterns are no longer supported
653653

654-
// aggregateLogErrors has been removed since error patterns are no longer supported
655-
func aggregateLogErrors(processedRuns []ProcessedRun, agg interface{}) []ErrorSummary {
656-
// Return empty slice since error patterns have been removed
657-
return []ErrorSummary{}
658-
}
659-
660-
// isActionableError checks if an error message is actionable (user-relevant)
661-
// Returns false for internal debug messages, validation logs, JSON fragments, etc.
662-
func isActionableError(message string) bool {
663-
msg := strings.ToLower(message)
664-
665-
// Filter out internal validation/debug messages
666-
debugPatterns := []string{
667-
"validation completed",
668-
"executePromptDirectly",
669-
"starting validate_errors",
670-
"loaded", "error patterns",
671-
"pattern ", "/16:", // Pattern testing logs
672-
"validation completed in",
673-
"starting error validation",
674-
"error validation completed",
675-
"const { main }",
676-
"require(",
677-
"perfect! the",
678-
"failed as expected",
679-
}
680-
681-
for _, pattern := range debugPatterns {
682-
if strings.Contains(msg, pattern) {
683-
return false
684-
}
685-
}
686-
687-
// Filter out JSON fragments and data structures
688-
jsonPatterns := []string{
689-
`"errorCodesToRetry"`,
690-
`"description":`,
691-
`"statement":`,
692-
`"content":`,
693-
`"onRequestError"`,
694-
`[{`, `}]`, `"[`,
695-
}
696-
697-
for _, pattern := range jsonPatterns {
698-
if strings.Contains(message, pattern) {
699-
return false
700-
}
701-
}
702-
703-
// Filter out MCP server logs (stderr output)
704-
if strings.Contains(msg, "[mcp server") ||
705-
strings.Contains(msg, "[safeoutputs]") ||
706-
strings.Contains(msg, "send: {\"jsonrpc\"") {
707-
return false
708-
}
709-
710-
// Filter out Squid proxy logs
711-
if strings.Contains(msg, "::1:") && strings.Contains(msg, "NONE_NONE:HIER_NONE") {
712-
return false
713-
}
714-
715-
// Filter out tool invocation result logs (these are outputs, not errors)
716-
if strings.HasPrefix(msg, "tool invocation result:") {
717-
return false
718-
}
719-
720-
return true
721-
}
722-
723654
// buildCombinedErrorsSummary has been removed since error patterns are no longer supported
724655
func buildCombinedErrorsSummary(processedRuns []ProcessedRun) []ErrorSummary {
725656
// Return empty slice since error patterns have been removed
726657
return []ErrorSummary{}
727658
}
728659

729-
// buildErrorsSummary aggregates errors and warnings across all runs
730-
// Returns two slices: errorsSummary and warningsSummary
731-
// DEPRECATED: Use buildCombinedErrorsSummary instead
732-
func buildErrorsSummary(processedRuns []ProcessedRun) ([]ErrorSummary, []ErrorSummary) {
733-
// Get combined summary
734-
combined := buildCombinedErrorsSummary(processedRuns)
735-
736-
// Separate into errors and warnings
737-
var errorsSummary []ErrorSummary
738-
var warningsSummary []ErrorSummary
739-
740-
for _, summary := range combined {
741-
if summary.Type == "Error" {
742-
errorsSummary = append(errorsSummary, summary)
743-
} else {
744-
warningsSummary = append(warningsSummary, summary)
745-
}
746-
}
747-
748-
// Sort each by count (descending)
749-
sort.Slice(errorsSummary, func(i, j int) bool {
750-
return errorsSummary[i].Count > errorsSummary[j].Count
751-
})
752-
sort.Slice(warningsSummary, func(i, j int) bool {
753-
return warningsSummary[i].Count > warningsSummary[j].Count
754-
})
755-
756-
return errorsSummary, warningsSummary
757-
}
758-
759660
// renderLogsJSON outputs the logs data as JSON
760661
func renderLogsJSON(data LogsData) error {
761662
reportLog.Printf("Rendering logs data as JSON: %d runs", data.Summary.TotalRuns)

pkg/workflow/engine_parsing_simple_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ Line 5`,
323323
metrics := engine.ParseLogMetrics(tt.logContent, tt.verbose)
324324

325325
// Basic validation - should return valid struct
326-
}
327326
if metrics.TokenUsage < 0 {
328327
t.Errorf("TokenUsage should not be negative, got %d", metrics.TokenUsage)
329328
}

pkg/workflow/metrics_test.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,10 @@ func TestFinalizeToolMetrics(t *testing.T) {
762762
currentSequence []string
763763
turns int
764764
tokenUsage int
765-
logContent string
766-
errorPatterns []ErrorPattern
767765
expectedTurns int
768766
expectedTokens int
769767
expectedToolLen int
770768
expectedSeqLen int
771-
expectedErrors int
772769
}{
773770
{
774771
name: "Basic finalization with sequence and tools",
@@ -781,13 +778,10 @@ func TestFinalizeToolMetrics(t *testing.T) {
781778
currentSequence: []string{"bash", "github_search", "web_fetch"},
782779
turns: 5,
783780
tokenUsage: 1500,
784-
logContent: "",
785-
errorPatterns: nil,
786781
expectedTurns: 5,
787782
expectedTokens: 1500,
788783
expectedToolLen: 3,
789784
expectedSeqLen: 1,
790-
expectedErrors: 0,
791785
},
792786
{
793787
name: "Empty sequence should not be added",
@@ -798,13 +792,10 @@ func TestFinalizeToolMetrics(t *testing.T) {
798792
currentSequence: []string{},
799793
turns: 2,
800794
tokenUsage: 500,
801-
logContent: "",
802-
errorPatterns: nil,
803795
expectedTurns: 2,
804796
expectedTokens: 500,
805797
expectedToolLen: 1,
806798
expectedSeqLen: 0,
807-
expectedErrors: 0,
808799
},
809800
{
810801
name: "Tools should be sorted by name",
@@ -817,36 +808,10 @@ func TestFinalizeToolMetrics(t *testing.T) {
817808
currentSequence: []string{"zebra_tool", "alpha_tool"},
818809
turns: 3,
819810
tokenUsage: 800,
820-
logContent: "",
821-
errorPatterns: nil,
822811
expectedTurns: 3,
823812
expectedTokens: 800,
824813
expectedToolLen: 3,
825814
expectedSeqLen: 1,
826-
expectedErrors: 0,
827-
},
828-
{
829-
name: "Error patterns should be counted",
830-
initialMetrics: LogMetrics{},
831-
toolCallMap: map[string]*ToolCallInfo{},
832-
currentSequence: []string{},
833-
turns: 1,
834-
tokenUsage: 100,
835-
logContent: `
836-
Error: File not found
837-
Warning: Deprecated API used
838-
Error: Connection timeout
839-
Info: Processing complete
840-
`,
841-
errorPatterns: []ErrorPattern{
842-
{Pattern: `(?i)error:?\s+(.+)`, LevelGroup: 0, MessageGroup: 1},
843-
{Pattern: `(?i)warning:?\s+(.+)`, LevelGroup: 0, MessageGroup: 1},
844-
},
845-
expectedTurns: 1,
846-
expectedTokens: 100,
847-
expectedToolLen: 0,
848-
expectedSeqLen: 0,
849-
expectedErrors: 3, // 2 errors + 1 warning
850815
},
851816
{
852817
name: "Existing sequences should be preserved",
@@ -861,13 +826,10 @@ Info: Processing complete
861826
currentSequence: []string{"tool3", "tool4"},
862827
turns: 2,
863828
tokenUsage: 300,
864-
logContent: "",
865-
errorPatterns: nil,
866829
expectedTurns: 2,
867830
expectedTokens: 300,
868831
expectedToolLen: 1,
869832
expectedSeqLen: 2, // 1 existing + 1 new
870-
expectedErrors: 0,
871833
},
872834
}
873835

0 commit comments

Comments
 (0)