Skip to content

Commit baebddf

Browse files
prettier
1 parent 155124b commit baebddf

15 files changed

+448
-425
lines changed

mcpjam-inspector/client/src/components/CiEvalsTab.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import { aggregateSuite, groupRunsByCommit } from "./evals/helpers";
1515
import { useEvalMutations } from "./evals/use-eval-mutations";
1616
import { useEvalQueries } from "./evals/use-eval-queries";
1717
import { useEvalHandlers } from "./evals/use-eval-handlers";
18-
import { CiSuiteListSidebar, type SidebarMode } from "./evals/ci-suite-list-sidebar";
18+
import {
19+
CiSuiteListSidebar,
20+
type SidebarMode,
21+
} from "./evals/ci-suite-list-sidebar";
1922
import { CiSuiteDetail } from "./evals/ci-suite-detail";
2023
import { CommitDetailView } from "./evals/commit-detail-view";
2124
import { useWorkspaceMembers } from "@/hooks/useWorkspaces";
@@ -87,10 +90,7 @@ export function CiEvalsTab({ convexWorkspaceId }: CiEvalsTabProps) {
8790
[queries.sortedSuites],
8891
);
8992

90-
const commitGroups = useMemo(
91-
() => groupRunsByCommit(sdkSuites),
92-
[sdkSuites],
93-
);
93+
const commitGroups = useMemo(() => groupRunsByCommit(sdkSuites), [sdkSuites]);
9494

