Refactor createProviderServer into composable HTTP/WebSocket handlers#3702
Conversation
createProviderServer into composable HTTP/WebSocket handlers
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Refactors containers/api-proxy/server.js by splitting the previously large createProviderServer implementation into smaller, composable HTTP handlers (health/reflect/disabled/proxy) plus a WebSocket upgrade handler, with createProviderServer reduced to routing/composition.
Changes:
- Extracted dedicated HTTP handler factories for
/health,/reflect, disabled-provider responses, and proxy delegation. - Extracted a WebSocket upgrade handler factory and wired it via
server.on('upgrade', ...). - Simplified
createProviderServer(adapter)to orchestration/routing only (management short-circuit, endpoint routing, disabled guard, proxy fallback).
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/server.js | Breaks createProviderServer into focused handler factories and composes them into the provider server/router. |
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: 1
| * | ||
| * @param {import('./providers').ProviderAdapter} adapter | ||
| * @returns {http.Server} | ||
| * @returns {(req: http.IncomingMessage, res: http.ServerResponse) => void} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot address review feedback |
Addressed in commit |
Smoke Test Results✅ GitHub API check — 2 recent PRs verified Overall: PASS — Claude engine validation successful
|
|
Smoke Test Results ✅ GitHub MCP – PR #3704: "Reduce Documentation Maintainer workflow prompt/tool overhead" Status: FAIL
|
Smoke Test Results: Copilot BYOK (Offline) ModeStatus:
Note: Running in BYOK offline mode ( PR Context:
|
|
Smoke test partially complete. Checking connectivity. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
✅ API Proxy OpenTelemetry Tracing ValidationAll scenarios passed successfully: Scenario 1: Module Loading ✅
Scenario 2: Test Suite ✅
Scenario 3: Env Var Forwarding ✅
Scenario 4: Token Tracker Integration ✅
Scenario 5: OTEL Diagnostics ✅
Summary: All OTEL tracing integration points validated. The api-proxy correctly:
No issues found ✅
|
|
Smoke test Codex: Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
GitHub Actions Services Connectivity: ❌ FAILRedis: ❌ Connection timeout Result: All service connectivity checks failed. Services running on host are not reachable via
|
Chroot Version Comparison Test Results
Overall Result: Tests FAILED - Not all runtime versions match between host and chroot environments. Summary
The chroot environment is not using the same runtime versions as the host, which may cause compatibility issues.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
containers/api-proxy/server.jshad a largecreateProviderServerfunction combining routing, health/reflect endpoints, disabled-provider responses, rate limiting, proxy delegation, and WebSocket upgrade logic. This refactor separates those concerns into focused handlers while preserving existing behavior and call sites.What changed
createHealthCheckHandler(adapter)createReflectHandler()createDisabledProviderHandler(adapter)createProxyHandler(adapter)createWebSocketUpgradeHandler(adapter)createProviderServer(adapter)to routing/composition only:/healthand/reflectroutingserver.on('upgrade', ...)wiring via extracted upgrade handlerBehavioral intent
Illustrative structure