chore(lint): enable no-floating-promises in all five ESLint scopes

A floated promise is invisible at review time — the call reads like an
awaited one minus four characters — and the unhandled rejection it
produces surfaces in a different test, in a different file, as a stack
pointing at SDK internals. In #1947 two un-held `callTool` calls made
`npm run ci` unpassable and took a full investigation to attribute; the
fix was two lines. `@typescript-eslint/no-floating-promises` catches the
class outright, so enable it at `error` everywhere.

The rule is type-aware and `tseslint.configs.recommended` is not, so each
scope's config gains a parser project. The four clients name their own
tsconfig projects (both of them — `src` and `__tests__`/`server` live in
different ones). The root scope has no tsconfig at all, so add
`tsconfig.lint.json`: a lint-only project covering `core/**`,
`test-servers/src/**`, and `vitest.shared.mts`, emitting nothing and
gating nothing. It sets `moduleResolution: bundler` deliberately — under
NodeNext `core/`'s extensionless imports fail to resolve, every import
degrades to `any`, and the rule silently stops seeing promises at all.

Measured surface, and the fixes:

- core (2) — `stream.close()` in two Hono `onAbort` listeners. Hono
  invokes subscribers with a bare `subscriber()`, so a promise returned
  from the listener is floated one layer up; `closeAbortedStream` owns
  the rejection where it can actually be owned.
- tui (5) — `handleDisconnect` had no catch of its own and its only
  caller is a key handler that cannot await, so a failing disconnect was
  a live unhandled rejection; it now surfaces the message the way
  `handleConnect` does. The rest are `void` at callers that genuinely
  cannot await, over callees that already own their failures.
- web (92) — 83 are Storybook `expect(...)`, which is instrumented and
  returns a promise, now awaited (`scrollAreaStoryAssertions` is async
  for the same reason). Two tests were asserting against a provider call
  they never awaited. `open(url)` in both web servers now warns instead
  of escaping a synchronous callback.
- cli, launcher — already clean.

Type-aware linting costs time: `clients/web`'s `eslint .` goes from ~8s
to ~19s, inside `validate`. Narrowing the loaded projects is the lever if
that needs reducing later; dropping the rule is not.

Closes #1959

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-16 20:57:32 -04:00
commit 519ecf49ee
27 changed files with 359 additions and 111 deletions

View file

@ -14,7 +14,7 @@ export const Transport: Story = {
args: { category: "transport" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("transport")).toBeInTheDocument();
await expect(canvas.getByText("transport")).toBeInTheDocument();
},
};
@ -22,6 +22,6 @@ export const Auth: Story = {
args: { category: "auth" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("auth")).toBeInTheDocument();
await expect(canvas.getByText("auth")).toBeInTheDocument();
},
};

View file

@ -24,7 +24,7 @@ export const FullSize: Story = {
),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("Row 1")).toBeInTheDocument();
await expect(canvas.getByText("Row 1")).toBeInTheDocument();
},
};
@ -38,6 +38,6 @@ export const Embedded: Story = {
),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("Row 1")).toBeInTheDocument();
await expect(canvas.getByText("Row 1")).toBeInTheDocument();
},
};

View file

@ -15,7 +15,9 @@ export const Collapsed: Story = {
args: { expanded: false },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByRole("button", { name: "Expand" })).toBeInTheDocument();
await expect(
canvas.getByRole("button", { name: "Expand" }),
).toBeInTheDocument();
},
};
@ -23,7 +25,7 @@ export const Expanded: Story = {
args: { expanded: true },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByRole("button", { name: "Collapse" }),
).toBeInTheDocument();
},

View file

@ -14,7 +14,7 @@ export const HeaderMismatch: Story = {
args: { code: -32020, name: "HeaderMismatch" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("-32020 HeaderMismatch")).toBeInTheDocument();
await expect(canvas.getByText("-32020 HeaderMismatch")).toBeInTheDocument();
},
};
@ -22,7 +22,7 @@ export const MissingCapability: Story = {
args: { code: -32021, name: "MissingRequiredClientCapability" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByText("-32021 MissingRequiredClientCapability"),
).toBeInTheDocument();
},
@ -32,7 +32,7 @@ export const UnsupportedVersion: Story = {
args: { code: -32022, name: "UnsupportedProtocolVersion" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByText("-32022 UnsupportedProtocolVersion"),
).toBeInTheDocument();
},
@ -47,6 +47,6 @@ export const MethodNotFound: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("-32601 MethodNotFound")).toBeInTheDocument();
await expect(canvas.getByText("-32601 MethodNotFound")).toBeInTheDocument();
},
};

View file

