Skip to content

[duplicate-code] Duplicate Code Analysis Report #3631

@github-actions

Description

@github-actions

Summary

Analysis of commit a82e67c6b31d61fa4ce9ef22b2e0bf476f943900 ("chore: upgrade go-sdk to v1.5.0 and address go-fan review items") identified 3 significant duplication patterns in the files modified by that commit, all concentrated in internal/mcp/connection.go. Two patterns are medium severity and one is high severity.

Detected Patterns

This analysis found 3 significant duplication patterns:

  1. Duplicate Session Reconnect Telemetry – Severity: High – See sub-issue [duplicate-code] Duplicate Code Pattern: Session Reconnect Telemetry in connection.go #3632
  2. Mixed log.Printf / logger.LogInfo Parallel Logging – Severity: Medium – See sub-issue [duplicate-code] Duplicate Code Pattern: Mixed log.Printf / logger.LogInfo Parallel Logging in connection.go #3633
  3. Redundant SSE Deprecation Warning Burst – Severity: Medium – See sub-issue [duplicate-code] Duplicate Code Pattern: Redundant SSE Deprecation Warning Burst in connection.go #3634

Overall Impact

  • Total Duplicated Lines: ~12 duplicated log lines (6 unique lines each repeated across two functions or multiple calls)
  • Affected Files: 1 primary file (internal/mcp/connection.go)
  • Maintainability Risk: Medium — duplicate log messages create inconsistency risk when one copy is updated but not the other
  • Refactoring Priority: Medium — no production correctness impact, but fixing Pattern 1 prevents future divergence between two sibling reconnect paths

Next Steps

  1. Review individual pattern sub-issues for detailed analysis
  2. Pattern 1 (reconnect telemetry) is the highest priority — shared helper function is a one-time fix
  3. Patterns 2 & 3 can be addressed in a single cleanup pass of the SSE/transport connection block

Analysis Metadata

  • Analyzed Files: 3 Go files (internal/mcp/connection.go, internal/mcp/http_transport.go, internal/server/tool_registry.go)
  • Detection Method: Semantic code analysis + pattern search
  • Commit: a82e67c6b31d61fa4ce9ef22b2e0bf476f943900
  • Analysis Date: 2026-04-12

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions