@crowandraven/evalkeeper 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/ai-sdk/decide.d.ts +35 -0
- package/dist/ai-sdk/decide.js +36 -0
- package/dist/ai-sdk/decide.js.map +1 -0
- package/dist/ai-sdk/hash.d.ts +50 -0
- package/dist/ai-sdk/hash.js +59 -0
- package/dist/ai-sdk/hash.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +15 -0
- package/dist/ai-sdk/index.js +16 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/ai-sdk/judge.d.ts +69 -0
- package/dist/ai-sdk/judge.js +105 -0
- package/dist/ai-sdk/judge.js.map +1 -0
- package/dist/ai-sdk/usage.d.ts +18 -0
- package/dist/ai-sdk/usage.js +19 -0
- package/dist/ai-sdk/usage.js.map +1 -0
- package/dist/board.d.ts +5 -0
- package/dist/cli/addPages.d.ts +6 -1
- package/dist/cli/addPages.js +14 -8
- package/dist/cli/addPages.js.map +1 -1
- package/dist/cli/main.d.ts +19 -5
- package/dist/cli/main.js +100 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migration.d.ts +95 -0
- package/dist/cli/migration.js +247 -0
- package/dist/cli/migration.js.map +1 -0
- package/dist/feedback.d.ts +1 -1
- package/dist/glossary.d.ts +9 -0
- package/dist/glossary.js +9 -0
- package/dist/glossary.js.map +1 -1
- package/dist/health.d.ts +4 -1
- package/dist/health.js +4 -2
- package/dist/health.js.map +1 -1
- package/dist/inInstructions.d.ts +1 -1
- package/dist/inInstructions.js +1 -1
- package/dist/next/RefreshWhile.d.ts +11 -0
- package/dist/next/RefreshWhile.js +28 -0
- package/dist/next/RefreshWhile.js.map +1 -0
- package/dist/next/actions.d.ts +14 -0
- package/dist/next/actions.js +332 -0
- package/dist/next/actions.js.map +1 -0
- package/dist/next/components.d.ts +9 -0
- package/dist/next/components.js +27 -0
- package/dist/next/components.js.map +1 -0
- package/dist/next/cron.d.ts +9 -0
- package/dist/next/cron.js +17 -0
- package/dist/next/cron.js.map +1 -0
- package/dist/next/index.d.ts +15 -0
- package/dist/next/index.js +16 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/pages.d.ts +70 -0
- package/dist/next/pages.js +77 -0
- package/dist/next/pages.js.map +1 -0
- package/dist/next/route.d.ts +19 -0
- package/dist/next/route.js +31 -0
- package/dist/next/route.js.map +1 -0
- package/dist/next/weekly.d.ts +20 -0
- package/dist/next/weekly.js +55 -0
- package/dist/next/weekly.js.map +1 -0
- package/dist/next/wiring.d.ts +19 -0
- package/dist/next/wiring.js +2 -0
- package/dist/next/wiring.js.map +1 -0
- package/dist/prisma/contracts.d.ts +74 -0
- package/dist/prisma/contracts.js +178 -0
- package/dist/prisma/contracts.js.map +1 -0
- package/dist/prisma/index.d.ts +423 -0
- package/dist/prisma/index.js +622 -0
- package/dist/prisma/index.js.map +1 -0
- package/dist/prisma/mapping.d.ts +63 -0
- package/dist/prisma/mapping.js +111 -0
- package/dist/prisma/mapping.js.map +1 -0
- package/dist/prisma/moveIn.d.ts +106 -0
- package/dist/prisma/moveIn.js +299 -0
- package/dist/prisma/moveIn.js.map +1 -0
- package/dist/prune.d.ts +45 -0
- package/dist/prune.js +32 -0
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.d.ts +10 -0
- package/dist/react/AddCase.js +19 -0
- package/dist/react/AddCase.js.map +1 -0
- package/dist/react/AnswerKey.d.ts +22 -0
- package/dist/react/AnswerKey.js +83 -0
- package/dist/react/AnswerKey.js.map +1 -0
- package/dist/react/CaseMenu.d.ts +17 -0
- package/dist/react/CaseMenu.js +41 -0
- package/dist/react/CaseMenu.js.map +1 -0
- package/dist/react/CompareView.d.ts +14 -0
- package/dist/react/CompareView.js +51 -0
- package/dist/react/CompareView.js.map +1 -0
- package/dist/react/ConfirmAnswer.d.ts +13 -0
- package/dist/react/ConfirmAnswer.js +27 -0
- package/dist/react/ConfirmAnswer.js.map +1 -0
- package/dist/react/DisagreementChip.d.ts +10 -0
- package/dist/react/DisagreementChip.js +21 -0
- package/dist/react/DisagreementChip.js.map +1 -0
- package/dist/react/FeedbackView.d.ts +10 -0
- package/dist/react/FeedbackView.js +26 -0
- package/dist/react/FeedbackView.js.map +1 -0
- package/dist/react/Fields.d.ts +32 -0
- package/dist/react/Fields.js +33 -0
- package/dist/react/Fields.js.map +1 -0
- package/dist/react/HubSections.d.ts +78 -0
- package/dist/react/HubSections.js +124 -0
- package/dist/react/HubSections.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +16 -0
- package/dist/react/ModelMenu.js +38 -0
- package/dist/react/ModelMenu.js.map +1 -0
- package/dist/react/RateView.d.ts +18 -0
- package/dist/react/RateView.js +30 -0
- package/dist/react/RateView.js.map +1 -0
- package/dist/react/ReadableOutput.d.ts +3 -0
- package/dist/react/ReadableOutput.js +50 -0
- package/dist/react/ReadableOutput.js.map +1 -0
- package/dist/react/RollBack.d.ts +17 -0
- package/dist/react/RollBack.js +26 -0
- package/dist/react/RollBack.js.map +1 -0
- package/dist/react/RunView.d.ts +9 -0
- package/dist/react/RunView.js +41 -0
- package/dist/react/RunView.js.map +1 -0
- package/dist/react/SettingsHistory.d.ts +33 -0
- package/dist/react/SettingsHistory.js +79 -0
- package/dist/react/SettingsHistory.js.map +1 -0
- package/dist/react/SideBySideView.d.ts +14 -0
- package/dist/react/SideBySideView.js +67 -0
- package/dist/react/SideBySideView.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +111 -0
- package/dist/react/SuiteSections.js +224 -0
- package/dist/react/SuiteSections.js.map +1 -0
- package/dist/react/Tabs.d.ts +15 -0
- package/dist/react/Tabs.js +18 -0
- package/dist/react/Tabs.js.map +1 -0
- package/dist/react/Thumbs.d.ts +13 -0
- package/dist/react/Thumbs.js +54 -0
- package/dist/react/Thumbs.js.map +1 -0
- package/dist/react/WeeklyCheck.d.ts +11 -0
- package/dist/react/WeeklyCheck.js +19 -0
- package/dist/react/WeeklyCheck.js.map +1 -0
- package/dist/react/app.d.ts +118 -0
- package/dist/react/app.js +87 -0
- package/dist/react/app.js.map +1 -0
- package/dist/react/format.d.ts +27 -0
- package/dist/react/format.js +38 -0
- package/dist/react/format.js.map +1 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.js +32 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/pieces.d.ts +191 -0
- package/dist/react/pieces.js +191 -0
- package/dist/react/pieces.js.map +1 -0
- package/dist/readCheck.d.ts +1 -1
- package/dist/runner.d.ts +76 -3
- package/dist/runner.js +133 -3
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/suggest.d.ts +52 -2
- package/dist/suggest.js +101 -8
- package/dist/suggest.js.map +1 -1
- package/dist/suiteContract.d.ts +3 -3
- package/dist/suiteContract.js +20 -16
- package/dist/suiteContract.js.map +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/types.d.ts +79 -2
- package/dist/types.js +96 -12
- package/dist/types.js.map +1 -1
- package/package.json +56 -6
- package/schema/evalkeeper.prisma +196 -0
- package/src/ai-sdk/decide.ts +57 -0
- package/src/ai-sdk/hash.ts +74 -0
- package/src/ai-sdk/index.ts +15 -0
- package/src/ai-sdk/judge.ts +163 -0
- package/src/ai-sdk/usage.ts +31 -0
- package/src/board.ts +5 -0
- package/src/cli/addPages.ts +15 -7
- package/src/cli/main.ts +135 -9
- package/src/cli/migration.ts +349 -0
- package/src/feedback.ts +1 -1
- package/src/glossary.ts +18 -0
- package/src/health.ts +4 -2
- package/src/inInstructions.ts +1 -1
- package/{templates/components/evalkeeper → src/next}/RefreshWhile.tsx +2 -2
- package/src/next/actions.ts +389 -0
- package/src/next/components.ts +31 -0
- package/{templates/lib/evalkeeper/cronAuth.ts → src/next/cron.ts} +3 -0
- package/src/next/index.ts +15 -0
- package/src/next/pages.tsx +106 -0
- package/src/next/route.ts +35 -0
- package/src/next/weekly.ts +70 -0
- package/src/next/wiring.ts +18 -0
- package/src/prisma/contracts.ts +249 -0
- package/src/prisma/index.ts +1169 -0
- package/src/prisma/mapping.ts +147 -0
- package/src/prisma/moveIn.ts +502 -0
- package/src/prune.ts +77 -0
- package/{templates/components/evalkeeper → src/react}/AddCase.tsx +6 -6
- package/{templates/components/evalkeeper → src/react}/AnswerKey.tsx +96 -59
- package/{templates/components/evalkeeper → src/react}/CaseMenu.tsx +9 -8
- package/src/react/CompareView.tsx +270 -0
- package/{templates/components/evalkeeper → src/react}/ConfirmAnswer.tsx +6 -3
- package/{templates/components/evalkeeper → src/react}/DisagreementChip.tsx +2 -3
- package/src/react/FeedbackView.tsx +230 -0
- package/{templates/components/evalkeeper → src/react}/Fields.tsx +54 -10
- package/src/react/HubSections.tsx +446 -0
- package/src/react/ModelMenu.tsx +89 -0
- package/src/react/RateView.tsx +143 -0
- package/{templates/components/evalkeeper → src/react}/ReadableOutput.tsx +1 -1
- package/{templates/components/evalkeeper → src/react}/RollBack.tsx +9 -10
- package/src/react/RunView.tsx +151 -0
- package/{templates/components/evalkeeper → src/react}/SettingsHistory.tsx +16 -9
- package/src/react/SideBySideView.tsx +307 -0
- package/src/react/SuiteSections.tsx +925 -0
- package/src/react/Tabs.tsx +61 -0
- package/{templates/components/evalkeeper → src/react}/Thumbs.tsx +7 -6
- package/{templates/components/evalkeeper → src/react}/WeeklyCheck.tsx +31 -20
- package/src/react/app.ts +173 -0
- package/src/react/format.ts +45 -0
- package/src/react/index.ts +31 -0
- package/src/react/pieces.tsx +412 -0
- package/src/readCheck.ts +1 -1
- package/src/runner.ts +182 -4
- package/src/settings.ts +1 -1
- package/src/store.ts +1 -1
- package/src/suggest.ts +145 -13
- package/src/suiteContract.ts +35 -28
- package/src/testing.ts +2 -2
- package/src/types.ts +147 -19
- package/starter/index.ts +33 -8
- package/templates/app/api/cron/evals-weekly/route.ts +5 -15
- package/templates/app/evals/[suite]/compare/page.tsx +6 -383
- package/templates/app/evals/[suite]/page.tsx +7 -532
- package/templates/app/evals/[suite]/rate/page.tsx +6 -141
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +6 -174
- package/templates/app/evals/[suite]/side-by-side/page.tsx +6 -318
- package/templates/app/evals/feedback/page.tsx +6 -227
- package/templates/app/evals/layout.tsx +10 -0
- package/templates/app/evals/page.tsx +7 -365
- package/templates/lib/evalkeeper/actions.ts +34 -296
- package/templates/lib/evalkeeper/appComponents.tsx +21 -0
- package/templates/lib/evalkeeper/evals.ts +14 -0
- package/templates/lib/evalkeeper/paths.ts +2 -7
- package/templates/components/evalkeeper/Submit.tsx +0 -67
- package/templates/components/evalkeeper/Tip.tsx +0 -98
- package/templates/components/evalkeeper/ui.tsx +0 -105
- package/templates/lib/evalkeeper/time.ts +0 -4
- package/templates/lib/evalkeeper/weekly.ts +0 -74
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { weeklyCronRoute } from "@crowandraven/evalkeeper/next";
|
|
2
|
+
import { wiring } from "@/lib/evalkeeper";
|
|
3
|
+
|
|
4
|
+
// Written by `npx @crowandraven/evalkeeper add pages`: don't edit it.
|
|
4
5
|
|
|
5
6
|
/** The checks run after the response, within this function's time limit. */
|
|
6
7
|
export const maxDuration = 300;
|
|
@@ -10,15 +11,4 @@ export const maxDuration = 300;
|
|
|
10
11
|
* runs each suite's quick set on its live model. Results show on the
|
|
11
12
|
* evals hub. Call it with "Authorization: Bearer $CRON_SECRET".
|
|
12
13
|
*/
|
|
13
|
-
export
|
|
14
|
-
if (
|
|
15
|
-
!isAuthorizedCron(
|
|
16
|
-
request.headers.get("authorization"),
|
|
17
|
-
process.env.CRON_SECRET,
|
|
18
|
-
)
|
|
19
|
-
)
|
|
20
|
-
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
21
|
-
const ids = await startWeeklyCheck();
|
|
22
|
-
after(() => runWeeklyCheck(ids));
|
|
23
|
-
return NextResponse.json({ started: ids.length }, { status: 202 });
|
|
24
|
-
}
|
|
14
|
+
export const GET = weeklyCronRoute(wiring);
|
|
@@ -1,385 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { notFound } from "next/navigation";
|
|
4
|
-
import {
|
|
5
|
-
checkBar,
|
|
6
|
-
perAnswer,
|
|
7
|
-
seconds,
|
|
8
|
-
verdictSentence,
|
|
9
|
-
type Rate,
|
|
10
|
-
type RunRecord,
|
|
11
|
-
} from "@crowandraven/evalkeeper";
|
|
12
|
-
import { DisagreementChip } from "@/components/evalkeeper/DisagreementChip";
|
|
13
|
-
import { Submit } from "@/components/evalkeeper/Submit";
|
|
14
|
-
import { InfoTip, Tip } from "@/components/evalkeeper/Tip";
|
|
15
|
-
import { BackLink, Card, Chip, pct } from "@/components/evalkeeper/ui";
|
|
16
|
-
import {
|
|
17
|
-
MODELS,
|
|
18
|
-
SUITE_BY_KEY,
|
|
19
|
-
requireAdmin,
|
|
20
|
-
routeFor,
|
|
21
|
-
runner,
|
|
22
|
-
store,
|
|
23
|
-
} from "@/lib/evalkeeper";
|
|
24
|
-
import { evalsPath } from "@/lib/evalkeeper/paths";
|
|
1
|
+
import { pages } from "@/lib/evalkeeper/evals";
|
|
25
2
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export async function generateMetadata({
|
|
29
|
-
params,
|
|
30
|
-
}: {
|
|
31
|
-
params: Promise<{ suite: string }>;
|
|
32
|
-
}): Promise<Metadata> {
|
|
33
|
-
const { suite } = await params;
|
|
34
|
-
return { title: `Compare: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** A search parameter as one string, or null when it's missing or repeated. */
|
|
38
|
-
const one = (v: string | string[] | undefined) =>
|
|
39
|
-
typeof v === "string" && v ? v : null;
|
|
40
|
-
|
|
41
|
-
/** A test's name: its model, reasoning setting, set, and when it ran. */
|
|
42
|
-
function testName(r: RunRecord): string {
|
|
43
|
-
const model = MODELS[r.model]?.label ?? r.model;
|
|
44
|
-
const effort = r.reasoningEffort ? `, ${r.reasoningEffort} reasoning` : "";
|
|
45
|
-
const set = r.set === "ALL" ? "" : `, ${r.set.toLowerCase()} set`;
|
|
46
|
-
return `${model}${effort}${set} · ${r.startedAt.toLocaleString()}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** A pass rate as "80% (8/10)", or a dash when the check never applied. */
|
|
50
|
-
function rateText(r: Rate | undefined): string {
|
|
51
|
-
return r && r.n > 0 ? `${pct(r.passed / r.n)} (${r.passed}/${r.n})` : "—";
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Two finished tests of a suite compared: the verdict in plain words, each
|
|
56
|
-
* check's pass rate side by side, and the cases they graded differently,
|
|
57
|
-
* each linked to its answers side by side. `a` is the test in place (the
|
|
58
|
-
* live model's latest when left out), `b` the challenger.
|
|
59
|
-
*/
|
|
60
|
-
export default async function ComparePage({
|
|
61
|
-
params,
|
|
62
|
-
searchParams,
|
|
63
|
-
}: {
|
|
64
|
-
params: Promise<{ suite: string }>;
|
|
65
|
-
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
66
|
-
}) {
|
|
67
|
-
await requireAdmin();
|
|
68
|
-
const { suite: key } = await params;
|
|
69
|
-
const sp = await searchParams;
|
|
70
|
-
const suiteDef = SUITE_BY_KEY[key];
|
|
71
|
-
if (!suiteDef) notFound();
|
|
72
|
-
const runs = await store.listRuns(key, { status: "SUCCEEDED" });
|
|
73
|
-
const b = one(sp.b);
|
|
74
|
-
// Without a test in place, the live model's latest finished test.
|
|
75
|
-
let a = one(sp.a);
|
|
76
|
-
if (!a) {
|
|
77
|
-
// A feature with no settings yet has no live model to start from.
|
|
78
|
-
const live = await routeFor(suiteDef.operation).then(
|
|
79
|
-
(r) => r.model,
|
|
80
|
-
() => null,
|
|
81
|
-
);
|
|
82
|
-
a = runs.find((r) => r.model === live && r.id !== b)?.id ?? null;
|
|
83
|
-
}
|
|
84
|
-
const result = a && b ? await runner.compare(key, a, b) : null;
|
|
85
|
-
const titles = new Map(
|
|
86
|
-
(await store.listCases(key, { includeRetired: true })).map((c) => [
|
|
87
|
-
c.id,
|
|
88
|
-
suiteDef.title(suiteDef.input.parse(c.input)),
|
|
89
|
-
]),
|
|
90
|
-
);
|
|
91
|
-
const sideBySide = (caseId: string) =>
|
|
92
|
-
result
|
|
93
|
-
? `${evalsPath(key, "side-by-side")}?${new URLSearchParams({ a: result.a.id, b: result.b.id, case: caseId })}`
|
|
94
|
-
: "";
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<div className="space-y-8">
|
|
98
|
-
<div className="space-y-2">
|
|
99
|
-
<BackLink href={evalsPath(key)}>{suiteDef.label}</BackLink>
|
|
100
|
-
<h1 className="text-2xl font-semibold">
|
|
101
|
-
Compare two tests
|
|
102
|
-
<InfoTip term="comparison" />
|
|
103
|
-
</h1>
|
|
104
|
-
<p className="readable text-muted">
|
|
105
|
-
Pick the test in place and a challenger. Only finished tests of{" "}
|
|
106
|
-
{suiteDef.label} can be compared.
|
|
107
|
-
</p>
|
|
108
|
-
</div>
|
|
3
|
+
// Written by `npx @crowandraven/evalkeeper add pages`: don't edit it.
|
|
4
|
+
// Two tests compared: the verdict, each check, and where they differ.
|
|
109
5
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
key={`${a ?? ""}-${b ?? ""}`}
|
|
114
|
-
action={evalsPath(key, "compare")}
|
|
115
|
-
className="grid items-end gap-4 md:grid-cols-[1fr_1fr_auto]"
|
|
116
|
-
>
|
|
117
|
-
<TestPicker
|
|
118
|
-
name="a"
|
|
119
|
-
label="In place"
|
|
120
|
-
term="inPlace"
|
|
121
|
-
runs={runs}
|
|
122
|
-
value={a}
|
|
123
|
-
/>
|
|
124
|
-
<TestPicker
|
|
125
|
-
name="b"
|
|
126
|
-
label="Challenger"
|
|
127
|
-
term="challenger"
|
|
128
|
-
runs={runs}
|
|
129
|
-
value={b}
|
|
130
|
-
/>
|
|
131
|
-
<div className="pb-1">
|
|
132
|
-
<Submit>Compare</Submit>
|
|
133
|
-
</div>
|
|
134
|
-
</form>
|
|
135
|
-
</Card>
|
|
136
|
-
|
|
137
|
-
{a && b && !result && (
|
|
138
|
-
<p className="readable text-warn">
|
|
139
|
-
These can't be compared: pick two different finished tests of
|
|
140
|
-
this suite.
|
|
141
|
-
</p>
|
|
142
|
-
)}
|
|
143
|
-
{runs.length < 2 && (
|
|
144
|
-
<p className="readable text-muted">
|
|
145
|
-
This suite needs two finished tests to compare. Test another model on
|
|
146
|
-
the suite page first.
|
|
147
|
-
</p>
|
|
148
|
-
)}
|
|
149
|
-
|
|
150
|
-
{result && (
|
|
151
|
-
<>
|
|
152
|
-
<Card className="space-y-3">
|
|
153
|
-
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
154
|
-
<h2 className="font-semibold">
|
|
155
|
-
Verdict
|
|
156
|
-
<InfoTip term="verdict" />
|
|
157
|
-
</h2>
|
|
158
|
-
<Link
|
|
159
|
-
href={`${evalsPath(key, "compare")}?${new URLSearchParams({ a: result.b.id, b: result.a.id })}`}
|
|
160
|
-
className="text-sm text-muted hover:text-ink"
|
|
161
|
-
>
|
|
162
|
-
Swap them
|
|
163
|
-
</Link>
|
|
164
|
-
</div>
|
|
165
|
-
<p className="readable text-lg">
|
|
166
|
-
{verdictSentence(
|
|
167
|
-
result.comparison,
|
|
168
|
-
MODELS[result.b.model]?.label ?? result.b.model,
|
|
169
|
-
)}
|
|
170
|
-
</p>
|
|
171
|
-
<p className="readable text-sm text-muted">
|
|
172
|
-
<Link href={evalsPath(key, "runs", result.a.id)}>
|
|
173
|
-
{testName(result.a)}
|
|
174
|
-
</Link>{" "}
|
|
175
|
-
(in place) against{" "}
|
|
176
|
-
<Link href={evalsPath(key, "runs", result.b.id)}>
|
|
177
|
-
{testName(result.b)}
|
|
178
|
-
</Link>{" "}
|
|
179
|
-
(challenger), on{" "}
|
|
180
|
-
<Tip term="sharedCases">
|
|
181
|
-
<span>{result.comparison.n} shared cases</span>
|
|
182
|
-
</Tip>
|
|
183
|
-
.
|
|
184
|
-
</p>
|
|
185
|
-
<p className="text-sm text-muted">
|
|
186
|
-
<Tip term="cost" id="cost-compare">
|
|
187
|
-
<span>
|
|
188
|
-
Cost per answer: {perAnswer(result.comparison.cost.champion)}{" "}
|
|
189
|
-
in place, {perAnswer(result.comparison.cost.challenger)}{" "}
|
|
190
|
-
challenger
|
|
191
|
-
</span>
|
|
192
|
-
</Tip>
|
|
193
|
-
{" · "}
|
|
194
|
-
<Tip term="time" id="time-compare" align="end">
|
|
195
|
-
<span>
|
|
196
|
-
Time: {seconds(result.comparison.avgMs.champion)} in place,{" "}
|
|
197
|
-
{seconds(result.comparison.avgMs.challenger)} challenger
|
|
198
|
-
</span>
|
|
199
|
-
</Tip>
|
|
200
|
-
</p>
|
|
201
|
-
{result.caveats.length > 0 && (
|
|
202
|
-
<div className="readable rounded-md bg-tint p-3 text-sm">
|
|
203
|
-
<p className="font-medium">
|
|
204
|
-
Measured differently
|
|
205
|
-
<InfoTip term="measuredDifferently" />
|
|
206
|
-
</p>
|
|
207
|
-
<ul className="list-disc pl-5 text-muted">
|
|
208
|
-
{result.caveats.map((c) => (
|
|
209
|
-
<li key={c}>{c}</li>
|
|
210
|
-
))}
|
|
211
|
-
</ul>
|
|
212
|
-
</div>
|
|
213
|
-
)}
|
|
214
|
-
</Card>
|
|
215
|
-
|
|
216
|
-
<section className="space-y-3">
|
|
217
|
-
<h2 className="text-lg font-semibold">
|
|
218
|
-
Checks
|
|
219
|
-
<InfoTip term="checks" />
|
|
220
|
-
</h2>
|
|
221
|
-
<Card className="overflow-x-auto p-0">
|
|
222
|
-
<table className="w-full text-sm">
|
|
223
|
-
<thead className="text-left text-muted">
|
|
224
|
-
<tr className="border-b border-line">
|
|
225
|
-
<th className="p-3 font-normal">Check</th>
|
|
226
|
-
<th className="p-3 font-normal">
|
|
227
|
-
<Tip term="inPlace" side="bottom" id="inPlace-col">
|
|
228
|
-
In place
|
|
229
|
-
</Tip>
|
|
230
|
-
</th>
|
|
231
|
-
<th className="p-3 font-normal">
|
|
232
|
-
<Tip term="challenger" side="bottom" id="challenger-col">
|
|
233
|
-
Challenger
|
|
234
|
-
</Tip>
|
|
235
|
-
</th>
|
|
236
|
-
<th className="p-3 font-normal">
|
|
237
|
-
<Tip term="bar" side="bottom" align="end">
|
|
238
|
-
Bar
|
|
239
|
-
</Tip>
|
|
240
|
-
</th>
|
|
241
|
-
</tr>
|
|
242
|
-
</thead>
|
|
243
|
-
<tbody>
|
|
244
|
-
{result.suite.checks.map((c) => {
|
|
245
|
-
const r = result.comparison.byCheck[c.key];
|
|
246
|
-
return (
|
|
247
|
-
<tr
|
|
248
|
-
key={c.key}
|
|
249
|
-
className="border-b border-line last:border-0"
|
|
250
|
-
>
|
|
251
|
-
<td className="p-3">
|
|
252
|
-
<span className="flex flex-wrap items-center gap-2">
|
|
253
|
-
{c.label}
|
|
254
|
-
<Tip
|
|
255
|
-
term={c.severity}
|
|
256
|
-
id={`severity-${c.key}`}
|
|
257
|
-
side="bottom"
|
|
258
|
-
>
|
|
259
|
-
<Chip
|
|
260
|
-
tone={
|
|
261
|
-
c.severity === "serious"
|
|
262
|
-
? "serious"
|
|
263
|
-
: "neutral"
|
|
264
|
-
}
|
|
265
|
-
>
|
|
266
|
-
{c.severity}
|
|
267
|
-
</Chip>
|
|
268
|
-
</Tip>
|
|
269
|
-
</span>
|
|
270
|
-
</td>
|
|
271
|
-
<td className="p-3 tabular-nums">
|
|
272
|
-
<Tip term="passRate" id={`a-${c.key}`} side="bottom">
|
|
273
|
-
<span>{rateText(r?.champion)}</span>
|
|
274
|
-
</Tip>
|
|
275
|
-
</td>
|
|
276
|
-
<td className="p-3 tabular-nums">
|
|
277
|
-
<Tip term="passRate" id={`b-${c.key}`} side="bottom">
|
|
278
|
-
<span>{rateText(r?.challenger)}</span>
|
|
279
|
-
</Tip>
|
|
280
|
-
</td>
|
|
281
|
-
<td className="p-3 tabular-nums text-muted">
|
|
282
|
-
{pct(checkBar(c))}
|
|
283
|
-
</td>
|
|
284
|
-
</tr>
|
|
285
|
-
);
|
|
286
|
-
})}
|
|
287
|
-
</tbody>
|
|
288
|
-
</table>
|
|
289
|
-
</Card>
|
|
290
|
-
</section>
|
|
291
|
-
|
|
292
|
-
<section className="space-y-3">
|
|
293
|
-
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
294
|
-
<h2 className="text-lg font-semibold">
|
|
295
|
-
Where they differ ({result.disagreements.length})
|
|
296
|
-
<InfoTip term="disagreements" />
|
|
297
|
-
</h2>
|
|
298
|
-
{result.disagreements[0] && (
|
|
299
|
-
<Link
|
|
300
|
-
href={sideBySide(result.disagreements[0].caseId)}
|
|
301
|
-
className="text-sm text-accent"
|
|
302
|
-
>
|
|
303
|
-
Read them side by side
|
|
304
|
-
</Link>
|
|
305
|
-
)}
|
|
306
|
-
</div>
|
|
307
|
-
{result.disagreements.length === 0 ? (
|
|
308
|
-
<p className="readable text-muted">
|
|
309
|
-
The two tests graded every shared case alike.
|
|
310
|
-
</p>
|
|
311
|
-
) : (
|
|
312
|
-
<Card className="space-y-2">
|
|
313
|
-
{result.disagreements.map((d) => (
|
|
314
|
-
<div
|
|
315
|
-
key={d.caseId}
|
|
316
|
-
className="flex flex-wrap items-center justify-between gap-3 rounded-md bg-tint p-3 text-sm"
|
|
317
|
-
>
|
|
318
|
-
<Link
|
|
319
|
-
href={sideBySide(d.caseId)}
|
|
320
|
-
className="font-medium hover:underline"
|
|
321
|
-
>
|
|
322
|
-
{titles.get(d.caseId) ?? "A retired case"}
|
|
323
|
-
</Link>
|
|
324
|
-
<span className="flex items-center gap-3">
|
|
325
|
-
<Tip term="caseScore" id={`score-${d.caseId}`}>
|
|
326
|
-
<span className="text-xs text-muted tabular-nums">
|
|
327
|
-
{pct(d.champion)} → {pct(d.challenger)}
|
|
328
|
-
</span>
|
|
329
|
-
</Tip>
|
|
330
|
-
<DisagreementChip
|
|
331
|
-
kind={d.kind}
|
|
332
|
-
id={`kind-${d.caseId}`}
|
|
333
|
-
align="end"
|
|
334
|
-
/>
|
|
335
|
-
</span>
|
|
336
|
-
</div>
|
|
337
|
-
))}
|
|
338
|
-
</Card>
|
|
339
|
-
)}
|
|
340
|
-
</section>
|
|
341
|
-
</>
|
|
342
|
-
)}
|
|
343
|
-
</div>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/** One of the two tests to compare, chosen from the suite's finished tests. */
|
|
348
|
-
function TestPicker({
|
|
349
|
-
name,
|
|
350
|
-
label,
|
|
351
|
-
term,
|
|
352
|
-
runs,
|
|
353
|
-
value,
|
|
354
|
-
}: {
|
|
355
|
-
name: string;
|
|
356
|
-
label: string;
|
|
357
|
-
term: "inPlace" | "challenger";
|
|
358
|
-
runs: RunRecord[];
|
|
359
|
-
value: string | null;
|
|
360
|
-
}) {
|
|
361
|
-
return (
|
|
362
|
-
<div className="space-y-1">
|
|
363
|
-
<label htmlFor={`pick-${name}`} className="block text-sm font-medium">
|
|
364
|
-
{label}
|
|
365
|
-
<InfoTip term={term} id={`${term}-pick`} />
|
|
366
|
-
</label>
|
|
367
|
-
<select
|
|
368
|
-
id={`pick-${name}`}
|
|
369
|
-
name={name}
|
|
370
|
-
defaultValue={value ?? ""}
|
|
371
|
-
required
|
|
372
|
-
className="w-full rounded-md border border-line bg-card px-3 py-2 text-sm focus:border-accent focus:outline-none"
|
|
373
|
-
>
|
|
374
|
-
<option value="" disabled>
|
|
375
|
-
Pick a test
|
|
376
|
-
</option>
|
|
377
|
-
{runs.map((r) => (
|
|
378
|
-
<option key={r.id} value={r.id}>
|
|
379
|
-
{testName(r)}
|
|
380
|
-
</option>
|
|
381
|
-
))}
|
|
382
|
-
</select>
|
|
383
|
-
</div>
|
|
384
|
-
);
|
|
385
|
-
}
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
export const generateMetadata = pages.compare.generateMetadata;
|
|
8
|
+
export default pages.compare.Page;
|