-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor: Eliminate duplicate code in server package #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
@copilot please fix these linting errors Running [/home/runner/golangci-lint-2.8.0-linux-amd64/golangci-lint run --timeout=5m] in [/home/runner/work/gh-aw-mcpg/gh-aw-mcpg] ...
Error: issues found |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Fixed in 3b221e9. Removed redundant Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
🧪 Smoke Test Results: PASS ✅Run: 21181507084 Test Results✅ GitHub MCP (#383, #382) Recent Merged PRs
cc @lpcox @Copilot
|
Refactoring Plan for Duplicate Code in Server Package
Phase 1: Extract Authorization Header Parsing (~20 lines) ✅
extractSessionFromAuth()helper in auth.goPhase 2: Consolidate Response Writer Wrappers (~15 lines) ✅
responseWritertype in response_writer.gologgingResponseWriterin transport.gosdkLoggingResponseWriterin sdk_logging.goPhase 3: Extract HTTP Endpoint Handlers (~60 lines) ✅
handleOAuthDiscovery()helper in handlers.gohandleClose()helper in handlers.goPhase 4: Validation ✅
Summary of Changes
This refactoring successfully eliminated ~95+ lines of duplicate code across 3 significant patterns:
Authorization Header Parsing: Extracted
extractSessionFromAuth()helper functionauth.gofor maintainabilityResponse Writer Wrappers: Created unified
responseWritertyperesponse_writer.goprovides consistent interfaceHTTP Endpoint Handlers: Extracted common endpoint handlers
handlers.goprovides reusable handlersAll changes are surgical and minimal, with no functional changes or regressions.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.