@ -14,7 +14,7 @@ export const Outgoing: Story = {
args: { direction: "outgoing" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("client → server")).toBeInTheDocument();
await expect(canvas.getByText("client → server")).toBeInTheDocument();
},
};
@ -22,6 +22,6 @@ export const Incoming: Story = {
args: { direction: "incoming" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("server → client")).toBeInTheDocument();
await expect(canvas.getByText("server → client")).toBeInTheDocument();
},
};

View file

@ -14,7 +14,7 @@ export const ToolsList: Story = {
args: { method: "tools/list" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("tools/list")).toBeInTheDocument();
await expect(canvas.getByText("tools/list")).toBeInTheDocument();
},
};
@ -22,6 +22,6 @@ export const TasksList: Story = {
args: { method: "tasks/list" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("tasks/list")).toBeInTheDocument();
await expect(canvas.getByText("tasks/list")).toBeInTheDocument();
},
};

View file

@ -15,7 +15,7 @@ export const Closed: Story = {
args: { open: false },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByRole("button", { name: "Open monitoring sidebar" }),
).toBeInTheDocument();
},
@ -25,7 +25,7 @@ export const Open: Story = {
args: { open: true },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByRole("button", { name: "Close monitoring sidebar" }),
).toBeInTheDocument();
},

View file

@ -15,7 +15,9 @@ export const Unpinned: Story = {
args: { pinned: false },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByRole("button", { name: "Pin" })).toBeInTheDocument();
await expect(
canvas.getByRole("button", { name: "Pin" }),
).toBeInTheDocument();
},
};
@ -23,6 +25,8 @@ export const Pinned: Story = {
args: { pinned: true },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByRole("button", { name: "Unpin" })).toBeInTheDocument();
await expect(
canvas.getByRole("button", { name: "Unpin" }),
).toBeInTheDocument();
},
};

View file

@ -14,6 +14,8 @@ type Story = StoryObj<typeof ReplayButton>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByRole("button", { name: "Replay" })).toBeInTheDocument();
await expect(
canvas.getByRole("button", { name: "Replay" }),
).toBeInTheDocument();
},
};

View file

@ -44,7 +44,7 @@ export const Default: Story = {
render: () => <ResizeDemo />,
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByRole("separator", { name: "Resize demo panel" }),
).toBeInTheDocument();
},

View file

@ -48,7 +48,7 @@ export const FillsHostWidth: Story = {
// sharper discriminator: a row flex leaves the layer full-width while
// collapsing the child to the single "x").
const layer = child.parentElement as HTMLElement;
expect(child.getBoundingClientRect().width).toBeCloseTo(
await expect(child.getBoundingClientRect().width).toBeCloseTo(
layer.getBoundingClientRect().width,
0,
);
@ -77,11 +77,11 @@ export const FillVariant: Story = {
// Width still stretches onto the child (relative to the layer, as above);
// the `fill` height comes from `bottom: 0` making the layer span the host.
const layer = child.parentElement as HTMLElement;
expect(child.getBoundingClientRect().width).toBeCloseTo(
await expect(child.getBoundingClientRect().width).toBeCloseTo(
layer.getBoundingClientRect().width,
0,
);
expect(layer.getBoundingClientRect().height).toBeGreaterThan(160 - 4);
await expect(layer.getBoundingClientRect().height).toBeGreaterThan(160 - 4);
},
};
@ -97,6 +97,6 @@ export const Inactive: Story = {
),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.queryByTestId("stage-child")).not.toBeInTheDocument();
await expect(canvas.queryByTestId("stage-child")).not.toBeInTheDocument();
},
};

View file

@ -106,8 +106,10 @@ export const ServerInfoNotReported: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.queryByText("my-catalog-name")).not.toBeInTheDocument();
expect(canvas.getAllByText(SERVER_INFO_NOT_REPORTED_LABEL)).toHaveLength(2);
await expect(canvas.queryByText("my-catalog-name")).not.toBeInTheDocument();
await expect(
canvas.getAllByText(SERVER_INFO_NOT_REPORTED_LABEL),
).toHaveLength(2);
},
};
@ -187,11 +189,11 @@ export const WithOAuthIdToken: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("ID Token")).toBeInTheDocument();
await expect(canvas.getByText("ID Token")).toBeInTheDocument();
// Only the ID token is a JWT here, so exactly one decode toggle is offered.
await userEvent.click(
canvas.getByRole("button", { name: "Decode JWT for ID Token" }),
);
expect(canvas.getByText(/"sub": "user-42"/)).toBeInTheDocument();
await expect(canvas.getByText(/"sub": "user-42"/)).toBeInTheDocument();
},
};

View file

@ -77,6 +77,6 @@ export const WithEntries: Story = {
},
// List scrollbar reserves a gutter and stays hidden when idle (#1474).
play: async ({ canvasElement }) => {
expectScrollbarGutterIdleHidden(canvasElement);
await expectScrollbarGutterIdleHidden(canvasElement);
},
};

View file

