Skip to content

Refactor semantic clustering: collapse thin server/logger files and extract proxy address helper#6831

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering
Jun 1, 2026
Merged

Refactor semantic clustering: collapse thin server/logger files and extract proxy address helper#6831
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

This PR addresses the semantic-function refactor findings by removing two thin wrapper files and relocating one outlier utility function to a focused helper file. Behavior is preserved while tightening package organization and reducing indirection.

  • Server HTTP construction co-location

    • Moved CreateHTTPServerForMCP into internal/server/http_server.go, next to buildMCPHTTPServer and newHTTPServer.
    • Removed internal/server/transport.go (single-function wrapper file).
  • Logger startup helper consolidation

    • Moved StartupInfo and StartupWarn into internal/logger/global_helpers.go with other global logger helpers.
    • Removed internal/logger/startup.go (two-function wrapper file).
  • Proxy address utility extraction

    • Extracted clientAddr from internal/cmd/proxy.go into internal/cmd/addr.go.
    • Kept it in cmd scope (unexported) to preserve current call sites and tests while removing the outlier from the main proxy command flow.
// internal/cmd/addr.go
func clientAddr(addr string) string {
	host, port, err := net.SplitHostPort(addr)
	if err != nil {
		return addr
	}
	switch host {
	case "", "0.0.0.0", "::", "[::]":
		return net.JoinHostPort("localhost", port)
	}
	return addr
}

Copilot AI changed the title [WIP] Refactor semantic function clustering by consolidating thin files Refactor semantic clustering: collapse thin server/logger files and extract proxy address helper Jun 1, 2026
Copilot finished work on behalf of lpcox June 1, 2026 03:53
Copilot AI requested a review from lpcox June 1, 2026 03:53
@lpcox lpcox marked this pull request as ready for review June 1, 2026 04:16
Copilot AI review requested due to automatic review settings June 1, 2026 04:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pure refactor that consolidates thin wrapper files in internal/server and internal/logger, and extracts an outlier helper from internal/cmd/proxy.go into its own file. No behavior changes.

Changes:

  • Move CreateHTTPServerForMCP (and logTransport) from deleted internal/server/transport.go into internal/server/http_server.go.
  • Move StartupInfo / StartupWarn from deleted internal/logger/startup.go into internal/logger/global_helpers.go.
  • Extract unexported clientAddr from internal/cmd/proxy.go into new internal/cmd/addr.go.
Show a summary per file
File Description
internal/server/transport.go Deleted; contents relocated to http_server.go.
internal/server/http_server.go Adds CreateHTTPServerForMCP and logTransport next to the shared HTTP scaffold.
internal/logger/startup.go Deleted; helpers moved to global_helpers.go.
internal/logger/global_helpers.go Adds StartupInfo / StartupWarn and a log import.
internal/cmd/proxy.go Removes clientAddr helper.
internal/cmd/addr.go New file holding the clientAddr helper.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 65849e8 into main Jun 1, 2026
29 checks passed
@lpcox lpcox deleted the copilot/refactor-semantic-function-clustering branch June 1, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Semantic function clustering: thin files and one outlier function to consolidate

3 participants