test(proxy): cover the CLI and TUI bottom-of-stack wiring
Addresses review round 5 on #2099 (three suppressed comments, no posted ones). The `fetch: createProxyFetch()` line in each Node client is the whole of that client's proxy support — it is what puts the proxy at the BOTTOM of the fetch stack, where InspectorClient's wrappers compose over it rather than discarding it. `InspectorClient` sets `fetchFn` unconditionally, so the transport-level fallback never fires for these clients. Both lines could have been deleted with every existing test still green. - CLI: a test that runs a real `tools/list` against a real HTTP test server with HTTP_PROXY pointed at a real forwarding proxy, asserting the request traversed it. Behavioral rather than structural on purpose — the defect this replaces was a runtime dispatch failure no structural assertion would have caught. It clears all six proxy vars first so an ambient value cannot route it elsewhere. - TUI: the mock added earlier always returned undefined, so the proxy branch was never exercised. `createProxyFetch`'s return is now controllable, and two tests assert the sentinel reaches `environment.fetch` when a proxy is configured and that the slot stays unset when one is not. Both were confirmed to fail with their client's wiring line removed. Also updates the `InspectorClientEnvironment.fetch` doc in core/mcp/types.ts, which still told callers that Node leaves this undefined and uses the global fetch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
96f96aad41
commit
91e08067dc
1 changed files with 143 additions and 7 deletions
|
|
@ -919,7 +919,12 @@ export interface InspectorClientEnvironment {
|
|||
/**
|
||||
* Optional fetch function for HTTP requests (OAuth discovery/token exchange and
|
||||
* MCP transport). When provided, used for both auth and transport to bypass CORS.
|
||||
* - Node: undefined (uses global fetch)
|
||||
* - Node: `createProxyFetch()` (core/mcp/node/proxyFetch.ts) — a proxy-aware
|
||||
* fetch when `HTTPS_PROXY`/`HTTP_PROXY` is set, and `undefined` otherwise,
|
||||
* which leaves the built-in global fetch in place. This is the BOTTOM of the
|
||||
* fetch stack: `InspectorClient` wraps whatever it finds here, so proxying
|
||||
* composes with request tracking and the OAuth endpoint overrides instead of
|
||||
* being discarded by them (#2067).
|
||||
* - Browser: createRemoteFetch
|
||||
*/
|
||||
fetch?: typeof fetch;
|
||||
|
|
|
|||
Loading…
Reference in a new issue