@ -31,10 +31,10 @@ export const AllVisible: Story = {
args: { visibleDirections: { client: true, server: true } },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(
await expect(
canvas.getByRole("button", { name: "client → server" }),
).toBeInTheDocument();
expect(
await expect(
canvas.getByRole("button", { name: "Deselect All" }),
).toBeInTheDocument();
},

View file

@ -20,7 +20,7 @@ type Story = StoryObj<typeof MonitoringControls>;
export const AllTabs: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByRole("radio", { name: "Logs" })).toBeChecked();
await expect(canvas.getByRole("radio", { name: "Logs" })).toBeChecked();
},
};
@ -28,6 +28,6 @@ export const StdioServer: Story = {
args: { tabs: ["Logs", "Protocol"], value: "Protocol" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.queryByRole("radio", { name: "Network" })).toBeNull();
await expect(canvas.queryByRole("radio", { name: "Network" })).toBeNull();
},
};

View file

@ -47,7 +47,7 @@ type Story = StoryObj<typeof MonitoringScreen>;
export const Logs: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("Log stream")).toBeInTheDocument();
await expect(canvas.getByText("Log stream")).toBeInTheDocument();
},
};
@ -55,6 +55,6 @@ export const Protocol: Story = {
args: { value: "Protocol" },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(canvas.getByText("Request history")).toBeInTheDocument();
await expect(canvas.getByText("Request history")).toBeInTheDocument();
},
};

View file

@ -50,7 +50,7 @@ export const WithEntries: Story = {
args: { entries: sample },
// List scrollbar reserves a gutter and stays hidden when idle (#1474).
play: async ({ canvasElement }) => {
expectScrollbarGutterIdleHidden(canvasElement);
await expectScrollbarGutterIdleHidden(canvasElement);
},
};

View file

@ -45,14 +45,14 @@ export const Default: Story = {
// Mantine renders the modal in a portal at document.body.
const body = within(canvasElement.ownerDocument.body);
await body.findByText("Output schema validation");
expect(body.getByText(/open_pattern_editor/)).toBeInTheDocument();
await expect(body.getByText(/open_pattern_editor/)).toBeInTheDocument();
const details = body.getByLabelText(
"Validation details",
) as HTMLTextAreaElement;
expect(details.value).toContain(
await expect(details.value).toContain(
"data/samples/0 must NOT have additional properties",
);
expect(details.readOnly).toBe(true);
await expect(details.readOnly).toBe(true);
},
};

View file

@ -122,11 +122,11 @@ export const Sampling: Story = {
play: async ({ canvasElement, args }) => {
const body = within(canvasElement.ownerDocument.body);
await body.findByText("Sampling Request");
expect(
await expect(
body.getByText("The server is requesting an LLM completion."),
).toBeInTheDocument();
await userEvent.click(body.getByRole("button", { name: "Send Response" }));
expect(args.onSamplingRespond).toHaveBeenCalled();
await expect(args.onSamplingRespond).toHaveBeenCalled();
},
};
@ -144,8 +144,8 @@ export const SamplingInputRequired: Story = {
play: async ({ canvasElement }) => {
const body = within(canvasElement.ownerDocument.body);
await body.findByText("Sampling Request");
expect(body.getByText("input_required")).toBeInTheDocument();
expect(body.getByText(/sent back as a retry/i)).toBeInTheDocument();
await expect(body.getByText("input_required")).toBeInTheDocument();
await expect(body.getByText(/sent back as a retry/i)).toBeInTheDocument();
},
};
@ -172,11 +172,11 @@ export const ElicitationForm: Story = {
play: async ({ canvasElement, args }) => {
const body = within(canvasElement.ownerDocument.body);
await body.findByText("Elicitation Request");
expect(
await expect(
body.getByText(/Please provide your database connection details/),
).toBeInTheDocument();
await userEvent.click(body.getByRole("button", { name: "Submit" }));
expect(args.onElicitationRespond).toHaveBeenCalledWith({
await expect(args.onElicitationRespond).toHaveBeenCalledWith({
action: "accept",
content: {},
});
@ -207,7 +207,7 @@ export const ElicitationUrl: Story = {
play: async ({ canvasElement }) => {
const body = within(canvasElement.ownerDocument.body);
await body.findByText("Elicitation Request");
expect(
await expect(
body.getByText("https://example.com/authorize?token=abc123"),
).toBeInTheDocument();
},

View file

@ -107,7 +107,7 @@ export const WithEntries: Story = {
// bar never overlays the cards, and uses type="scroll" so it stays hidden
// when idle rather than appearing on hover (#1474).
play: async ({ canvasElement }) => {
expectScrollbarGutterIdleHidden(canvasElement);
await expectScrollbarGutterIdleHidden(canvasElement);
},
};

Some files were not shown because too many files have changed in this diff Show more