Skip to content

config: remove dead server type re-normalization in convertStdinServerConfig#8096

Merged
lpcox merged 3 commits into
mainfrom
copilot/duplicate-code-redundant-server-normalization
Jun 26, 2026
Merged

config: remove dead server type re-normalization in convertStdinServerConfig#8096
lpcox merged 3 commits into
mainfrom
copilot/duplicate-code-redundant-server-normalization

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

convertStdinServerConfig duplicated the """stdio" and "local""stdio" normalization already performed (with mutation) by validateServerConfigWithCustomSchemas, making those guards unreachable dead code.

Changes

  • internal/config/config_stdin.go: Removed the 7-line dead normalization block; replaced with a direct assignment and a comment explaining that server.Type is already canonical after validation.
// Before
serverType := server.Type
if serverType == "" {      // never true — validator already defaulted to "stdio"
    serverType = "stdio"
}
if serverType == "local" { // never true — validator already normalized to "stdio"
    serverType = "stdio"
}

// After
// server.Type has been normalized to "stdio", "http", or a custom type by
// validateServerConfigWithCustomSchemas above; no re-normalization is needed here.
serverType := server.Type

The comment anchors the invariant so future maintainers don't re-introduce the pattern.

GitHub Advanced Security finished work on behalf of lpcox June 25, 2026 16:11
Copilot AI changed the title [WIP] Remove redundant server type re-normalization in convertStdinServerConfig config: remove dead server type re-normalization in convertStdinServerConfig Jun 25, 2026
Copilot finished work on behalf of lpcox June 25, 2026 16:14
Copilot AI requested a review from lpcox June 25, 2026 16:14
GitHub Advanced Security started work on behalf of lpcox June 25, 2026 16:14 View session
GitHub Advanced Security finished work on behalf of lpcox June 25, 2026 16:15
@lpcox lpcox marked this pull request as ready for review June 25, 2026 16:54
Copilot AI review requested due to automatic review settings June 25, 2026 16:54
@lpcox lpcox enabled auto-merge June 25, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes dead, unreachable server type normalization logic from the JSON-stdin conversion path, relying on the canonicalization already performed (with mutation) during server config validation.

Changes:

  • Removed redundant "" → "stdio" and "local" → "stdio" normalization from convertStdinServerConfig.
  • Added an inline comment documenting the post-validation invariant for server.Type.
Show a summary per file
File Description
internal/config/config_stdin.go Removes unreachable type re-normalization and documents that validation canonicalizes server.Type before conversion.

Copilot's findings

Tip

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

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

@lpcox

lpcox commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

…e-redundant-server-normalization

# Conflicts:
#	internal/config/config_stdin.go
auto-merge was automatically disabled June 25, 2026 17:17

Head branch was pushed to by a user without write access

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved. The only conflict was a comment-only difference in config_stdin.go between this branch and main — adopted main's wording. Merged in 24c3508, all checks pass.

Copilot finished work on behalf of lpcox June 25, 2026 17:18
GitHub Advanced Security started work on behalf of lpcox June 25, 2026 17:18 View session
GitHub Advanced Security finished work on behalf of lpcox June 25, 2026 17:18
@lpcox lpcox merged commit 9ac7370 into main Jun 26, 2026
27 checks passed
@lpcox lpcox deleted the copilot/duplicate-code-redundant-server-normalization branch June 26, 2026 14:33
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.

3 participants