@crowandraven/evalkeeper 0.17.1 → 0.19.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/dist/decisions.js +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/drafts.d.ts +2 -0
- package/dist/drafts.js +1 -1
- package/dist/drafts.js.map +1 -1
- package/dist/glossary.d.ts +25 -14
- package/dist/glossary.js +25 -14
- package/dist/glossary.js.map +1 -1
- package/dist/health.js +2 -2
- package/dist/health.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/memoryStore.d.ts +2 -1
- package/dist/memoryStore.js +9 -0
- package/dist/memoryStore.js.map +1 -1
- package/dist/next/actions.js +58 -3
- package/dist/next/actions.js.map +1 -1
- package/dist/prisma/contracts.d.ts +5 -2
- package/dist/prisma/contracts.js +7 -1
- package/dist/prisma/contracts.js.map +1 -1
- package/dist/prisma/index.d.ts +40 -1
- package/dist/prisma/index.js +37 -1
- package/dist/prisma/index.js.map +1 -1
- package/dist/prune.d.ts +43 -10
- package/dist/prune.js +42 -13
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.js +11 -5
- package/dist/react/AddCase.js.map +1 -1
- package/dist/react/AnswerKey.js +7 -4
- package/dist/react/AnswerKey.js.map +1 -1
- package/dist/react/CaseMenu.d.ts +2 -2
- package/dist/react/CaseMenu.js +10 -31
- package/dist/react/CaseMenu.js.map +1 -1
- package/dist/react/CompareView.js +3 -3
- package/dist/react/CompareView.js.map +1 -1
- package/dist/react/ConfirmAnswer.js +1 -1
- package/dist/react/ConfirmAnswer.js.map +1 -1
- package/dist/react/Drawer.d.ts +32 -0
- package/dist/react/Drawer.js +60 -0
- package/dist/react/Drawer.js.map +1 -0
- package/dist/react/HubSections.d.ts +34 -30
- package/dist/react/HubSections.js +104 -103
- package/dist/react/HubSections.js.map +1 -1
- package/dist/react/Menu.d.ts +37 -0
- package/dist/react/Menu.js +51 -0
- package/dist/react/Menu.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +1 -1
- package/dist/react/ModelMenu.js +8 -32
- package/dist/react/ModelMenu.js.map +1 -1
- package/dist/react/RunView.js +24 -4
- package/dist/react/RunView.js.map +1 -1
- package/dist/react/Spending.d.ts +25 -0
- package/dist/react/Spending.js +51 -0
- package/dist/react/Spending.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +27 -14
- package/dist/react/SuiteSections.js +227 -61
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/react/app.d.ts +18 -0
- package/dist/react/app.js.map +1 -1
- package/dist/react/format.d.ts +13 -0
- package/dist/react/format.js +13 -0
- package/dist/react/format.js.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/pieces.d.ts +21 -8
- package/dist/react/pieces.js +44 -14
- package/dist/react/pieces.js.map +1 -1
- package/dist/runner.d.ts +18 -8
- package/dist/runner.js +148 -12
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +12 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -1
- package/dist/spending.d.ts +100 -0
- package/dist/spending.js +133 -0
- package/dist/spending.js.map +1 -0
- package/dist/stats.d.ts +3 -1
- package/dist/stats.js +6 -2
- package/dist/stats.js.map +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/suggest.js +17 -12
- package/dist/suggest.js.map +1 -1
- package/dist/suiteSettings.d.ts +78 -0
- package/dist/suiteSettings.js +142 -0
- package/dist/suiteSettings.js.map +1 -0
- package/dist/suites/crisisRisk.js +3 -3
- package/dist/suites/crisisRisk.js.map +1 -1
- package/dist/suites/hopelessness.js +6 -6
- package/dist/suites/hopelessness.js.map +1 -1
- package/dist/suites/injection.js +2 -2
- package/dist/suites/injection.js.map +1 -1
- package/dist/summary.d.ts +41 -4
- package/dist/summary.js +46 -8
- package/dist/summary.js.map +1 -1
- package/dist/testing.d.ts +19 -0
- package/dist/testing.js +61 -0
- package/dist/testing.js.map +1 -1
- package/dist/todo.d.ts +146 -0
- package/dist/todo.js +198 -0
- package/dist/todo.js.map +1 -0
- package/dist/types.d.ts +46 -7
- package/dist/types.js +28 -4
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/schema/evalkeeper.prisma +13 -0
- package/src/decisions.ts +1 -1
- package/src/drafts.ts +3 -1
- package/src/glossary.ts +35 -14
- package/src/health.ts +3 -2
- package/src/index.ts +3 -0
- package/src/memoryStore.ts +15 -1
- package/src/next/actions.ts +67 -2
- package/src/prisma/contracts.ts +16 -1
- package/src/prisma/index.ts +68 -1
- package/src/prune.ts +71 -14
- package/src/react/AddCase.tsx +13 -11
- package/src/react/AnswerKey.tsx +17 -5
- package/src/react/CaseMenu.tsx +23 -77
- package/src/react/CompareView.tsx +4 -10
- package/src/react/ConfirmAnswer.tsx +1 -1
- package/src/react/Drawer.tsx +130 -0
- package/src/react/HubSections.tsx +180 -414
- package/src/react/Menu.tsx +155 -0
- package/src/react/ModelMenu.tsx +23 -74
- package/src/react/RunView.tsx +46 -3
- package/src/react/Spending.tsx +200 -0
- package/src/react/SuiteSections.tsx +591 -148
- package/src/react/app.ts +18 -0
- package/src/react/format.ts +15 -0
- package/src/react/index.ts +3 -0
- package/src/react/pieces.tsx +57 -18
- package/src/runner.ts +199 -13
- package/src/settings.ts +20 -0
- package/src/spending.ts +209 -0
- package/src/stats.ts +8 -2
- package/src/store.ts +5 -0
- package/src/suggest.ts +21 -14
- package/src/suiteSettings.ts +201 -0
- package/src/suites/crisisRisk.ts +3 -3
- package/src/suites/hopelessness.ts +6 -6
- package/src/suites/injection.ts +2 -2
- package/src/summary.ts +59 -8
- package/src/testing.ts +77 -0
- package/src/todo.ts +318 -0
- package/src/types.ts +63 -9
- package/starter/index.ts +7 -0
- package/templates/lib/evalkeeper/actions.ts +20 -0
|
@@ -21,6 +21,18 @@ import {
|
|
|
21
21
|
seconds,
|
|
22
22
|
seriousMistakes,
|
|
23
23
|
suggest,
|
|
24
|
+
withRounds,
|
|
25
|
+
EASY_MIN_ROUNDS,
|
|
26
|
+
currentSettings,
|
|
27
|
+
replacedStarters,
|
|
28
|
+
suiteStatus,
|
|
29
|
+
suiteTodos,
|
|
30
|
+
targetCasesOf,
|
|
31
|
+
todoText,
|
|
32
|
+
type Todo,
|
|
33
|
+
type TodoInput,
|
|
34
|
+
SEVERITY_ORDER,
|
|
35
|
+
SEVERITY_LABEL,
|
|
24
36
|
} from "../index.js";
|
|
25
37
|
import { AnswerKey } from "./AnswerKey.js";
|
|
26
38
|
import { ModelMenu } from "./ModelMenu.js";
|
|
@@ -35,6 +47,8 @@ import {
|
|
|
35
47
|
Card,
|
|
36
48
|
RefreshWhile,
|
|
37
49
|
Chip,
|
|
50
|
+
SeverityChip,
|
|
51
|
+
SuiteStatusBadge,
|
|
38
52
|
IconSubmit,
|
|
39
53
|
InfoTip,
|
|
40
54
|
Score,
|
|
@@ -43,9 +57,24 @@ import {
|
|
|
43
57
|
Submit,
|
|
44
58
|
Tip,
|
|
45
59
|
} from "./pieces.js";
|
|
46
|
-
import { pct, LINK, QUIET_BUTTON } from "./format.js";
|
|
47
|
-
import {
|
|
48
|
-
|
|
60
|
+
import { pct, LINK, QUIET_BUTTON, TINT } from "./format.js";
|
|
61
|
+
import {
|
|
62
|
+
Check,
|
|
63
|
+
ChevronRight,
|
|
64
|
+
Plus,
|
|
65
|
+
RotateCw,
|
|
66
|
+
ShieldAlert,
|
|
67
|
+
Sparkles,
|
|
68
|
+
} from "lucide-react";
|
|
69
|
+
import { PageMenu, type PageMenuEntry } from "./Drawer.js";
|
|
70
|
+
import { SpendingAlert, SpendingForm } from "./Spending.js";
|
|
71
|
+
import { TARGET_CASES_RANGE } from "../suiteSettings.js";
|
|
72
|
+
import {
|
|
73
|
+
evalsPath,
|
|
74
|
+
type EvalAppConfig,
|
|
75
|
+
type FormAction,
|
|
76
|
+
attacksResisted,
|
|
77
|
+
} from "./app.js";
|
|
49
78
|
import { SettingsHistory } from "./SettingsHistory.js";
|
|
50
79
|
|
|
51
80
|
/**
|
|
@@ -59,31 +88,41 @@ import { SettingsHistory } from "./SettingsHistory.js";
|
|
|
59
88
|
export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
60
89
|
const operation = app.suiteByKey[key]?.operation;
|
|
61
90
|
if (!operation) return null;
|
|
62
|
-
const [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
const [
|
|
92
|
+
b,
|
|
93
|
+
attackBoards,
|
|
94
|
+
[history, liveSettings],
|
|
95
|
+
inInstructions,
|
|
96
|
+
cases,
|
|
97
|
+
savedSettings,
|
|
98
|
+
spending,
|
|
99
|
+
] = await Promise.all([
|
|
100
|
+
app.runner.board(key),
|
|
101
|
+
// Injection suites that attack this feature: their results count here.
|
|
102
|
+
app.runner.attackBoards(key),
|
|
103
|
+
// Records a deploy if the instructions changed under the live
|
|
104
|
+
// settings, before reading them.
|
|
105
|
+
app.settings.syncPrompt(operation).then(() =>
|
|
106
|
+
Promise.all([
|
|
107
|
+
app.settings.history(operation),
|
|
108
|
+
// Null for a feature with no settings yet: the page still shows.
|
|
109
|
+
currentSettings(app.settings, operation),
|
|
110
|
+
]),
|
|
111
|
+
),
|
|
112
|
+
app.runner.casesInInstructions(key),
|
|
113
|
+
// Retired ones too: starters already added once aren't offered again.
|
|
114
|
+
app.store.listCases(key, { includeRetired: true }),
|
|
115
|
+
app.runner.suiteSettings(key),
|
|
116
|
+
// The page must load even when spending can't be read.
|
|
117
|
+
app.spending ? app.spending.read(operation).catch(() => null) : null,
|
|
118
|
+
]);
|
|
81
119
|
const { suite, rows } = b;
|
|
82
120
|
const attacks = attacksFrom(attackBoards);
|
|
83
121
|
// An injection suite's models are chosen on its base suite's page.
|
|
84
122
|
const choosesHere = !isInjectionSuite(suite);
|
|
85
123
|
// The suite's priority, or the one an admin chose in its settings.
|
|
86
|
-
const priority = priorityOf(suite, liveSettings
|
|
124
|
+
const priority = priorityOf(suite, liveSettings?.settings);
|
|
125
|
+
const target = targetCasesOf(suite, savedSettings);
|
|
87
126
|
const testing =
|
|
88
127
|
rows.some((r) => r.testing) ||
|
|
89
128
|
attackBoards.some((a) => a.rows.some((r) => r.testing));
|
|
@@ -117,25 +156,85 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
117
156
|
(m, r) => (r.test && (!m || r.test.at > m) ? r.test.at : m),
|
|
118
157
|
null,
|
|
119
158
|
);
|
|
120
|
-
|
|
159
|
+
// Rounds each case passed (read only past the floor of cases).
|
|
160
|
+
const rounds = await app.runner.easyRounds(key, cases, target);
|
|
161
|
+
const health = answerKeyHealth(
|
|
162
|
+
cases,
|
|
163
|
+
withRounds(b.caseResults, rounds),
|
|
164
|
+
new Date(),
|
|
165
|
+
testedAt,
|
|
166
|
+
target,
|
|
167
|
+
);
|
|
168
|
+
const replaced = replacedStarters(suite, cases);
|
|
169
|
+
// Attack tests set up but not made yet.
|
|
170
|
+
const unmade = attackBoards.filter((a) => a.cases === 0);
|
|
171
|
+
const todoInput: TodoInput = {
|
|
172
|
+
rows,
|
|
173
|
+
checks: suite.checks,
|
|
174
|
+
priority,
|
|
175
|
+
models: app.models,
|
|
176
|
+
attacks,
|
|
177
|
+
cases: b.cases,
|
|
178
|
+
provisional: b.provisional,
|
|
179
|
+
target,
|
|
180
|
+
unmadeAttacks: app.actions.makeAttackCases
|
|
181
|
+
? unmade.map((a) => ({ key: a.suite.key, label: a.suite.label }))
|
|
182
|
+
: [],
|
|
183
|
+
replacedStarters: replaced.length,
|
|
184
|
+
splitCases: health.split.length,
|
|
185
|
+
};
|
|
121
186
|
// For each split case, which models got it fully right and which didn't,
|
|
122
187
|
// so a person sees the disagreement before deciding.
|
|
123
188
|
const split = new Set(health.split.map((c) => c.id));
|
|
124
189
|
const splitBy: Record<string, { right: string[]; wrong: string[] }> = {};
|
|
125
|
-
|
|
190
|
+
// Must-pass checks every tested model misses: count the cases each
|
|
191
|
+
// misses them on, for the to-do list.
|
|
192
|
+
const fixing = new Set(
|
|
193
|
+
suiteTodos(todoInput).flatMap((t) =>
|
|
194
|
+
t.kind === "fixCheck" ? [t.check] : [],
|
|
195
|
+
),
|
|
196
|
+
);
|
|
197
|
+
// check → case → models that missed it there
|
|
198
|
+
const missedBy = new Map<string, Map<string, Set<string>>>();
|
|
199
|
+
const scored = current.filter((r) => !r.variant);
|
|
200
|
+
if (split.size || fixing.size)
|
|
126
201
|
await Promise.all(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
if (!split.has(o.caseId) || o.error) continue;
|
|
202
|
+
scored.map(async (r) => {
|
|
203
|
+
if (!r.test) return;
|
|
204
|
+
for (const o of await app.store.listOutputs(r.test.runId)) {
|
|
205
|
+
if (o.error) continue;
|
|
206
|
+
if (split.has(o.caseId)) {
|
|
133
207
|
const side = allPassed(o.scores) ? "right" : "wrong";
|
|
134
208
|
const entry = (splitBy[o.caseId] ??= { right: [], wrong: [] });
|
|
135
209
|
if (!entry[side].includes(r.label)) entry[side].push(r.label);
|
|
136
210
|
}
|
|
137
|
-
|
|
211
|
+
for (const x of o.scores ?? []) {
|
|
212
|
+
if (!fixing.has(x.key) || x.pass !== false) continue;
|
|
213
|
+
const byCase =
|
|
214
|
+
missedBy.get(x.key) ?? new Map<string, Set<string>>();
|
|
215
|
+
const models = byCase.get(o.caseId) ?? new Set<string>();
|
|
216
|
+
models.add(r.key);
|
|
217
|
+
byCase.set(o.caseId, models);
|
|
218
|
+
missedBy.set(x.key, byCase);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}),
|
|
138
222
|
);
|
|
223
|
+
const missedByCheck = Object.fromEntries(
|
|
224
|
+
[...fixing].map((k) => [
|
|
225
|
+
k,
|
|
226
|
+
[...(missedBy.get(k)?.values() ?? [])].filter(
|
|
227
|
+
(models) => models.size === scored.length,
|
|
228
|
+
).length,
|
|
229
|
+
]),
|
|
230
|
+
);
|
|
231
|
+
// The to-do list, on the page that chooses models.
|
|
232
|
+
const todos: Todo[] = choosesHere
|
|
233
|
+
? suiteTodos({ ...todoInput, missedByCheck })
|
|
234
|
+
: [];
|
|
235
|
+
const status = choosesHere
|
|
236
|
+
? suiteStatus({ ...todoInput, missedByCheck }, todos)
|
|
237
|
+
: null;
|
|
139
238
|
|
|
140
239
|
return {
|
|
141
240
|
app,
|
|
@@ -159,6 +258,12 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
159
258
|
cases,
|
|
160
259
|
priority,
|
|
161
260
|
splitBy,
|
|
261
|
+
target,
|
|
262
|
+
savedSettings,
|
|
263
|
+
spending,
|
|
264
|
+
todos,
|
|
265
|
+
status,
|
|
266
|
+
replaced,
|
|
162
267
|
};
|
|
163
268
|
}
|
|
164
269
|
|
|
@@ -183,26 +288,296 @@ const whyFavor = (favor: SuitePriority["favor"]) => {
|
|
|
183
288
|
const FAVORS = { cost: "cost", speed: "speed", quality: "accuracy" } as const;
|
|
184
289
|
|
|
185
290
|
const VS: Record<string, string> = {
|
|
186
|
-
BETTER: "
|
|
187
|
-
SAME: "
|
|
188
|
-
WORSE: "
|
|
189
|
-
TOO_FEW: "
|
|
291
|
+
BETTER: "Better",
|
|
292
|
+
SAME: "Similar",
|
|
293
|
+
WORSE: "Worse",
|
|
294
|
+
TOO_FEW: "Can't tell",
|
|
190
295
|
};
|
|
191
296
|
|
|
192
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* The suite's name and status, its menu (Suite settings, Spending and
|
|
299
|
+
* daily limits), what it tests, and spending when it needs room.
|
|
300
|
+
*/
|
|
193
301
|
export function SuiteHeader({ data }: { data: SuitePageData }) {
|
|
194
|
-
const { app, suite } = data;
|
|
302
|
+
const { app, suite, status } = data;
|
|
195
303
|
return (
|
|
196
|
-
|
|
304
|
+
<div className="space-y-4">
|
|
197
305
|
<div className="space-y-2">
|
|
198
306
|
<BackLink href={app.basePath}>Evals</BackLink>
|
|
199
|
-
<
|
|
307
|
+
<div className="flex items-start justify-between gap-4">
|
|
308
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
309
|
+
<h1 className="text-2xl font-semibold">{suite.label}</h1>
|
|
310
|
+
{status && (
|
|
311
|
+
<span className="inline-flex items-center">
|
|
312
|
+
<SuiteStatusBadge status={status} />
|
|
313
|
+
<InfoTip term="standing" id="suite-status" align="end" />
|
|
314
|
+
</span>
|
|
315
|
+
)}
|
|
316
|
+
</div>
|
|
317
|
+
<PageMenu label={`${suite.label} menu`} entries={menuEntries(data)} />
|
|
318
|
+
</div>
|
|
200
319
|
<p className="readable text-muted">{suite.description}</p>
|
|
201
320
|
</div>
|
|
202
|
-
|
|
321
|
+
<SpendingAlert app={app} reading={data.spending} />
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** The title menu's entries, each opening its own drawer. */
|
|
327
|
+
function menuEntries(data: SuitePageData): PageMenuEntry[] {
|
|
328
|
+
const { app, key, suite, spending, choosesHere } = data;
|
|
329
|
+
const entries: PageMenuEntry[] = [];
|
|
330
|
+
if (
|
|
331
|
+
choosesHere &&
|
|
332
|
+
app.runner.canSaveSuiteSettings &&
|
|
333
|
+
app.actions.saveSuiteSettings
|
|
334
|
+
)
|
|
335
|
+
entries.push({
|
|
336
|
+
key: "settings",
|
|
337
|
+
label: "Suite settings",
|
|
338
|
+
body: <SuiteSettingsForm data={data} />,
|
|
339
|
+
});
|
|
340
|
+
if (spending && app.actions.saveLimits)
|
|
341
|
+
entries.push({
|
|
342
|
+
key: "spending",
|
|
343
|
+
label: "Spending and daily limits",
|
|
344
|
+
body: (
|
|
345
|
+
<SpendingForm
|
|
346
|
+
app={app}
|
|
347
|
+
reading={spending}
|
|
348
|
+
suite={key}
|
|
349
|
+
label={suite.label}
|
|
350
|
+
/>
|
|
351
|
+
),
|
|
352
|
+
});
|
|
353
|
+
return entries;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Suite settings: one form, one Save. Its target number of cases, and each
|
|
358
|
+
* check's level and aim, kept apart from the model versions, so changing
|
|
359
|
+
* them never makes a version.
|
|
360
|
+
*/
|
|
361
|
+
function SuiteSettingsForm({ data }: { data: SuitePageData }) {
|
|
362
|
+
const { app, key, savedSettings, target } = data;
|
|
363
|
+
const action = app.actions.saveSuiteSettings;
|
|
364
|
+
if (!action) return null;
|
|
365
|
+
// The suite as written in code: what "its own" means for each field.
|
|
366
|
+
const own = app.runner.suiteOrThrow(key);
|
|
367
|
+
const ownTarget = own.targetCases ?? 50;
|
|
368
|
+
return (
|
|
369
|
+
<form key={target} action={action} className="space-y-4">
|
|
370
|
+
<p className="readable text-muted">
|
|
371
|
+
{GLOSSARY.suiteSettings} An empty field uses the suite's own.
|
|
372
|
+
</p>
|
|
373
|
+
<input type="hidden" name="suite" value={key} />
|
|
374
|
+
<div className="space-y-1">
|
|
375
|
+
<label htmlFor="target-cases" className="block font-medium">
|
|
376
|
+
Target number of cases
|
|
377
|
+
<InfoTip term="targetCases" id="target-cases" />
|
|
378
|
+
</label>
|
|
379
|
+
<input
|
|
380
|
+
id="target-cases"
|
|
381
|
+
name="targetCases"
|
|
382
|
+
type="number"
|
|
383
|
+
inputMode="numeric"
|
|
384
|
+
min={TARGET_CASES_RANGE.min}
|
|
385
|
+
max={TARGET_CASES_RANGE.max}
|
|
386
|
+
step={1}
|
|
387
|
+
placeholder={String(ownTarget)}
|
|
388
|
+
defaultValue={savedSettings.targetCases ?? ""}
|
|
389
|
+
className="w-32 rounded-md border border-line bg-card px-3 py-2 tabular-nums focus:border-accent focus:outline-none"
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
392
|
+
<fieldset className="space-y-3">
|
|
393
|
+
<legend className="font-medium">
|
|
394
|
+
Checks
|
|
395
|
+
<InfoTip term="checkLevels" id="check-levels" />
|
|
396
|
+
</legend>
|
|
397
|
+
<table className="w-full text-sm">
|
|
398
|
+
<thead className="text-left text-xs text-muted">
|
|
399
|
+
<tr>
|
|
400
|
+
<th className="pb-1 font-normal">
|
|
401
|
+
<span className="sr-only">Check</span>
|
|
402
|
+
</th>
|
|
403
|
+
<th className="pb-1 font-normal">Level</th>
|
|
404
|
+
<th className="pb-1 font-normal">Aim, %</th>
|
|
405
|
+
</tr>
|
|
406
|
+
</thead>
|
|
407
|
+
<tbody>
|
|
408
|
+
{own.checks.map((c) => {
|
|
409
|
+
const saved = savedSettings.checks[c.key];
|
|
410
|
+
return (
|
|
411
|
+
<tr key={c.key}>
|
|
412
|
+
<td className="py-1 pr-2">{c.label}</td>
|
|
413
|
+
<td className="py-1 pr-2">
|
|
414
|
+
<Select
|
|
415
|
+
name={`level:${c.key}`}
|
|
416
|
+
aria-label={`${c.label}: level`}
|
|
417
|
+
// Starts on its level now; the code's own isn't saved.
|
|
418
|
+
defaultValue={saved?.severity ?? c.severity}
|
|
419
|
+
className="rounded-md border border-line bg-card px-2 py-1.5 text-sm"
|
|
420
|
+
>
|
|
421
|
+
{SEVERITY_ORDER.map((l) => (
|
|
422
|
+
<option key={l} value={l}>
|
|
423
|
+
{SEVERITY_LABEL[l]}
|
|
424
|
+
</option>
|
|
425
|
+
))}
|
|
426
|
+
</Select>
|
|
427
|
+
</td>
|
|
428
|
+
<td className="py-1">
|
|
429
|
+
<input
|
|
430
|
+
name={`aim:${c.key}`}
|
|
431
|
+
aria-label={`${c.label}: aim`}
|
|
432
|
+
type="number"
|
|
433
|
+
inputMode="numeric"
|
|
434
|
+
min={1}
|
|
435
|
+
max={100}
|
|
436
|
+
step={1}
|
|
437
|
+
placeholder={String(Math.round(checkBar(c) * 100))}
|
|
438
|
+
defaultValue={
|
|
439
|
+
saved?.aim === undefined
|
|
440
|
+
? ""
|
|
441
|
+
: Math.round(saved.aim * 100)
|
|
442
|
+
}
|
|
443
|
+
className="w-16 rounded-md border border-line bg-card px-2 py-1.5 text-sm tabular-nums focus:border-accent focus:outline-none"
|
|
444
|
+
/>
|
|
445
|
+
</td>
|
|
446
|
+
</tr>
|
|
447
|
+
);
|
|
448
|
+
})}
|
|
449
|
+
</tbody>
|
|
450
|
+
</table>
|
|
451
|
+
</fieldset>
|
|
452
|
+
<Submit>Save</Submit>
|
|
453
|
+
</form>
|
|
203
454
|
);
|
|
204
455
|
}
|
|
205
456
|
|
|
457
|
+
/**
|
|
458
|
+
* What to do next on this suite, in order, each with why and the way to
|
|
459
|
+
* do it here. Each drops off once it's done; empty, the section says
|
|
460
|
+
* there's nothing to do. Not on an injection suite, whose models are
|
|
461
|
+
* chosen on its feature's page.
|
|
462
|
+
*/
|
|
463
|
+
export function TodoSection({ data }: { data: SuitePageData }) {
|
|
464
|
+
const { app, key, todos, choosesHere, status } = data;
|
|
465
|
+
if (!choosesHere) return null;
|
|
466
|
+
return (
|
|
467
|
+
<section aria-labelledby="todo" className="space-y-3">
|
|
468
|
+
<h2 id="todo" className="text-lg font-semibold">
|
|
469
|
+
To do
|
|
470
|
+
<InfoTip term="todo" />
|
|
471
|
+
</h2>
|
|
472
|
+
{todos.length === 0 ? (
|
|
473
|
+
<p className="readable text-sm text-muted">
|
|
474
|
+
{status === "unknown"
|
|
475
|
+
? "Nothing to do here yet."
|
|
476
|
+
: "Nothing to do: every must-pass check meets its aim, and the answer key is at its target."}
|
|
477
|
+
</p>
|
|
478
|
+
) : (
|
|
479
|
+
// Numbered: the list is in the order to do it. No checkbox: an item
|
|
480
|
+
// drops off on its own once it's done.
|
|
481
|
+
<ol className="divide-y divide-line rounded-lg border border-line bg-card">
|
|
482
|
+
{todos.map((t, n) => {
|
|
483
|
+
const { what, why } = todoText(t);
|
|
484
|
+
return (
|
|
485
|
+
<li
|
|
486
|
+
key={`${t.kind}-${t.kind === "fixCheck" ? t.check : ""}`}
|
|
487
|
+
className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2 px-4 py-3 text-sm"
|
|
488
|
+
>
|
|
489
|
+
<p className="readable flex min-w-0 items-start gap-2">
|
|
490
|
+
<span
|
|
491
|
+
aria-hidden
|
|
492
|
+
className="w-4 shrink-0 text-right tabular-nums text-muted"
|
|
493
|
+
>
|
|
494
|
+
{n + 1}.
|
|
495
|
+
</span>
|
|
496
|
+
<span>
|
|
497
|
+
<span className="font-medium">{what}</span>: {why}
|
|
498
|
+
</span>
|
|
499
|
+
</p>
|
|
500
|
+
<TodoAction app={app} suite={key} todo={t} />
|
|
501
|
+
</li>
|
|
502
|
+
);
|
|
503
|
+
})}
|
|
504
|
+
</ol>
|
|
505
|
+
)}
|
|
506
|
+
</section>
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Where a to-do item is done: a button for this page's action, or a link to its section. */
|
|
511
|
+
function TodoAction({
|
|
512
|
+
app,
|
|
513
|
+
suite,
|
|
514
|
+
todo: t,
|
|
515
|
+
}: {
|
|
516
|
+
app: EvalAppConfig;
|
|
517
|
+
suite: string;
|
|
518
|
+
todo: Todo;
|
|
519
|
+
}) {
|
|
520
|
+
// Links look like the buttons beside them: every item's action alike.
|
|
521
|
+
const go = (href: string, text: string) => (
|
|
522
|
+
<a
|
|
523
|
+
href={href}
|
|
524
|
+
className={`inline-flex shrink-0 items-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
525
|
+
>
|
|
526
|
+
{text}
|
|
527
|
+
</a>
|
|
528
|
+
);
|
|
529
|
+
const button = (
|
|
530
|
+
action: FormAction | undefined,
|
|
531
|
+
text: string,
|
|
532
|
+
fields: Record<string, string> = {},
|
|
533
|
+
) =>
|
|
534
|
+
action ? (
|
|
535
|
+
<form action={action} className="shrink-0">
|
|
536
|
+
<input type="hidden" name="suite" value={suite} />
|
|
537
|
+
{Object.entries(fields).map(([k, v]) => (
|
|
538
|
+
<input key={k} type="hidden" name={k} value={v} />
|
|
539
|
+
))}
|
|
540
|
+
<Submit variant="quiet">{text}</Submit>
|
|
541
|
+
</form>
|
|
542
|
+
) : null;
|
|
543
|
+
switch (t.kind) {
|
|
544
|
+
case "testAll":
|
|
545
|
+
return button(app.actions.testAll, "Test every model");
|
|
546
|
+
case "retest":
|
|
547
|
+
return button(app.actions.testAll, "Test every model again");
|
|
548
|
+
case "makeLive":
|
|
549
|
+
return button(app.actions.useSuggestion, "Use the suggestion");
|
|
550
|
+
case "fixCheck":
|
|
551
|
+
return t.runId
|
|
552
|
+
? go(
|
|
553
|
+
`${evalsPath(app, suite, "runs", t.runId)}#check-${t.check}`,
|
|
554
|
+
"See the cases",
|
|
555
|
+
)
|
|
556
|
+
: go("#checks", "See the check");
|
|
557
|
+
case "confirm":
|
|
558
|
+
return go("#answer-key", "Review them");
|
|
559
|
+
case "addCases":
|
|
560
|
+
return go("#add-case=", "Add a case");
|
|
561
|
+
case "makeAttacks":
|
|
562
|
+
return (
|
|
563
|
+
<span className="flex shrink-0 flex-wrap gap-2">
|
|
564
|
+
{t.suites.map((a) => (
|
|
565
|
+
<form key={a.key} action={app.actions.makeAttackCases}>
|
|
566
|
+
<input type="hidden" name="suite" value={a.key} />
|
|
567
|
+
<Submit variant="quiet">
|
|
568
|
+
{t.suites.length > 1 ? `Make ${a.label}` : "Make attack cases"}
|
|
569
|
+
</Submit>
|
|
570
|
+
</form>
|
|
571
|
+
))}
|
|
572
|
+
</span>
|
|
573
|
+
);
|
|
574
|
+
case "retireStarters":
|
|
575
|
+
return button(app.actions.retireReplacedStarters, `Retire ${t.cases}`);
|
|
576
|
+
case "reviewSplit":
|
|
577
|
+
return go("#answer-key-health", "Review them");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
206
581
|
/** On an injection suite: models are chosen on its base suite, with a link there. */
|
|
207
582
|
export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
208
583
|
const { app, suite } = data;
|
|
@@ -218,7 +593,7 @@ export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
|
218
593
|
This suite tests the same feature as {suite.base.label}, so one
|
|
219
594
|
choice of model serves both. Its results show there as Attacks
|
|
220
595
|
resisted, and the suggestion there never picks a model with more
|
|
221
|
-
|
|
596
|
+
must-pass misses on them than live.
|
|
222
597
|
</p>
|
|
223
598
|
<Link
|
|
224
599
|
href={evalsPath(app, suite.base.key)}
|
|
@@ -234,7 +609,7 @@ export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
|
234
609
|
|
|
235
610
|
/** Which models to make live and the fallback, and why; shown when nothing would change too. */
|
|
236
611
|
export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
237
|
-
const {
|
|
612
|
+
const { s, choosesHere, testing } = data;
|
|
238
613
|
if (choosesHere && testing)
|
|
239
614
|
return (
|
|
240
615
|
<section className="space-y-3" aria-labelledby="suggestion">
|
|
@@ -262,14 +637,7 @@ export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
|
262
637
|
{s.same ? "No change suggested" : "Suggested"}
|
|
263
638
|
<InfoTip term="suggestion" />
|
|
264
639
|
</h2>
|
|
265
|
-
{/*
|
|
266
|
-
{!s.same &&
|
|
267
|
-
!(s.retestLive && (!s.fallback || s.fallback.fallback)) && (
|
|
268
|
-
<form action={app.actions.useSuggestion}>
|
|
269
|
-
<input type="hidden" name="suite" value={key} />
|
|
270
|
-
<Submit>Use these</Submit>
|
|
271
|
-
</form>
|
|
272
|
-
)}
|
|
640
|
+
{/* The to-do list above is where to act on it; this says why. */}
|
|
273
641
|
</div>
|
|
274
642
|
<Card className="space-y-3">
|
|
275
643
|
{!s.same && (
|
|
@@ -349,10 +717,12 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
349
717
|
const columns = 7 + (showAttacks ? 1 : 0) + (suite.decisions ? 2 : 0);
|
|
350
718
|
return (
|
|
351
719
|
<>
|
|
352
|
-
<section className="space-y-3">
|
|
720
|
+
<section className="space-y-3" aria-labelledby="models">
|
|
353
721
|
<div className="flex items-center justify-between gap-4">
|
|
354
722
|
<div className="flex flex-wrap items-center gap-2">
|
|
355
|
-
<h2 className="text-lg font-semibold">
|
|
723
|
+
<h2 id="models" className="text-lg font-semibold">
|
|
724
|
+
Models
|
|
725
|
+
</h2>
|
|
356
726
|
{/* Why this priority, in its words: the page says it once. */}
|
|
357
727
|
{choosesHere && app.actions.setPriority ? (
|
|
358
728
|
<PriorityPicker
|
|
@@ -388,7 +758,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
388
758
|
</th>
|
|
389
759
|
<th className="p-3 font-normal">
|
|
390
760
|
<Tip term="seriousMistakes" side="bottom">
|
|
391
|
-
|
|
761
|
+
Must-pass misses
|
|
392
762
|
</Tip>
|
|
393
763
|
</th>
|
|
394
764
|
{showAttacks && (
|
|
@@ -704,16 +1074,16 @@ export function TestSettingSection(_props: { data: SuitePageData }) {
|
|
|
704
1074
|
return null;
|
|
705
1075
|
}
|
|
706
1076
|
|
|
1077
|
+
// From the app's color names, so its evalkeeper.css decides both themes.
|
|
707
1078
|
const BAR_TONE = {
|
|
708
|
-
meets:
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
below: "bg-red-100 text-red-900 dark:bg-red-500/15 dark:text-red-200",
|
|
1079
|
+
meets: TINT.good,
|
|
1080
|
+
close: TINT.warn,
|
|
1081
|
+
below: TINT.bad,
|
|
712
1082
|
} as const;
|
|
713
1083
|
|
|
714
1084
|
/**
|
|
715
1085
|
* Where the mistakes are: how often each check passed, for every model
|
|
716
|
-
* with a current test, beside each check's
|
|
1086
|
+
* with a current test, beside each check's aim. Must-pass checks first. The
|
|
717
1087
|
* checks section shows the live model alone; this shows which model fails
|
|
718
1088
|
* which check.
|
|
719
1089
|
*/
|
|
@@ -722,7 +1092,8 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
722
1092
|
const tested = rows.filter((r) => r.test && !r.test.stale);
|
|
723
1093
|
if (!tested.length) return null;
|
|
724
1094
|
const checks = [...suite.checks].sort(
|
|
725
|
-
(a, b) =>
|
|
1095
|
+
(a, b) =>
|
|
1096
|
+
SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity),
|
|
726
1097
|
);
|
|
727
1098
|
return (
|
|
728
1099
|
<section aria-labelledby="check-breakdown" className="space-y-3">
|
|
@@ -734,9 +1105,9 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
734
1105
|
<p className="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs">
|
|
735
1106
|
{(
|
|
736
1107
|
[
|
|
737
|
-
["meets", "Meets
|
|
738
|
-
["close", "Within 10 points"],
|
|
739
|
-
["below", "Further
|
|
1108
|
+
["meets", "Meets its aim"],
|
|
1109
|
+
["close", "Within 10 points of it"],
|
|
1110
|
+
["below", "Further off"],
|
|
740
1111
|
] as const
|
|
741
1112
|
).map(([k, text]) => (
|
|
742
1113
|
<span key={k} className="flex items-center gap-1.5">
|
|
@@ -750,7 +1121,11 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
750
1121
|
<thead className="text-xs text-muted">
|
|
751
1122
|
<tr>
|
|
752
1123
|
<th className="py-2 pr-4 font-normal">Check</th>
|
|
753
|
-
<th className="py-2 pr-4 font-normal">
|
|
1124
|
+
<th className="py-2 pr-4 font-normal">
|
|
1125
|
+
<Tip term="aim" side="bottom" id="breakdown-aim">
|
|
1126
|
+
Aim
|
|
1127
|
+
</Tip>
|
|
1128
|
+
</th>
|
|
754
1129
|
{tested.map((r) => (
|
|
755
1130
|
<th key={r.key} className="py-2 pr-3 font-normal">
|
|
756
1131
|
{r.label}
|
|
@@ -763,11 +1138,7 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
763
1138
|
<tr key={c.key}>
|
|
764
1139
|
<td className="py-1.5 pr-4">
|
|
765
1140
|
<span className="mr-2">{c.label}</span>
|
|
766
|
-
<
|
|
767
|
-
tone={c.severity === "serious" ? "serious" : "neutral"}
|
|
768
|
-
>
|
|
769
|
-
{c.severity}
|
|
770
|
-
</Chip>
|
|
1141
|
+
<SeverityChip severity={c.severity} />
|
|
771
1142
|
</td>
|
|
772
1143
|
<td className="py-1.5 pr-4 tabular-nums text-muted">
|
|
773
1144
|
{pct(checkBar(c))}
|
|
@@ -792,11 +1163,27 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
792
1163
|
</tr>
|
|
793
1164
|
))}
|
|
794
1165
|
<tr>
|
|
795
|
-
<td className="py-1.5 pr-4">
|
|
796
|
-
|
|
1166
|
+
<td className="py-1.5 pr-4">
|
|
1167
|
+
Answers with no mistakes at all (
|
|
1168
|
+
{Math.max(...tested.map((r) => r.test?.answers ?? 0))}{" "}
|
|
1169
|
+
answers)
|
|
1170
|
+
</td>
|
|
1171
|
+
{/* Every answer right is the aim: one mistake is one too many. */}
|
|
1172
|
+
<td className="py-1.5 pr-4 tabular-nums text-muted">
|
|
1173
|
+
{pct(1)}
|
|
1174
|
+
</td>
|
|
797
1175
|
{tested.map((r) => (
|
|
798
|
-
<td key={r.key} className="py-1
|
|
799
|
-
{r.test?.
|
|
1176
|
+
<td key={r.key} className="py-1 pr-2">
|
|
1177
|
+
{r.test?.answers ? (
|
|
1178
|
+
<span
|
|
1179
|
+
title={`${r.test.answersRight} of ${r.test.answers} answers`}
|
|
1180
|
+
className={`inline-block rounded px-2 py-0.5 tabular-nums ${BAR_TONE[barStatus(r.test.answersRight / r.test.answers, 1)]}`}
|
|
1181
|
+
>
|
|
1182
|
+
{pct(r.test.answersRight / r.test.answers)}
|
|
1183
|
+
</span>
|
|
1184
|
+
) : (
|
|
1185
|
+
<span className="text-muted">–</span>
|
|
1186
|
+
)}
|
|
800
1187
|
</td>
|
|
801
1188
|
))}
|
|
802
1189
|
</tr>
|
|
@@ -809,10 +1196,25 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
809
1196
|
}
|
|
810
1197
|
/** The feature's settings history, with rollback; not on an injection suite. */
|
|
811
1198
|
export function Versions({ data }: { data: SuitePageData }) {
|
|
812
|
-
const { app, key, history, liveSettings, choosesHere } = data;
|
|
1199
|
+
const { app, key, history, liveSettings, choosesHere, suite } = data;
|
|
1200
|
+
if (choosesHere && !liveSettings)
|
|
1201
|
+
return (
|
|
1202
|
+
<Card className="space-y-2">
|
|
1203
|
+
<h2 className="font-semibold">
|
|
1204
|
+
No settings yet
|
|
1205
|
+
<InfoTip term="versions" />
|
|
1206
|
+
</h2>
|
|
1207
|
+
<p className="readable text-sm text-muted">
|
|
1208
|
+
{suite.label} has no settings version yet, and no default in code, so
|
|
1209
|
+
nothing says which model it runs on. Record its first version (
|
|
1210
|
+
<code>settings.seed</code> or <code>settings.change</code>), or give
|
|
1211
|
+
it a default in your wiring. Tests still run.
|
|
1212
|
+
</p>
|
|
1213
|
+
</Card>
|
|
1214
|
+
);
|
|
813
1215
|
return (
|
|
814
1216
|
<>
|
|
815
|
-
{choosesHere && (
|
|
1217
|
+
{choosesHere && liveSettings && (
|
|
816
1218
|
<SettingsHistory
|
|
817
1219
|
app={app}
|
|
818
1220
|
suite={key}
|
|
@@ -826,33 +1228,28 @@ export function Versions({ data }: { data: SuitePageData }) {
|
|
|
826
1228
|
);
|
|
827
1229
|
}
|
|
828
1230
|
|
|
829
|
-
/** Each check: what it checks,
|
|
1231
|
+
/** Each check: what it checks, must pass or nice to have, its aim, and how the live model does. */
|
|
830
1232
|
export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
831
1233
|
const { suite, live } = data;
|
|
832
1234
|
return (
|
|
833
1235
|
<>
|
|
834
|
-
<section className="space-y-3">
|
|
1236
|
+
<section id="checks" className="scroll-mt-4 space-y-3">
|
|
835
1237
|
<h2 className="text-lg font-semibold">
|
|
836
1238
|
Checks
|
|
837
1239
|
<InfoTip term="checks" />
|
|
838
1240
|
</h2>
|
|
839
1241
|
<div className="grid gap-3 md:grid-cols-2">
|
|
840
|
-
{/*
|
|
841
|
-
{
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
].map((c) => {
|
|
1242
|
+
{/* Must pass first; each group keeps the suite's own order. */}
|
|
1243
|
+
{SEVERITY_ORDER.flatMap((level) =>
|
|
1244
|
+
suite.checks.filter((c) => c.severity === level),
|
|
1245
|
+
).map((c) => {
|
|
845
1246
|
const rate = live?.test?.byCheck[c.key];
|
|
846
1247
|
return (
|
|
847
1248
|
<Card key={c.key} className="space-y-1">
|
|
848
1249
|
<div className="flex justify-between gap-4">
|
|
849
1250
|
<h3 className="font-medium">{c.label}</h3>
|
|
850
|
-
<Tip term={c.severity} id={`severity-${c.key}`}>
|
|
851
|
-
<
|
|
852
|
-
tone={c.severity === "serious" ? "serious" : "neutral"}
|
|
853
|
-
>
|
|
854
|
-
{c.severity}
|
|
855
|
-
</Chip>
|
|
1251
|
+
<Tip term={c.severity} id={`severity-${c.key}`} align="end">
|
|
1252
|
+
<SeverityChip severity={c.severity} />
|
|
856
1253
|
</Tip>
|
|
857
1254
|
</div>
|
|
858
1255
|
<p className="readable text-sm text-muted">{c.description}</p>
|
|
@@ -872,8 +1269,8 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
|
872
1269
|
({rate.passed}/{rate.n}) ·{" "}
|
|
873
1270
|
</>
|
|
874
1271
|
)}
|
|
875
|
-
<Tip term="
|
|
876
|
-
<span className="text-muted">
|
|
1272
|
+
<Tip term="aim" id={`aim-${c.key}`}>
|
|
1273
|
+
<span className="text-muted">Aim: {pct(checkBar(c))}</span>
|
|
877
1274
|
</Tip>
|
|
878
1275
|
</p>
|
|
879
1276
|
</Card>
|
|
@@ -893,11 +1290,22 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
|
893
1290
|
* passes its action.
|
|
894
1291
|
*/
|
|
895
1292
|
export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
896
|
-
const { app, key, suite, cases } = data;
|
|
1293
|
+
const { app, key, suite, cases, replaced } = data;
|
|
897
1294
|
const { actions } = app;
|
|
898
1295
|
const inUse = cases.filter((c) => c.status !== "RETIRED");
|
|
899
1296
|
const drafts = draftAnswers(cases);
|
|
900
1297
|
const fresh = newStarters(suite.starter, cases);
|
|
1298
|
+
// New starters named like a case they replace: said up front, so nobody
|
|
1299
|
+
// retires the wrong one of two cases with the same title.
|
|
1300
|
+
const titleOf = (input: unknown) => {
|
|
1301
|
+
const p = suite.input.safeParse(input);
|
|
1302
|
+
return p.success ? suite.title(p.data) : null;
|
|
1303
|
+
};
|
|
1304
|
+
const oldTitles = new Set(replaced.map((c) => titleOf(c.input)));
|
|
1305
|
+
const sameTitle = fresh.filter((c) => {
|
|
1306
|
+
const t = titleOf(c.input);
|
|
1307
|
+
return t !== null && oldTitles.has(t);
|
|
1308
|
+
}).length;
|
|
901
1309
|
const injection = isInjectionSuite(suite) ? suite : null;
|
|
902
1310
|
const parts = [
|
|
903
1311
|
actions.useDraftsProvisionally && drafts.length > 0 && (
|
|
@@ -940,6 +1348,8 @@ export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
|
940
1348
|
: `No cases yet. Start with the suite's ${fresh.length} starter ${fresh.length === 1 ? "case" : "cases"}.`}{" "}
|
|
941
1349
|
Each needs your review and counts only once you confirm it, unless the
|
|
942
1350
|
suite's author already reviewed it.
|
|
1351
|
+
{sameTitle > 0 &&
|
|
1352
|
+
` ${sameTitle === 1 ? "One shares its title" : `${sameTitle} share their titles`} with a starter case ${sameTitle === 1 ? "it replaces" : "they replace"}: the old ${sameTitle === 1 ? "one is" : "ones are"} marked No longer a starter in the answer key.`}
|
|
943
1353
|
</p>
|
|
944
1354
|
<form action={actions.addStarters}>
|
|
945
1355
|
<input type="hidden" name="suite" value={key} />
|
|
@@ -1055,21 +1465,31 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1055
1465
|
suite={a.suite}
|
|
1056
1466
|
rows={a.rows}
|
|
1057
1467
|
heading={
|
|
1058
|
-
<
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1468
|
+
<h2 className="text-lg font-semibold">
|
|
1469
|
+
Attack cases ({a.cases} in use)
|
|
1470
|
+
<InfoTip
|
|
1471
|
+
term="attackCases"
|
|
1472
|
+
id={`attack-${a.suite.key}`}
|
|
1473
|
+
/>
|
|
1474
|
+
</h2>
|
|
1064
1475
|
}
|
|
1065
1476
|
tools={
|
|
1066
1477
|
<>
|
|
1067
|
-
<
|
|
1068
|
-
|
|
1069
|
-
|
|
1478
|
+
<Tip
|
|
1479
|
+
control
|
|
1480
|
+
term="addAttack"
|
|
1481
|
+
id={`add-attack-${a.suite.key}`}
|
|
1482
|
+
side="bottom"
|
|
1483
|
+
align="end"
|
|
1070
1484
|
>
|
|
1071
|
-
|
|
1072
|
-
|
|
1485
|
+
<a
|
|
1486
|
+
href="https://seanhudson.github.io/evalkeeper/guides/suites/#more-attacks"
|
|
1487
|
+
className={`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
1488
|
+
>
|
|
1489
|
+
<Plus aria-hidden className="h-4 w-4" />
|
|
1490
|
+
Add an attack
|
|
1491
|
+
</a>
|
|
1492
|
+
</Tip>
|
|
1073
1493
|
{app.actions.makeAttackCases && (
|
|
1074
1494
|
<form action={app.actions.makeAttackCases}>
|
|
1075
1495
|
<input
|
|
@@ -1077,7 +1497,20 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1077
1497
|
name="suite"
|
|
1078
1498
|
value={a.suite.key}
|
|
1079
1499
|
/>
|
|
1080
|
-
<
|
|
1500
|
+
<Tip
|
|
1501
|
+
control
|
|
1502
|
+
term="updateAttackCases"
|
|
1503
|
+
id={`update-attacks-${a.suite.key}`}
|
|
1504
|
+
side="bottom"
|
|
1505
|
+
align="end"
|
|
1506
|
+
>
|
|
1507
|
+
<IconSubmit
|
|
1508
|
+
label="Update attack cases"
|
|
1509
|
+
icon={
|
|
1510
|
+
<RotateCw aria-hidden className="h-4 w-4" />
|
|
1511
|
+
}
|
|
1512
|
+
/>
|
|
1513
|
+
</Tip>
|
|
1081
1514
|
</form>
|
|
1082
1515
|
)}
|
|
1083
1516
|
</>
|
|
@@ -1169,13 +1602,14 @@ function UnderAttack({
|
|
|
1169
1602
|
}
|
|
1170
1603
|
|
|
1171
1604
|
/**
|
|
1172
|
-
* Keeping the answer key useful: easy cases to retire (
|
|
1605
|
+
* Keeping the answer key useful: easy cases to retire (past the suite's
|
|
1606
|
+
* target number of cases),
|
|
1173
1607
|
* cases models split on and near-duplicates to check, old drafts, and
|
|
1174
1608
|
* tags with a single case. Shows only what needs a look, and nothing on
|
|
1175
1609
|
* an injection suite, whose cases are made from its base suite's.
|
|
1176
1610
|
*/
|
|
1177
1611
|
export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
1178
|
-
const { app, key, suite, health: h, choosesHere, splitBy } = data;
|
|
1612
|
+
const { app, key, suite, health: h, choosesHere, splitBy, target } = data;
|
|
1179
1613
|
const thin = h.tags.filter(([, n]) => n === 1).map(([t]) => t);
|
|
1180
1614
|
const needs =
|
|
1181
1615
|
h.easyToRetire.length ||
|
|
@@ -1201,7 +1635,7 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1201
1635
|
const retire = h.easyToRetire.length > 0 || h.staleDrafts.length > 0;
|
|
1202
1636
|
return (
|
|
1203
1637
|
<section className="space-y-3" aria-labelledby="answer-key-health">
|
|
1204
|
-
<h2 id="answer-key-health" className="text-lg font-semibold">
|
|
1638
|
+
<h2 id="answer-key-health" className="scroll-mt-4 text-lg font-semibold">
|
|
1205
1639
|
Answer key health
|
|
1206
1640
|
<InfoTip term="answerKeyHealth" />
|
|
1207
1641
|
</h2>
|
|
@@ -1227,11 +1661,15 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1227
1661
|
const names = (xs: string[]) =>
|
|
1228
1662
|
new Intl.ListFormat("en-US").format(xs);
|
|
1229
1663
|
return (
|
|
1664
|
+
// The tint spans the panel; the words keep their
|
|
1665
|
+
// readable width inside it.
|
|
1230
1666
|
<li
|
|
1231
1667
|
key={c.id}
|
|
1232
|
-
className="space-y-2 rounded-md bg-tint p-3"
|
|
1668
|
+
className="w-full space-y-2 rounded-md bg-tint p-3"
|
|
1233
1669
|
>
|
|
1234
|
-
<div className="font-medium">
|
|
1670
|
+
<div className="readable font-medium">
|
|
1671
|
+
{caseLink(c)}
|
|
1672
|
+
</div>
|
|
1235
1673
|
{by && (
|
|
1236
1674
|
<p className="readable text-xs text-muted">
|
|
1237
1675
|
{by.right.length > 0 &&
|
|
@@ -1296,18 +1734,35 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1296
1734
|
or two to each.
|
|
1297
1735
|
<InfoTip term="tagCoverage" />
|
|
1298
1736
|
</p>
|
|
1737
|
+
{!(draftMore && suite.draftMore) && (
|
|
1738
|
+
<p className="readable text-muted">
|
|
1739
|
+
Pick a topic to open Add a case with it filled in.
|
|
1740
|
+
</p>
|
|
1741
|
+
)}
|
|
1299
1742
|
{draftMore && suite.draftMore ? (
|
|
1300
1743
|
<form action={draftMore} className="space-y-2">
|
|
1301
1744
|
<input type="hidden" name="suite" value={key} />
|
|
1302
1745
|
<ul className="flex flex-wrap gap-1.5">
|
|
1303
1746
|
{thin.map((t) => (
|
|
1304
1747
|
<li key={t}>
|
|
1305
|
-
|
|
1748
|
+
{/* A chip like the + ones, that toggles: the box
|
|
1749
|
+
itself stays hidden, and a ✓ shows it's picked. */}
|
|
1750
|
+
<label
|
|
1751
|
+
className={`inline-flex cursor-pointer items-center gap-1 rounded-full px-2 py-0.5 text-xs hover:underline ${TINT.warn} has-[:checked]:bg-warn/40 has-[:checked]:font-medium has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-accent`}
|
|
1752
|
+
>
|
|
1306
1753
|
<input
|
|
1307
1754
|
type="checkbox"
|
|
1308
1755
|
name="topic"
|
|
1309
1756
|
value={t}
|
|
1310
|
-
className="
|
|
1757
|
+
className="peer sr-only"
|
|
1758
|
+
/>
|
|
1759
|
+
<Plus
|
|
1760
|
+
aria-hidden
|
|
1761
|
+
className="h-3 w-3 peer-checked:hidden"
|
|
1762
|
+
/>
|
|
1763
|
+
<Check
|
|
1764
|
+
aria-hidden
|
|
1765
|
+
className="hidden h-3 w-3 peer-checked:inline"
|
|
1311
1766
|
/>
|
|
1312
1767
|
{t}
|
|
1313
1768
|
</label>
|
|
@@ -1323,40 +1778,27 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1323
1778
|
</p>
|
|
1324
1779
|
</form>
|
|
1325
1780
|
) : (
|
|
1326
|
-
<
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
<
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
</a>
|
|
1340
|
-
</li>
|
|
1341
|
-
))}
|
|
1342
|
-
</ul>
|
|
1343
|
-
<a
|
|
1344
|
-
href="#add-case="
|
|
1345
|
-
className={`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
1346
|
-
>
|
|
1347
|
-
<Plus aria-hidden className="h-4 w-4" />
|
|
1348
|
-
Add a case
|
|
1349
|
-
</a>
|
|
1350
|
-
</div>
|
|
1351
|
-
<p className="readable text-xs text-muted">
|
|
1352
|
-
A suite with <code>draftMore</code> drafts whole cases for the
|
|
1353
|
-
topics you pick instead.
|
|
1354
|
-
</p>
|
|
1355
|
-
</div>
|
|
1781
|
+
<ul className="flex flex-wrap gap-1.5">
|
|
1782
|
+
{thin.map((t) => (
|
|
1783
|
+
<li key={t}>
|
|
1784
|
+
<a
|
|
1785
|
+
href={`#add-case=${encodeURIComponent(t)}`}
|
|
1786
|
+
className={`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs hover:underline ${TINT.warn}`}
|
|
1787
|
+
>
|
|
1788
|
+
<Plus aria-hidden className="h-3 w-3" />
|
|
1789
|
+
{t}
|
|
1790
|
+
</a>
|
|
1791
|
+
</li>
|
|
1792
|
+
))}
|
|
1793
|
+
</ul>
|
|
1356
1794
|
)}
|
|
1357
1795
|
<details className="group">
|
|
1358
|
-
<summary className="cursor-pointer text-muted">
|
|
1359
|
-
|
|
1796
|
+
<summary className="flex cursor-pointer list-none items-center gap-1 text-xs text-muted [&::-webkit-details-marker]:hidden">
|
|
1797
|
+
<ChevronRight
|
|
1798
|
+
aria-hidden
|
|
1799
|
+
className="h-3.5 w-3.5 transition-transform group-open:rotate-90"
|
|
1800
|
+
/>
|
|
1801
|
+
Every topic and its cases
|
|
1360
1802
|
</summary>
|
|
1361
1803
|
<ul className="mt-2 flex flex-wrap gap-1.5">
|
|
1362
1804
|
{h.tags.map(([t, n]) => (
|
|
@@ -1376,12 +1818,12 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1376
1818
|
{h.easyToRetire.length > 0 && (
|
|
1377
1819
|
<div className="space-y-2">
|
|
1378
1820
|
<p>
|
|
1379
|
-
Every
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
{h.
|
|
1383
|
-
|
|
1384
|
-
|
|
1821
|
+
Every model got {cases(h.easyToRetire.length)} fully right in{" "}
|
|
1822
|
+
{EASY_MIN_ROUNDS} or more rounds of testing, so they no longer
|
|
1823
|
+
tell models apart. Retiring them keeps{" "}
|
|
1824
|
+
{h.inUse - h.easyToRetire.length} cases, at or above the
|
|
1825
|
+
suite's target of {target}. Recent tests are rescored for
|
|
1826
|
+
free.
|
|
1385
1827
|
<InfoTip term="easyCases" />
|
|
1386
1828
|
</p>
|
|
1387
1829
|
{retireEasy && (
|
|
@@ -1438,6 +1880,7 @@ export async function SuitePage({
|
|
|
1438
1880
|
<div className="space-y-8">
|
|
1439
1881
|
<RefreshWhile active={data.testing} />
|
|
1440
1882
|
<SuiteHeader data={data} />
|
|
1883
|
+
<TodoSection data={data} />
|
|
1441
1884
|
<ChosenOnBase data={data} />
|
|
1442
1885
|
<SuggestionCard data={data} />
|
|
1443
1886
|
<CasesInInstructions data={data} />
|