Address PR #1236 review feedback

- Rename RequestMethod → MessageMethod. The type covers notifications and
  results, not just requests; the new name matches the JSDoc.
- Normalize imports to the @inspector/core/mcp/types.js path alias in
  HistoryListPanel, historyUtils, and HistoryScreen (HistoryControls was
  already using the alias).
- Document the cast invariant in extractMethod: SDK types message.method
  as string, but every MessageEntry in this app originates from SDK
  schemas, so the narrowing is safe.
- Type SAMPLE_METHODS as MessageMethod[] in HistoryControls stories so
  the literal-type narrowing isn't lost across the spread.

Skipped two reviewer suggestions: the Mantine Select inline cast (reviewer
self-resolved) and the stale-methodFilter-on-clear UX edge case (deferred
as a separate follow-up — not a Phase 5 audit gap).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-27 10:24:30 -04:00
commit 6b3cecd736

View file

@ -1,9 +1,6 @@
import { useMemo, useState } from "react";
import { Card, Flex, Stack } from "@mantine/core";
import type {
MessageEntry,
RequestMethod,
} from "../../../../../../core/mcp/types.js";
import type { MessageEntry, MessageMethod } from "@inspector/core/mcp/types.js";
import { HistoryControls } from "../../groups/HistoryControls/HistoryControls";
import { HistoryListPanel } from "../../groups/HistoryListPanel/HistoryListPanel.js";
import { extractMethod } from "../../groups/historyUtils.js";
@ -43,7 +40,7 @@ export function HistoryScreen({
onTogglePin,
}: HistoryScreenProps) {
const [searchText, setSearchText] = useState("");
const [methodFilter, setMethodFilter] = useState<RequestMethod | undefined>();
const [methodFilter, setMethodFilter] = useState<MessageMethod | undefined>();
const availableMethods = useMemo(
() => Array.from(new Set(entries.map(extractMethod))).sort(),