Summary
Follow-up from the review of #1350 (PR #1395).
The capability-gate connect-path tests for the five Managed*State managers assert that listX is not called on a connect against a capability-less server by yielding two microtasks and then checking:
taskless.dispatchTypedEvent("connect");
await Promise.resolve();
await Promise.resolve();
expect(taskless.listX).not.toHaveBeenCalled();
This works for the current shape of refresh() (one async hop before the listX call), but it asserts the gate only indirectly: if refresh ever grows a third async hop before the list RPC, the test could pass for the wrong reason (the flush races ahead of the call rather than the gate suppressing it).
Scope
Replace the fixed double-flush with a vi.waitFor(...) assertion in the "connect against an X-less server doesn't fire listX" test for all five managers, keeping them uniform:
taskless.dispatchTypedEvent("connect");
await vi.waitFor(() => {
expect(taskless.listX).not.toHaveBeenCalled();
});
(Or an equivalent that gives the connect-chained refresh a real chance to run before asserting.)
Out of scope
Context
Summary
Follow-up from the review of #1350 (PR #1395).
The capability-gate connect-path tests for the five
Managed*Statemanagers assert thatlistXis not called on a connect against a capability-less server by yielding two microtasks and then checking:This works for the current shape of
refresh()(one async hop before thelistXcall), but it asserts the gate only indirectly: ifrefreshever grows a third async hop before the list RPC, the test could pass for the wrong reason (the flush races ahead of the call rather than the gate suppressing it).Scope
Replace the fixed double-flush with a
vi.waitFor(...)assertion in the "connect against an X-less server doesn't fire listX" test for all five managers, keeping them uniform:managedToolsState.test.tsmanagedPromptsState.test.tsmanagedResourcesState.test.tsmanagedResourceTemplatesState.test.tsmanagedRequestorTasksState.test.ts(the feat(servers): persist server list to ~/.mcp-inspector/mcp.json (#1343) #1349 original this pattern was copied from)(Or an equivalent that gives the connect-chained refresh a real chance to run before asserting.)
Out of scope
*Change([])dispatch, nocapabilitiesChangelistener) are intentional parity with the feat(servers): persist server list to ~/.mcp-inspector/mcp.json (#1343) #1349 precedent and are not part of this issue.Context