fix: widen the test recorder's metadata type and correct a stale comment

`RecordedRequest.metadata` was still `Record<string, string>`, so the recorder
advertised a string-only contract it no longer honors. The new CLI tests assert
objects and arrays against it and passed only because `toEqual` does not
enforce the declared type.

Typed as `Record<string, unknown>` rather than core's `RequestMetadata`:
test-servers compiles standalone (`tsc -p test-servers`, NodeNext, no `paths`),
so it has no `@inspector/core` alias to import through.

Also update `progressTokenOf`'s doc comment, which still claimed an invalid
token "reaches the wire inside `_meta`" — untrue since mergeMeta started
deleting it. It now names the split: progressTokenOf governs callback
correlation, mergeMeta governs wire sanitization, both via isProgressToken.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177mPHAdECD18nLLCTwR5rh
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-23 13:49:55 -04:00
commit f3878f94a9

View file

@ -83,7 +83,18 @@ export interface RecordedRequest {
method: string;
params?: Record<string, unknown>;
headers?: Record<string, string>;
metadata?: Record<string, string>;
/**
* The request's `_meta`, recorded verbatim. Values are arbitrary JSON —
* objects, arrays, numbers, booleans, `null` — not just strings (#1910), so
* a test asserting on a structured value gets a contract that matches what
* the recorder actually holds.
*
* Typed as `unknown` values rather than `@inspector/core`'s
* `RequestMetadata`: this package compiles standalone (`tsc -p test-servers`,
* NodeNext, no `paths`), so it has no `@inspector/core` alias to import
* through.
*/
metadata?: Record<string, unknown>;
response: unknown;
timestamp: number;
}