@crowandraven/evalkeeper 0.5.0 → 0.8.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.
Files changed (125) hide show
  1. package/README.md +16 -0
  2. package/dist/activity.d.ts +58 -0
  3. package/dist/activity.js +125 -0
  4. package/dist/activity.js.map +1 -0
  5. package/dist/assertExpect.d.ts +52 -0
  6. package/dist/assertExpect.js +104 -0
  7. package/dist/assertExpect.js.map +1 -0
  8. package/dist/blind.d.ts +79 -0
  9. package/dist/blind.js +113 -0
  10. package/dist/blind.js.map +1 -0
  11. package/dist/cli/addPages.d.ts +6 -1
  12. package/dist/cli/addPages.js +19 -4
  13. package/dist/cli/addPages.js.map +1 -1
  14. package/dist/cli/main.d.ts +1 -1
  15. package/dist/cli/main.js +4 -3
  16. package/dist/cli/main.js.map +1 -1
  17. package/dist/compare.d.ts +38 -0
  18. package/dist/compare.js +62 -0
  19. package/dist/compare.js.map +1 -1
  20. package/dist/decisions.js +8 -0
  21. package/dist/decisions.js.map +1 -1
  22. package/dist/feedback.d.ts +17 -2
  23. package/dist/feedback.js +13 -2
  24. package/dist/feedback.js.map +1 -1
  25. package/dist/glossary.d.ts +22 -0
  26. package/dist/glossary.js +22 -0
  27. package/dist/glossary.js.map +1 -1
  28. package/dist/health.js +5 -3
  29. package/dist/health.js.map +1 -1
  30. package/dist/importCases.d.ts +76 -5
  31. package/dist/importCases.js +114 -14
  32. package/dist/importCases.js.map +1 -1
  33. package/dist/inInstructions.d.ts +47 -0
  34. package/dist/inInstructions.js +95 -0
  35. package/dist/inInstructions.js.map +1 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/memoryStore.js +3 -1
  40. package/dist/memoryStore.js.map +1 -1
  41. package/dist/readCheck.d.ts +116 -0
  42. package/dist/readCheck.js +321 -0
  43. package/dist/readCheck.js.map +1 -0
  44. package/dist/runner.d.ts +16 -0
  45. package/dist/runner.js +51 -3
  46. package/dist/runner.js.map +1 -1
  47. package/dist/settings.d.ts +81 -3
  48. package/dist/settings.js +160 -23
  49. package/dist/settings.js.map +1 -1
  50. package/dist/store.d.ts +10 -3
  51. package/dist/suggest.d.ts +10 -1
  52. package/dist/suggest.js +22 -4
  53. package/dist/suggest.js.map +1 -1
  54. package/dist/suiteContract.d.ts +23 -0
  55. package/dist/suiteContract.js +106 -0
  56. package/dist/suiteContract.js.map +1 -0
  57. package/dist/suites/crisisRisk.d.ts +83 -0
  58. package/dist/suites/crisisRisk.js +176 -0
  59. package/dist/suites/crisisRisk.js.map +1 -0
  60. package/dist/suites/crisisRiskCases.d.ts +40 -0
  61. package/dist/suites/crisisRiskCases.js +179 -0
  62. package/dist/suites/crisisRiskCases.js.map +1 -0
  63. package/dist/suites/hopelessness.d.ts +116 -0
  64. package/dist/suites/hopelessness.js +293 -0
  65. package/dist/suites/hopelessness.js.map +1 -0
  66. package/dist/suites/hopelessnessCases.d.ts +61 -0
  67. package/dist/suites/hopelessnessCases.js +242 -0
  68. package/dist/suites/hopelessnessCases.js.map +1 -0
  69. package/dist/suites/index.d.ts +11 -0
  70. package/dist/suites/index.js +12 -0
  71. package/dist/suites/index.js.map +1 -0
  72. package/dist/testing.d.ts +162 -12
  73. package/dist/testing.js +479 -115
  74. package/dist/testing.js.map +1 -1
  75. package/dist/types.d.ts +98 -0
  76. package/dist/types.js +68 -0
  77. package/dist/types.js.map +1 -1
  78. package/dist/weekly.d.ts +21 -3
  79. package/dist/weekly.js +18 -1
  80. package/dist/weekly.js.map +1 -1
  81. package/package.json +5 -1
  82. package/src/activity.ts +154 -0
  83. package/src/assertExpect.ts +168 -0
  84. package/src/blind.ts +138 -0
  85. package/src/cli/addPages.ts +20 -4
  86. package/src/cli/main.ts +4 -3
  87. package/src/compare.ts +85 -0
  88. package/src/decisions.ts +10 -0
  89. package/src/feedback.ts +20 -2
  90. package/src/glossary.ts +40 -0
  91. package/src/health.ts +5 -3
  92. package/src/importCases.ts +172 -33
  93. package/src/inInstructions.ts +105 -0
  94. package/src/index.ts +5 -0
  95. package/src/memoryStore.ts +2 -1
  96. package/src/readCheck.ts +458 -0
  97. package/src/runner.ts +74 -4
  98. package/src/settings.ts +192 -26
  99. package/src/store.ts +11 -3
  100. package/src/suggest.ts +33 -4
  101. package/src/suiteContract.ts +147 -0
  102. package/src/suites/crisisRisk.ts +250 -0
  103. package/src/suites/crisisRiskCases.ts +205 -0
  104. package/src/suites/hopelessness.ts +410 -0
  105. package/src/suites/hopelessnessCases.ts +286 -0
  106. package/src/suites/index.ts +11 -0
  107. package/src/testing.ts +646 -121
  108. package/src/types.ts +147 -0
  109. package/src/weekly.ts +39 -3
  110. package/starter/index.ts +8 -0
  111. package/templates/app/evals/[suite]/compare/page.tsx +385 -0
  112. package/templates/app/evals/[suite]/page.tsx +104 -31
  113. package/templates/app/evals/[suite]/rate/page.tsx +143 -0
  114. package/templates/app/evals/[suite]/runs/[runId]/page.tsx +84 -3
  115. package/templates/app/evals/[suite]/side-by-side/page.tsx +320 -0
  116. package/templates/app/evals/feedback/page.tsx +3 -0
  117. package/templates/app/evals/page.tsx +3 -0
  118. package/templates/components/evalkeeper/AnswerKey.tsx +2 -1
  119. package/templates/components/evalkeeper/DisagreementChip.tsx +35 -0
  120. package/templates/components/evalkeeper/ReadableOutput.tsx +97 -0
  121. package/templates/components/evalkeeper/RollBack.tsx +21 -1
  122. package/templates/components/evalkeeper/SettingsHistory.tsx +29 -5
  123. package/templates/components/evalkeeper/WeeklyCheck.tsx +34 -2
  124. package/templates/lib/evalkeeper/actions.ts +68 -4
  125. package/templates/lib/evalkeeper/weekly.ts +27 -4
