chore: close quality-gate coverage gaps (#1689) (#1766)
Some checks failed
Run install, format, lint, build, and test on every push / build (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish-github-container-registry (push) Has been cancelled
Some checks failed
Run install, format, lint, build, and test on every push / build (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish-github-container-registry (push) Has been cancelled
Closes #1689. Typecheck cli/tui src, add a core/ format+lint gate, and gate core/json + core/client coverage. See PR #1766 for the full review history.
This commit is contained in:
parent
d76c4d5379
commit
373f346e5f
1 changed files with 2210 additions and 467 deletions
|
|
@ -120,6 +120,20 @@ type MethodOutcome =
|
|||
| { kind: "result"; result: McpResponse; appInfo?: CliAppInfo }
|
||||
| { kind: "emitted" };
|
||||
|
||||
/**
|
||||
* Tear down a managed list state if it was created for this method call.
|
||||
*
|
||||
* The `managed*State` locals below are assigned inside the `runMethod` closure,
|
||||
* so TypeScript's control-flow analysis keeps them narrowed to `null` at the
|
||||
* outer `finally` block (a closure "might not have run"). Routing the teardown
|
||||
* through this helper — whose parameter type is the shared `destroy()` shape —
|
||||
* both documents that and calls `destroy()` on whatever the closure actually
|
||||
* assigned at runtime, with no `as` cast.
|
||||
*/
|
||||
function destroyManagedState(state: { destroy(): void } | null): void {
|
||||
state?.destroy();
|
||||
}
|
||||
|
||||
async function callMethod(
|
||||
serverConfig: MCPServerConfig,
|
||||
serverSettings: InspectorServerSettings | undefined,
|
||||
|
|
@ -370,10 +384,10 @@ async function callMethod(
|
|||
await emitResult(outcome.result, outcome.appInfo, args);
|
||||
}
|
||||
} finally {
|
||||
managedToolsState?.destroy();
|
||||
managedResourcesState?.destroy();
|
||||
managedResourceTemplatesState?.destroy();
|
||||
managedPromptsState?.destroy();
|
||||
destroyManagedState(managedToolsState);
|
||||
destroyManagedState(managedResourcesState);
|
||||
destroyManagedState(managedResourceTemplatesState);
|
||||
destroyManagedState(managedPromptsState);
|
||||
await inspectorClient.disconnect();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue