🔍 Duplicate Code Analysis Report
Analysis of commit 28f4c74
Summary
Analysis of the HTTP backend transport refactor (#3911) identified 2 significant duplication patterns in internal/mcp/connection.go and internal/mcp/http_transport.go. Both patterns qualify for refactoring: one has 3 identical code blocks (~15 lines), the other has a constant defined in config but shadowed by inline hardcoded values in 2 places.
Detected Patterns
This analysis found 2 significant duplication patterns:
- Repeated
logInboundRPCResponse block in SendRequestWithServerID — Severity: Medium — See sub-issue #aw_conn456log789
- Hardcoded 30-second connect timeout default duplicated in
connection.go — Severity: Low — See sub-issue #aw_tout890def012
Overall Impact
- Total Duplicated Lines: ~20 lines (3 blocks × 5 lines for pattern 1; 2 inline defaults for pattern 2)
- Affected Files: 1 primary file (
internal/mcp/connection.go), 1 supporting file (internal/mcp/http_transport.go)
- Maintainability Risk: Medium — The logging block duplication means future changes to response logging logic must be applied in 3 places
- Refactoring Priority: Low-medium — code is correct but harder to maintain
Next Steps
- Review individual pattern sub-issues for detailed analysis
- Pattern 1 (logging block) is the higher priority as it has 3 occurrences and is in a hot path
- Pattern 2 (timeout default) is a consistency fix that aligns with existing config constants
Analysis Metadata
- Analyzed Files: ~100 Go files changed in this commit (non-test)
- Detection Method: Static code inspection, pattern search
- Commit: 28f4c74
- Analysis Date: 2026-04-16
Generated by Duplicate Code Detector · ● 1.4M · ◷
🔍 Duplicate Code Analysis Report
Analysis of commit 28f4c74
Summary
Analysis of the HTTP backend transport refactor (
#3911) identified 2 significant duplication patterns ininternal/mcp/connection.goandinternal/mcp/http_transport.go. Both patterns qualify for refactoring: one has 3 identical code blocks (~15 lines), the other has a constant defined in config but shadowed by inline hardcoded values in 2 places.Detected Patterns
This analysis found 2 significant duplication patterns:
logInboundRPCResponseblock inSendRequestWithServerID— Severity: Medium — See sub-issue #aw_conn456log789connection.go— Severity: Low — See sub-issue #aw_tout890def012Overall Impact
internal/mcp/connection.go), 1 supporting file (internal/mcp/http_transport.go)Next Steps
Analysis Metadata