9595
// Auto-switch to "By Suite" when all runs are manual (no commit SHAs)
9696
useEffect(() => {
@@ -108,9 +108,7 @@ export function CiEvalsTab({ convexWorkspaceId }: CiEvalsTabProps) {
108108

109109
const selectedCommitGroup = useMemo(() => {
110110
if (!selectedCommitSha) return null;
111-
return (
112-
commitGroups.find((g) => g.commitSha === selectedCommitSha) ?? null
113-
);
111+
return commitGroups.find((g) => g.commitSha === selectedCommitSha) ?? null;
114112
}, [commitGroups, selectedCommitSha]);
115113
const selectedSuiteEntry = useMemo(() => {
116114
if (!selectedSuiteId) return null;
@@ -323,7 +321,8 @@ export function CiEvalsTab({ convexWorkspaceId }: CiEvalsTabProps) {
323321
Select a suite
324322
</h2>
325323
<p className="text-sm text-muted-foreground">
326-
Choose a CI suite or commit from the sidebar to inspect runs and test iterations.
324+
Choose a CI suite or commit from the sidebar to inspect runs
325+
and test iterations.
327326
</p>
328327
</div>
329328
</div>

mcpjam-inspector/client/src/components/evals/__tests__/ai-insights.test.ts

Lines changed: 8 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ describe("isFlaky", () => {
123123
});
124124

125125
it("returns true for frequent alternation", () => {
126-
expect(
127-
isFlaky(["passed", "failed", "passed", "failed", "passed"]),
128-
).toBe(true);
126+
expect(isFlaky(["passed", "failed", "passed", "failed", "passed"])).toBe(
127+
true,
128+
);
129129
});
130130

131131
it("ignores 'other' results when counting switches", () => {
132132
// After filtering: passed, failed, passed = 2 switches
133-
expect(
134-
isFlaky(["passed", "other", "failed", "other", "passed"]),
135-
).toBe(true);
133+
expect(isFlaky(["passed", "other", "failed", "other", "passed"])).toBe(
134+
true,
135+
);
136136
});
137137

138138
it("only looks at first 10 entries", () => {
@@ -163,9 +163,7 @@ describe("classifyFailure", () => {
163163
it("tags as 'new' when there is no prior history", () => {
164164
const suiteId = "suite-new";
165165
const run = makeRun({ suiteId, result: "failed" });
166-
const groups: CommitGroup[] = [
167-
makeCommitGroup({ runs: [run] }),
168-
];
166+
const groups: CommitGroup[] = [makeCommitGroup({ runs: [run] })];
169167

170168
const result = classifyFailure(run, "New Suite", groups);
171169
expect(result.tags).toContain("new");
@@ -218,11 +216,7 @@ describe("classifyFailure", () => {
218216
}),
219217
];
220218

221-
const result = classifyFailure(
222-
failedRun,
223-
"Flaky Regression",
224-
groups,
225-
);
219+
const result = classifyFailure(failedRun, "Flaky Regression", groups);
226220
expect(result.tags).toContain("regression");
227221
expect(result.tags).toContain("flaky");
228222
});
@@ -287,156 +281,3 @@ describe("classifyAllFailures", () => {
287281
expect(results[0].suiteName).toBe("Unknown suite");
288282
});
289283
});
290-
291-
// ---------------------------------------------------------------------------
292-
// buildTriageContext
293-
// ---------------------------------------------------------------------------
294-
295-
describe("buildTriageContext", () => {
296-
it("builds context with correct aggregated data", () => {
297-
const failedRun = makeRun({
298-
suiteId: "s1",
299-
result: "failed",
300-
summary: { total: 10, passed: 7, failed: 3, passRate: 70 },
301-
configSnapshot: {
302-
tests: [
303-
{
304-
title: "test-a",
305-
query: "q",
306-
provider: "p",
307-
model: "m",
308-
runs: 1,
309-
expectedToolCalls: [],
310-
},
311-
{
312-
title: "test-b",
313-
query: "q",
314-
provider: "p",
315-
model: "m",
316-
runs: 1,
317-
expectedToolCalls: [],
318-
},
319-
],
320-
environment: { servers: [] },
321-
},
322-
});
323-
const passedRun = makeRun({
324-
suiteId: "s2",
325-
result: "passed",
326-
summary: { total: 5, passed: 5, failed: 0, passRate: 100 },
327-
});
328-
const notRunRun = makeRun({
329-
suiteId: "s3",
330-
result: "cancelled",
331-
});
332-
333-
const suiteMap = new Map([
334-
["s1", "Failed Suite"],
335-
["s2", "Passed Suite"],
336-
["s3", "Not Run Suite"],
337-
]);
338-
339-
const commitGroup = makeCommitGroup({
340-
commitSha: "abc123",
341-
shortSha: "abc1234",
342-
branch: "main",
343-
runs: [failedRun, passedRun, notRunRun],
344-
suiteMap,
345-
});
346-
347-
const classified = [
348-
{
349-
run: failedRun,
350-
suiteName: "Failed Suite",
351-
tags: ["regression" as const],
352-
},
353-
];
354-
355-
const ctx = buildTriageContext(
356-
commitGroup,
357-
classified,
358-
[passedRun],
359-
[notRunRun],
360-
);
361-
362-
expect(ctx.commitSha).toBe("abc1234");
363-
expect(ctx.branch).toBe("main");
364-
expect(ctx.totalSuites).toBe(3);
365-
expect(ctx.totalCases.total).toBe(15);
366-
expect(ctx.totalCases.passed).toBe(12);
367-
expect(ctx.totalCases.failed).toBe(3);
368-
expect(ctx.failures).toHaveLength(1);
369-
expect(ctx.failures[0].suiteName).toBe("Failed Suite");
370-
expect(ctx.failures[0].tags).toEqual(["regression"]);
371-
expect(ctx.failures[0].testNames).toEqual(["test-a", "test-b"]);
372-
expect(ctx.passedSuites).toEqual(["Passed Suite"]);
373-
expect(ctx.notRunSuites).toEqual(["Not Run Suite"]);
374-
});
375-
});
376-
377-
// ---------------------------------------------------------------------------
378-
// buildOverviewTriageContext
379-
// ---------------------------------------------------------------------------
380-
381-
describe("buildOverviewTriageContext", () => {
382-
it("categorizes suites correctly", () => {
383-
const suites = [
384-
{
385-
suite: { _id: "s1", name: "Failing Suite" } as any,
386-
latestRun: makeRun({ suiteId: "s1", result: "failed" }),
387-
recentRuns: [],
388-
passRateTrend: [],
389-
totals: { passed: 3, failed: 2, runs: 5 },
390-
},
391-
{
392-
suite: { _id: "s2", name: "Passing Suite" } as any,
393-
latestRun: makeRun({ suiteId: "s2", result: "passed" }),
394-
recentRuns: [],
395-
passRateTrend: [],
396-
totals: { passed: 10, failed: 0, runs: 10 },
397-
},
398-
{
399-
suite: { _id: "s3", name: "New Suite" } as any,
400-
latestRun: null,
401-
recentRuns: [],
402-
passRateTrend: [],
403-
totals: { passed: 0, failed: 0, runs: 0 },
404-
},
405-
];
406-
407-
const ctx = buildOverviewTriageContext(suites, []);
408-
expect(ctx.totalSuites).toBe(3);
409-
expect(ctx.passingSuites).toBe(1);
410-
expect(ctx.neverRunSuites).toBe(1);
411-
expect(ctx.failingSuites).toHaveLength(1);
412-
expect(ctx.failingSuites[0].name).toBe("Failing Suite");
413-
expect(ctx.failingSuites[0].passRate).toBe("60%");
414-
});
415-
416-
it("includes suites that passed overall but have failed cases", () => {
417-
const suites = [
418-
{
419-
suite: { _id: "s1", name: "Mostly Passing Suite" } as any,
420-
latestRun: makeRun({ suiteId: "s1", result: "passed" }),
421-
recentRuns: [],
422-
passRateTrend: [],
423-
totals: { passed: 14, failed: 2, runs: 16 },
424-
},
425-
{
426-
suite: { _id: "s2", name: "Fully Passing Suite" } as any,
427-
latestRun: makeRun({ suiteId: "s2", result: "passed" }),
428-
recentRuns: [],
429-
passRateTrend: [],
430-
totals: { passed: 10, failed: 0, runs: 10 },
431-
},
432-
];
433-
434-
const ctx = buildOverviewTriageContext(suites, []);
435-
expect(ctx.totalSuites).toBe(2);
436-
expect(ctx.passingSuites).toBe(1);
437-
expect(ctx.failingSuites).toHaveLength(1);
438-
expect(ctx.failingSuites[0].name).toBe("Mostly Passing Suite");
439-
expect(ctx.failingSuites[0].passRate).toBe("88%");
440-
expect(ctx.failingSuites[0].failedCases).toBe(2);
441-
});
442-
});

mcpjam-inspector/client/src/components/evals/ai-insights.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ export function classifyAllFailures(
109109
return classifyFailure(run, suiteName, allCommitGroups);
110110
});
111111
}
112-

0 commit comments

Comments
 (0)