Skip to content

[duplicate-code] Duplicate Code Analysis Report #8399

Description

@github-actions

Summary

Analysis of commit 2af6d3e (Apply cobra best practices for testability and conventions #8347) found 3 significant duplication patterns across the internal/cmd/ and internal/server/ packages. The primary issue is inconsistent use of the logger.StartupInfo consolidation abstraction that was designed to eliminate dual-logging boilerplate.

Detected Patterns

  1. Dual logging bypassing logger.StartupInfo in proxy.go — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Dual logging bypassing logger.StartupInfo in proxy.go #8400
  2. Dual logging in server close/shutdown handler — Severity: Low — See sub-issue [duplicate-code] Duplicate Code Pattern: Dual logging in server close/shutdown handler #8401
  3. Structural divergence between run() and runProxy() startup routines — Severity: Medium — See sub-issue [duplicate-code] Duplicate Code Pattern: Structural divergence between run() and runProxy() startup routines #8402

Overall Impact

  • Total Duplicated/Inconsistent Lines: ~14 lines directly affected, plus structural divergence in startup flows
  • Affected Files: 3 non-test Go files (internal/cmd/proxy.go, internal/server/handlers.go, internal/cmd/root.go)
  • Maintainability Risk: Medium — inconsistent use of established abstractions means fixes applied to one code path may not propagate to the other, and new patterns following proxy.go as a template will embed the old approach
  • Refactoring Priority: Medium — straightforward mechanical fixes that eliminate the inconsistency and can be completed in a single PR

Next Steps

  1. Review individual sub-issues for detailed code locations and refactoring recommendations
  2. Fix proxy.go dual-logging (highest priority — clearest pattern violation)
  3. Align run() and runProxy() shutdown cleanup (avoids potential resource leak)

Analysis Metadata

  • Analyzed Files: 130+ Go files (non-test, non-workflow, internal/)
  • Detection Method: Manual semantic analysis of changed files in commit 2af6d3e
  • Commit: 2af6d3e
  • Analysis Date: 2026-07-01
  • Triggered By: @lpcox

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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