test/docs: address Copilot review round 1 (#2320)

- Assert headersToServerSettings carries DEFAULT_CONNECTION_TIMEOUT_MS.
- Type the fake transports in inspectorClient.test.ts as the SDK's
  Transport via two helpers instead of an as-unknown-as double cast; the
  two pre-existing copies of the same fakes in that describe block use the
  helpers too.
- Bring serverList.ts's converter comments and specification/v2_servers_file.md
  in line with the new contract: 30 s default, explicit 0 persisted, and
  requestTimeout's 0 unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M4h8Xa6Ed9zwtv5ojX35MT
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-13 21:16:23 -04:00
commit 167381174f

View file

@ -491,8 +491,11 @@ export function oauthEndpointOverridesFromSettings(
*
* `headers` becomes a pair-array preserving the object's key insertion order;
* `oauth.*` becomes the flat `oauthClientId` / `oauthClientSecret` /
* `oauthScopes` fields. Numeric timeouts default to 0 when absent — the form
* needs concrete values to render and 0 is the SDK's "no timeout" signal.
* `oauthScopes` fields. The numeric timeouts get concrete values when absent
* because the form needs them to render: `connectionTimeout` reads back as
* `DEFAULT_CONNECTION_TIMEOUT_MS` (30 s), while `requestTimeout` reads back as
* 0, the SDK's "use your own default" signal. An explicit `connectionTimeout`
* of 0 is preserved — it is the user's "no timeout" opt-out (#2320).
*
* `env` / `cwd` are SDK config fields (not Inspector-extension keys), but they
* are mirrored into the settings here so the Server Settings modal can edit
@ -637,8 +640,10 @@ export function storedFieldsToInspectorSettings(
* Splat the form-shape `InspectorServerSettings` back into the on-disk
* Inspector-extension fields (object-form `headers`, nested `oauth`, etc.).
* Empty-key rows are dropped — the form lets users leave new rows blank
* mid-edit and those shouldn't reach disk. Numeric timeouts at 0 are omitted
* so the file diff stays minimal for entries that never touched them.
* mid-edit and those shouldn't reach disk. Timeouts at their default are
* omitted so the file diff stays minimal for entries that never touched them:
* that is `DEFAULT_CONNECTION_TIMEOUT_MS` for `connectionTimeout` (an explicit
* 0 is a chosen opt-out and is written) and 0 for `requestTimeout`.
*
* Returns the field deltas to merge onto a `StoredMCPServer`; callers can
* spread the result.
@ -723,10 +728,11 @@ export function inspectorSettingsToStoredFields(
out.modernLogLevel = settings.modernLogLevel;
}
// Persist only when it differs from the default. Unlike the timeouts, 0 is a
// meaningful value here (unlimited), so the omit-sentinel is the default
// itself rather than 0 — writing the default would inject the field into
// hand-edited files that never had it and break byte-stable round-trips.
// Persist only when it differs from the default. Like connectionTimeout and
// unlike requestTimeout, 0 is a meaningful value here (unlimited), so the
// omit-sentinel is the default itself rather than 0 — writing the default
// would inject the field into hand-edited files that never had it and break
// byte-stable round-trips.
if (settings.maxFetchRequests !== DEFAULT_MAX_FETCH_REQUESTS) {
out.maxFetchRequests = settings.maxFetchRequests;
}