Repository navigation
refactor(e2e): consolidate fake provider protocol utilities - #6368
Conversation
📝 WalkthroughWalkthroughIntroduces a shared HTTP protocol test-fixture module ( ChangesHTTP protocol fixture consolidation
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/e2e/fixtures/http-protocol.ts (1)
56-72: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winConsider defaulting to loopback instead of all interfaces.
listenServerdefaultshostto"0.0.0.0", binding the test server to every network interface rather than just loopback. For local/CI e2e test servers,127.0.0.1is sufficient and reduces exposure (e.g., other hosts/containers on a shared network reaching the ephemeral test port).🔒 Suggested default
export async function listenServer( server: http.Server, port = 0, - host = "0.0.0.0", + host = "127.0.0.1", ): Promise<number> {If any downstream test genuinely needs cross-container reachability, that call site can pass
"0.0.0.0"explicitly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/e2e/fixtures/http-protocol.ts` around lines 56 - 72, The listenServer helper currently defaults the host argument to 0.0.0.0, which binds the test server to all interfaces instead of loopback. Update the default host in listenServer so local e2e tests listen on 127.0.0.1 by default, and keep 0.0.0.0 available only when a caller explicitly passes it. Use the listenServer function signature and its server.listen call to make the change without altering the port-binding behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/e2e/fixtures/http-protocol.ts`:
- Around line 56-72: The listenServer helper currently defaults the host
argument to 0.0.0.0, which binds the test server to all interfaces instead of
loopback. Update the default host in listenServer so local e2e tests listen on
127.0.0.1 by default, and keep 0.0.0.0 available only when a caller explicitly
passes it. Use the listenServer function signature and its server.listen call to
make the change without altering the port-binding behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f1b522d3-785b-4741-96a9-714b8d6a6518
📒 Files selected for processing (5)
test/e2e/fixtures/http-protocol.tstest/e2e/live/hermes-inference-switch-helpers.tstest/e2e/live/mcp-bridge-servers.tstest/e2e/live/messaging-compatible-endpoint.test.tstest/e2e/support/e2e-http-protocol.test.ts
cv
left a comment
There was a problem hiding this comment.
Maintainer review: the shared fake-provider protocol helpers preserve the existing HTTP/SSE contracts and failure semantics with focused E2E coverage. Current-main synchronization cleared the stale growth artifact and the unrelated timeout did not recur; all exact-head checks, DCO, signatures, and review threads are clean.
) ## Summary Consolidate shared fake-provider HTTP mechanics—request bodies, JSON/SSE responses, and deterministic server listen/close—without changing mock-versus-hosted inference selection (NVIDIA#5745). Closes NVIDIA#6349 Parent epic: NVIDIA#6346 Related: NVIDIA#5745 ## Changes - Add reusable request-body, JSON response, raw/named SSE, listen, and close primitives. - Migrate messaging-compatible, MCP bridge, and Hermes inference-switch mock servers. - Preserve scenario-specific request logs, streaming shapes, auth checks, and cleanup. - Document the protocol-only boundary with NVIDIA#5745. - Add focused real-server protocol tests. ## Verification - [x] Signed/Verified commit and all hooks passed - [x] `npm run build:cli` - [x] `npm run typecheck:cli` - [x] `npm run lint` - [x] Protocol and migrated-helper support tests: 23 passed - [x] No production provider behavior or inference-mode policy changed --- Signed-off-by: Julie Yaunches <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added shared HTTP test helpers for reading request bodies, writing JSON responses, and sending SSE streams. * Updated end-to-end tests to use the shared helpers for server setup, response handling, and cleanup. * Added coverage for HTTP request/response behavior, including JSON and streaming event responses. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Carlos Villela <[email protected]>
Summary
Consolidate shared fake-provider HTTP mechanics—request bodies, JSON/SSE responses, and deterministic server listen/close—without changing mock-versus-hosted inference selection (#5745).
Closes #6349
Parent epic: #6346
Related: #5745
Changes
Verification
npm run build:clinpm run typecheck:clinpm run lintSigned-off-by: Julie Yaunches [email protected]
Summary by CodeRabbit