@@ -1,3 +1,4 @@
1
+ import type { Metadata } from "next";
1
2
  import Link from "next/link";
2
3
  import { notFound } from "next/navigation";
3
4
  import {
@@ -38,6 +39,15 @@ import { EVALS_BASE, evalsPath } from "@/lib/evalkeeper/paths";
38
39
 
39
40
  export const dynamic = "force-dynamic";
40
41
 
42
+ export async function generateMetadata({
43
+ params,
44
+ }: {
45
+ params: Promise<{ suite: string }>;
46
+ }): Promise<Metadata> {
47
+ const { suite } = await params;
48
+ return { title: `Evals: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
49
+ }
50
+
41
51
  /** A share as a whole percent, or a dash when there's nothing to show. */
42
52
  const asPct = (x: number | null) => (x === null ? "—" : pct(x));
43
53
 
@@ -59,7 +69,7 @@ export default async function SuitePage({
59
69
  if (!operation) notFound();
60
70
  // The board and the settings load together: on a remote database each
61
71
  // waits on round trips, so one after the other doubles the wait.
62
- const [b, [history, liveSettings]] = await Promise.all([
72
+ const [b, [history, liveSettings], inInstructions] = await Promise.all([
63
73
  runner.board(key),
64
74
  // Records a deploy if the instructions changed under the live
65
75
  // settings, before reading them.
@@ -68,6 +78,7 @@ export default async function SuitePage({
68
78
  .then(() =>
69
79
  Promise.all([settings.history(operation), settings.current(operation)]),
70
80
  ),
81
+ runner.casesInInstructions(key),
71
82
  ]);
72
83
  const { suite, rows } = b;
73
84
  const s = suggest(rows, suite.checks, suite.priority, MODELS);
@@ -101,27 +112,35 @@ export default async function SuitePage({
101
112
  </p>
102
113
  </div>
103
114
 
104
- {s && !s.same && (
115
+ {/* Shown when nothing would change too, so a higher score that
116
+ isn't enough to switch for comes with its reason. */}
117
+ {s && (
105
118
  <Card className="space-y-3">
106
119
  <div className="flex flex-wrap items-start justify-between gap-3">
107
120
  <h2 className="font-semibold">
108
- Suggested
121
+ {s.same ? "No change suggested" : "Suggested"}
109
122
  <InfoTip term="suggestion" />
110
123
  </h2>
111
- <form action={useSuggestion}>
112
- <input type="hidden" name="suite" value={key} />
113
- <Submit>Use these</Submit>
114
- </form>
124
+ {/* Retesting live changes nothing until the fallback would. */}
125
+ {!s.same &&
126
+ !(s.retestLive && (!s.fallback || s.fallback.fallback)) && (
127
+ <form action={useSuggestion}>
128
+ <input type="hidden" name="suite" value={key} />
129
+ <Submit>Use these</Submit>
130
+ </form>
131
+ )}
115
132
  </div>
116
- <p>
117
- Live: <strong>{s.live.label}</strong>
118
- {s.fallback && (
119
- <>
120
- {" "}
121
- · Fallback: <strong>{s.fallback.label}</strong>
122
- </>
123
- )}
124
- </p>
133
+ {!s.same && (
134
+ <p>
135
+ Live: <strong>{s.live.label}</strong>
136
+ {s.fallback && (
137
+ <>
138
+ {" "}
139
+ · Fallback: <strong>{s.fallback.label}</strong>
140
+ </>
141
+ )}
142
+ </p>
143
+ )}
125
144
  <ul className="readable list-disc space-y-1 pl-5 text-sm text-muted">
126
145
  {s.reasons.map((r) => (
127
146
  <li key={r}>{r}</li>
@@ -130,13 +149,42 @@ export default async function SuitePage({
130
149
  </Card>
131
150
  )}
132
151
 
152
+ {inInstructions.length > 0 && (
153
+ <Card className="space-y-2">
154
+ <h2 className="font-semibold text-warn">
155
+ Cases in the instructions
156
+ <InfoTip term="inInstructions" />
157
+ </h2>
158
+ <p className="readable text-sm text-muted">
159
+ These cases&apos; words appear in what the model is told, so a test
160
+ grades it on answers it was handed. Take the example out of the
161
+ instructions, or rewrite or retire the case.
162
+ </p>
163
+ <ul className="readable list-disc space-y-1 pl-5 text-sm">
164
+ {inInstructions.map((c) => (
165
+ <li key={c.caseId}>
166
+ {c.title}: “{c.found}”
167
+ </li>
168
+ ))}
169
+ </ul>
170
+ </Card>
171
+ )}
172
+
133
173
  <section className="space-y-3">
134
174
  <div className="flex items-center justify-between gap-4">
135
175
  <h2 className="text-lg font-semibold">Models</h2>
136
- <form action={testAll}>
137
- <input type="hidden" name="suite" value={key} />
138
- <Submit variant="quiet">Test every model</Submit>
139
- </form>
176
+ <div className="flex items-center gap-4">
177
+ <Link
178
+ href={evalsPath(key, "compare")}
179
+ className="text-sm text-muted hover:text-ink"
180
+ >
181
+ Compare two tests
182
+ </Link>
183
+ <form action={testAll}>
184
+ <input type="hidden" name="suite" value={key} />
185
+ <Submit variant="quiet">Test every model</Submit>
186
+ </form>
187
+ </div>
140
188
  </div>
141
189
  <Card className="overflow-x-auto p-0 lg:overflow-visible">
142
190
  <table className="w-full text-sm">
@@ -290,7 +338,19 @@ export default async function SuitePage({
290
338
  <td className="p-3 tabular-nums">
291
339
  {r.test ? perAnswer(r.test.costPerAnswer) : "—"}
292
340
  </td>
293
- <td className="p-3">{r.vsLive ? VS[r.vsLive] : "—"}</td>
341
+ <td className="p-3">
342
+ {r.vsLive && live?.test && r.test && !r.live ? (
343
+ <Link
344
+ href={`${evalsPath(key, "compare")}?${new URLSearchParams({ a: live.test.runId, b: r.test.runId })}`}
345
+ >
346
+ {VS[r.vsLive]}
347
+ </Link>
348
+ ) : r.vsLive ? (
349
+ VS[r.vsLive]
350
+ ) : (
351
+ "—"
352
+ )}
353
+ </td>
294
354
  <td className="p-3">
295
355
  <div className="flex flex-col items-end gap-0.5">
296
356
  <div className="flex justify-end gap-2">
@@ -406,7 +466,8 @@ export default async function SuitePage({
406
466
  </div>
407
467
  </section>
408
468
 
409
- <section className="space-y-3">
469
+ {/* The weekly check links here to review drafts. */}
470
+ <section id="answer-key" className="scroll-mt-4 space-y-3">
410
471
  <AnswerKey
411
472
  suite={suite}
412
473
  rows={rows}
@@ -417,15 +478,27 @@ export default async function SuitePage({
417
478
  </h2>
418
479
  }
419
480
  tools={
420
- <form action={rescore}>
421
- <input type="hidden" name="suite" value={key} />
422
- <Tip control term="rescore" side="bottom" align="end">
423
- <IconSubmit
424
- label="Rescore tests"
425
- icon={<RotateCw aria-hidden className="h-4 w-4" />}
426
- />
427
- </Tip>
428
- </form>
481
+ <>
482
+ {suite.caseKind === "imported" && suite.labelFromForm && (
483
+ <Tip control term="rateBlind" side="bottom" align="end">
484
+ <Link
485
+ href={evalsPath(key, "rate")}
486
+ className="inline-flex items-center rounded-md border border-accent/40 bg-card px-3 py-1.5 text-sm text-accent hover:bg-accent/10"
487
+ >
488
+ Rate blind
489
+ </Link>
490
+ </Tip>
491
+ )}
492
+ <form action={rescore}>
493
+ <input type="hidden" name="suite" value={key} />
494
+ <Tip control term="rescore" side="bottom" align="end">
495
+ <IconSubmit
496
+ label="Rescore tests"
497
+ icon={<RotateCw aria-hidden className="h-4 w-4" />}
498
+ />
499
+ </Tip>
500
+ </form>
501
+ </>
429
502
  }
430
503
  />
431
504
  </section>
@@ -0,0 +1,143 @@
1
+ import type { Metadata } from "next";
2
+ import Link from "next/link";
3
+ import { notFound } from "next/navigation";
4
+ import { rateQueue } from "@crowandraven/evalkeeper";
5
+ import { FieldValues, Fields } from "@/components/evalkeeper/Fields";
6
+ import { Submit } from "@/components/evalkeeper/Submit";
7
+ import { InfoTip, Tip } from "@/components/evalkeeper/Tip";
8
+ import { BackLink, Card } from "@/components/evalkeeper/ui";
9
+ import { requireAdmin, SUITE_BY_KEY, store } from "@/lib/evalkeeper";
10
+ import { rateBlind, skipCase } from "@/lib/evalkeeper/actions";
11
+ import { evalsPath } from "@/lib/evalkeeper/paths";
12
+
13
+ export const dynamic = "force-dynamic";
14
+
15
+ export async function generateMetadata({
16
+ params,
17
+ }: {
18
+ params: Promise<{ suite: string }>;
19
+ }): Promise<Metadata> {
20
+ const { suite } = await params;
21
+ return { title: `Rate blind: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
22
+ }
23
+
24
+ /**
25
+ * Rating an imported suite's cases blind: one case at a time, the oldest
26
+ * this person hasn't rated or skipped, shown by its input alone. The app's
27
+ * output, what anyone did with the item, other answers, tags, and notes
28
+ * stay hidden, because any of them anchors the rating.
29
+ */
30
+ export default async function RateBlindPage({
31
+ params,
32
+ }: {
33
+ params: Promise<{ suite: string }>;
34
+ }) {
35
+ const admin = await requireAdmin();
36
+ const { suite: key } = await params;
37
+ const suite = SUITE_BY_KEY[key];
38
+ const fields = suite?.fields;
39
+ if (
40
+ !suite ||
41
+ suite.caseKind !== "imported" ||
42
+ !fields ||
43
+ !suite.labelFromForm
44
+ )
45
+ notFound();
46
+ const queue = rateQueue(await store.listCases(key), admin.id);
47
+ const next = queue.next;
48
+ const input = next ? suite.input.parse(next.input) : null;
49
+
50
+ return (
51
+ <div className="space-y-8">
52
+ <div className="space-y-2">
53
+ <BackLink href={evalsPath(key)}>{suite.label}</BackLink>
54
+ <h1 className="text-2xl font-semibold">
55
+ Rate blind
56
+ <InfoTip term="rateBlind" />
57
+ </h1>
58
+ <p className="readable text-muted">
59
+ One case at a time, from its input alone. You won&apos;t see what the
60
+ app decided or what anyone did with it, so nothing anchors your
61
+ answer. Give the answer and why, or skip it.
62
+ </p>
63
+ <p className="text-sm text-muted">
64
+ <Tip term="rateQueue" id="rate-queue">
65
+ <span>
66
+ {queue.rated} rated · {queue.skipped} skipped · {queue.left} left
67
+ </span>
68
+ </Tip>
69
+ </p>
70
+ </div>
71
+
72
+ {next && input !== null ? (
73
+ <Card className="space-y-6">
74
+ <section className="space-y-3">
75
+ <h2 className="font-semibold">{suite.title(input)}</h2>
76
+ {fields.input.length ? (
77
+ <FieldValues
78
+ fields={fields.input}
79
+ values={next.input}
80
+ prefix="rate-in-"
81
+ />
82
+ ) : (
83
+ <pre className="readable whitespace-pre-wrap text-sm">
84
+ {suite.describe?.(input) ?? JSON.stringify(next.input, null, 2)}
85
+ </pre>
86
+ )}
87
+ </section>
88
+
89
+ {/* Keyed by case, so the next case starts with an empty form. */}
90
+ <form key={next.id} action={rateBlind} className="space-y-4">
91
+ <input type="hidden" name="suite" value={key} />
92
+ <input type="hidden" name="case" value={next.id} />
93
+ <Fields fields={fields.label} prefix="rate-" />
94
+ <div className="space-y-1">
95
+ <label
96
+ htmlFor="rate-reason"
97
+ className="block text-sm font-medium"
98
+ >
99
+ Why
100
+ </label>
101
+ <textarea
102
+ id="rate-reason"
103
+ name="reason"
104
+ required
105
+ rows={3}
106
+ className="w-full rounded-md border border-line bg-card px-3 py-2 text-sm focus:border-accent focus:outline-none"
107
+ />
108
+ <p className="readable text-xs text-muted">
109
+ What in the input decided it, in a sentence. Kept with your
110
+ answer, so anyone checking it later sees your reasoning.
111
+ </p>
112
+ </div>
113
+ <p className="readable text-xs text-muted">
114
+ Saves your own confirmed answer beside anyone else&apos;s, and
115
+ rescores tests for free.
116
+ </p>
117
+ <Submit>Save rating</Submit>
118
+ </form>
119
+
120
+ <form action={skipCase}>
121
+ <input type="hidden" name="suite" value={key} />
122
+ <input type="hidden" name="case" value={next.id} />
123
+ <Tip control term="skip" id="rate-skip">
124
+ <Submit variant="quiet">Skip</Submit>
125
+ </Tip>
126
+ </form>
127
+ </Card>
128
+ ) : (
129
+ <Card className="space-y-2">
130
+ <h2 className="font-semibold">Nothing left for you to rate</h2>
131
+ <p className="readable text-sm text-muted">
132
+ You&apos;ve rated or skipped every case in this suite.
133
+ {queue.skipped > 0 &&
134
+ " Cases you skipped are still in the answer key, where you can write their answers."}
135
+ </p>
136
+ <Link href={evalsPath(key)} className="text-sm text-accent">
137
+ Back to the answer key
138
+ </Link>
139
+ </Card>
140
+ )}
141
+ </div>
142
+ );
143
+ }
@@ -1,11 +1,30 @@
1
+ import Link from "next/link";
1
2
  import { notFound } from "next/navigation";
2
3
  import { allPassed, money, summarize } from "@crowandraven/evalkeeper";
4
+ import type { Metadata } from "next";
5
+ import { FieldValues } from "@/components/evalkeeper/Fields";
6
+ import { ReadableOutput } from "@/components/evalkeeper/ReadableOutput";
3
7
  import { BackLink, Card, pct } from "@/components/evalkeeper/ui";
4
- import { MODELS, requireAdmin, runner, store } from "@/lib/evalkeeper";
8
+ import {
9
+ MODELS,
10
+ requireAdmin,
11
+ runner,
12
+ store,
13
+ SUITE_BY_KEY,
14
+ } from "@/lib/evalkeeper";
5
15
  import { evalsPath } from "@/lib/evalkeeper/paths";
6
16
 
7
17
  export const dynamic = "force-dynamic";
8
18
 
19
+ export async function generateMetadata({
20
+ params,
21
+ }: {
22
+ params: Promise<{ suite: string }>;
23
+ }): Promise<Metadata> {
24
+ const { suite } = await params;
25
+ return { title: `Test: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
26
+ }
27
+
9
28
  /** One test: every answer, with what each check found. */
10
29
  export default async function RunPage({
11
30
  params,
@@ -29,7 +48,13 @@ export default async function RunPage({
29
48
  const summary = metrics ? summarize(metrics, suite.checks) : null;
30
49
  const label = (k: string) =>
31
50
  suite.checks.find((c) => c.key === k)?.label ?? k;
32
- type Check = { key: string; pass: boolean | null; note?: string };
51
+ type Check = {
52
+ key: string;
53
+ pass: boolean | null;
54
+ note?: string;
55
+ given?: string;
56
+ matches?: { expected: string; actual: string; why: string }[];
57
+ };
33
58
 
34
59
  return (
35
60
  <div className="space-y-6">
@@ -41,6 +66,17 @@ export default async function RunPage({
41
66
  <p className="text-sm text-muted">
42
67
  {run.startedAt.toLocaleString()} · {run.status.toLowerCase()}
43
68
  {metrics && ` · spent ${money(metrics.costUsd)}`}
69
+ {run.status === "SUCCEEDED" && (
70
+ <>
71
+ {" · "}
72
+ <Link
73
+ href={`${evalsPath(key, "compare")}?${new URLSearchParams({ b: runId })}`}
74
+ className="hover:text-ink"
75
+ >
76
+ Compare with another test
77
+ </Link>
78
+ </>
79
+ )}
44
80
  </p>
45
81
  {run.error && <p className="readable text-bad">{run.error}</p>}
46
82
  </div>
@@ -79,13 +115,58 @@ export default async function RunPage({
79
115
  </span>
80
116
  </div>
81
117
  {o.error && <p className="text-bad">{o.error}</p>}
118
+ {!o.error && o.output !== null && (
119
+ <div className="mt-2">
120
+ {suite.fields && suite.labelFromOutput ? (
121
+ <FieldValues
122
+ fields={suite.fields.label}
123
+ values={suite.labelFromOutput(o.output)}
124
+ prefix={`${o.id}-`}
125
+ />
126
+ ) : (
127
+ <ReadableOutput value={o.output} />
128
+ )}
129
+ </div>
130
+ )}
131
+ {suite.decisions &&
132
+ checks?.some((c) => c.given !== undefined) && (
133
+ <ul className="mt-2 space-y-0.5 text-xs">
134
+ {checks
135
+ .filter((c) => c.given !== undefined)
136
+ .map((c) => (
137
+ <li key={c.key}>
138
+ <span className="text-muted">{label(c.key)}:</span>{" "}
139
+ {c.given}{" "}
140
+ <span className={c.pass ? "text-good" : "text-warn"}>
141
+ {c.pass ? "right" : "wrong"}
142
+ </span>
143
+ </li>
144
+ ))}
145
+ </ul>
146
+ )}
82
147
  {checks
83
148
  ?.filter((c) => c.pass === false)
84
149
  .map((c) => (
85
- <p key={c.key} className="readable text-muted">
150
+ <p key={c.key} className="readable mt-2 text-muted">
86
151
  {label(c.key)}: {c.note ?? "failed"}
87
152
  </p>
88
153
  ))}
154
+ {checks
155
+ ?.flatMap((c) => c.matches ?? [])
156
+ .slice(0, 20)
157
+ .map((m, i) => (
158
+ <p key={i} className="readable mt-1 text-xs text-muted">
159
+ Matched “{m.expected}” with “{m.actual}”: {m.why}
160
+ </p>
161
+ ))}
162
+ {cases.has(o.caseId) && (
163
+ <Link
164
+ href={`${evalsPath(key)}#case-${o.caseId}`}
165
+ className="mt-2 inline-block text-xs text-accent hover:underline"
166
+ >
167
+ Find the case in the answer key
168
+ </Link>
169
+ )}
89
170
  </div>
90
171
  );
91
172
  })}