Skip to content

[duplicate-code] Duplicate Code Analysis Report #3931

@github-actions

Description

@github-actions

🔍 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:

  1. Repeated logInboundRPCResponse block in SendRequestWithServerID — Severity: Medium — See sub-issue #aw_conn456log789
  2. 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

  1. Review individual pattern sub-issues for detailed analysis
  2. Pattern 1 (logging block) is the higher priority as it has 3 occurrences and is in a hot path
  3. 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 ·

  • expires on Apr 23, 2026, 6:12 AM UTC

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