@crowandraven/evalkeeper 0.18.0 → 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 +5 -2
- package/dist/prune.js +7 -4
- 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 +31 -18
- 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 +25 -6
- package/dist/react/SuiteSections.js +233 -75
- 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 +15 -1
- package/dist/runner.js +89 -13
- 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 +40 -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 +7 -2
- 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 +579 -175
- 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 +122 -12
- 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 +57 -9
- package/starter/index.ts +7 -0
- package/templates/lib/evalkeeper/actions.ts +20 -0
|
@@ -22,8 +22,17 @@ import {
|
|
|
22
22
|
seriousMistakes,
|
|
23
23
|
suggest,
|
|
24
24
|
withRounds,
|
|
25
|
-
EASY_FLOOR_CASES,
|
|
26
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,
|
|
27
36
|
} from "../index.js";
|
|
28
37
|
import { AnswerKey } from "./AnswerKey.js";
|
|
29
38
|
import { ModelMenu } from "./ModelMenu.js";
|
|
@@ -38,6 +47,8 @@ import {
|
|
|
38
47
|
Card,
|
|
39
48
|
RefreshWhile,
|
|
40
49
|
Chip,
|
|
50
|
+
SeverityChip,
|
|
51
|
+
SuiteStatusBadge,
|
|
41
52
|
IconSubmit,
|
|
42
53
|
InfoTip,
|
|
43
54
|
Score,
|
|
@@ -46,9 +57,24 @@ import {
|
|
|
46
57
|
Submit,
|
|
47
58
|
Tip,
|
|
48
59
|
} from "./pieces.js";
|
|
49
|
-
import { pct, LINK, QUIET_BUTTON } from "./format.js";
|
|
50
|
-
import {
|
|
51
|
-
|
|
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";
|
|
52
78
|
import { SettingsHistory } from "./SettingsHistory.js";
|
|
53
79
|
|
|
54
80
|
/**
|
|
@@ -62,31 +88,41 @@ import { SettingsHistory } from "./SettingsHistory.js";
|
|
|
62
88
|
export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
63
89
|
const operation = app.suiteByKey[key]?.operation;
|
|
64
90
|
if (!operation) return null;
|
|
65
|
-
const [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
+
]);
|
|
84
119
|
const { suite, rows } = b;
|
|
85
120
|
const attacks = attacksFrom(attackBoards);
|
|
86
121
|
// An injection suite's models are chosen on its base suite's page.
|
|
87
122
|
const choosesHere = !isInjectionSuite(suite);
|
|
88
123
|
// The suite's priority, or the one an admin chose in its settings.
|
|
89
|
-
const priority = priorityOf(suite, liveSettings
|
|
124
|
+
const priority = priorityOf(suite, liveSettings?.settings);
|
|
125
|
+
const target = targetCasesOf(suite, savedSettings);
|
|
90
126
|
const testing =
|
|
91
127
|
rows.some((r) => r.testing) ||
|
|
92
128
|
attackBoards.some((a) => a.rows.some((r) => r.testing));
|
|
@@ -121,31 +157,84 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
121
157
|
null,
|
|
122
158
|
);
|
|
123
159
|
// Rounds each case passed (read only past the floor of cases).
|
|
124
|
-
const rounds = await app.runner.easyRounds(key, cases);
|
|
160
|
+
const rounds = await app.runner.easyRounds(key, cases, target);
|
|
125
161
|
const health = answerKeyHealth(
|
|
126
162
|
cases,
|
|
127
163
|
withRounds(b.caseResults, rounds),
|
|
128
164
|
new Date(),
|
|
129
165
|
testedAt,
|
|
166
|
+
target,
|
|
130
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
|
+
};
|
|
131
186
|
// For each split case, which models got it fully right and which didn't,
|
|
132
187
|
// so a person sees the disagreement before deciding.
|
|
133
188
|
const split = new Set(health.split.map((c) => c.id));
|
|
134
189
|
const splitBy: Record<string, { right: string[]; wrong: string[] }> = {};
|
|
135
|
-
|
|
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)
|
|
136
201
|
await Promise.all(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
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)) {
|
|
143
207
|
const side = allPassed(o.scores) ? "right" : "wrong";
|
|
144
208
|
const entry = (splitBy[o.caseId] ??= { right: [], wrong: [] });
|
|
145
209
|
if (!entry[side].includes(r.label)) entry[side].push(r.label);
|
|
146
210
|
}
|
|
147
|
-
|
|
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
|
+
}),
|
|
148
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;
|
|
149
238
|
|
|
150
239
|
return {
|
|
151
240
|
app,
|
|
@@ -169,6 +258,12 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
169
258
|
cases,
|
|
170
259
|
priority,
|
|
171
260
|
splitBy,
|
|
261
|
+
target,
|
|
262
|
+
savedSettings,
|
|
263
|
+
spending,
|
|
264
|
+
todos,
|
|
265
|
+
status,
|
|
266
|
+
replaced,
|
|
172
267
|
};
|
|
173
268
|
}
|
|
174
269
|
|
|
@@ -193,26 +288,296 @@ const whyFavor = (favor: SuitePriority["favor"]) => {
|
|
|
193
288
|
const FAVORS = { cost: "cost", speed: "speed", quality: "accuracy" } as const;
|
|
194
289
|
|
|
195
290
|
const VS: Record<string, string> = {
|
|
196
|
-
BETTER: "
|
|
197
|
-
SAME: "
|
|
198
|
-
WORSE: "
|
|
199
|
-
TOO_FEW: "
|
|
291
|
+
BETTER: "Better",
|
|
292
|
+
SAME: "Similar",
|
|
293
|
+
WORSE: "Worse",
|
|
294
|
+
TOO_FEW: "Can't tell",
|
|
200
295
|
};
|
|
201
296
|
|
|
202
|
-
/**
|
|
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
|
+
*/
|
|
203
301
|
export function SuiteHeader({ data }: { data: SuitePageData }) {
|
|
204
|
-
const { app, suite } = data;
|
|
302
|
+
const { app, suite, status } = data;
|
|
205
303
|
return (
|
|
206
|
-
|
|
304
|
+
<div className="space-y-4">
|
|
207
305
|
<div className="space-y-2">
|
|
208
306
|
<BackLink href={app.basePath}>Evals</BackLink>
|
|
209
|
-
<
|
|
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>
|
|
210
319
|
<p className="readable text-muted">{suite.description}</p>
|
|
211
320
|
</div>
|
|
212
|
-
|
|
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>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
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>
|
|
213
507
|
);
|
|
214
508
|
}
|
|
215
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
|
+
|
|
216
581
|
/** On an injection suite: models are chosen on its base suite, with a link there. */
|
|
217
582
|
export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
218
583
|
const { app, suite } = data;
|
|
@@ -228,7 +593,7 @@ export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
|
228
593
|
This suite tests the same feature as {suite.base.label}, so one
|
|
229
594
|
choice of model serves both. Its results show there as Attacks
|
|
230
595
|
resisted, and the suggestion there never picks a model with more
|
|
231
|
-
|
|
596
|
+
must-pass misses on them than live.
|
|
232
597
|
</p>
|
|
233
598
|
<Link
|
|
234
599
|
href={evalsPath(app, suite.base.key)}
|
|
@@ -244,7 +609,7 @@ export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
|
244
609
|
|
|
245
610
|
/** Which models to make live and the fallback, and why; shown when nothing would change too. */
|
|
246
611
|
export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
247
|
-
const {
|
|
612
|
+
const { s, choosesHere, testing } = data;
|
|
248
613
|
if (choosesHere && testing)
|
|
249
614
|
return (
|
|
250
615
|
<section className="space-y-3" aria-labelledby="suggestion">
|
|
@@ -272,14 +637,7 @@ export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
|
272
637
|
{s.same ? "No change suggested" : "Suggested"}
|
|
273
638
|
<InfoTip term="suggestion" />
|
|
274
639
|
</h2>
|
|
275
|
-
{/*
|
|
276
|
-
{!s.same &&
|
|
277
|
-
!(s.retestLive && (!s.fallback || s.fallback.fallback)) && (
|
|
278
|
-
<form action={app.actions.useSuggestion}>
|
|
279
|
-
<input type="hidden" name="suite" value={key} />
|
|
280
|
-
<Submit>Use these</Submit>
|
|
281
|
-
</form>
|
|
282
|
-
)}
|
|
640
|
+
{/* The to-do list above is where to act on it; this says why. */}
|
|
283
641
|
</div>
|
|
284
642
|
<Card className="space-y-3">
|
|
285
643
|
{!s.same && (
|
|
@@ -359,10 +717,12 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
359
717
|
const columns = 7 + (showAttacks ? 1 : 0) + (suite.decisions ? 2 : 0);
|
|
360
718
|
return (
|
|
361
719
|
<>
|
|
362
|
-
<section className="space-y-3">
|
|
720
|
+
<section className="space-y-3" aria-labelledby="models">
|
|
363
721
|
<div className="flex items-center justify-between gap-4">
|
|
364
722
|
<div className="flex flex-wrap items-center gap-2">
|
|
365
|
-
<h2 className="text-lg font-semibold">
|
|
723
|
+
<h2 id="models" className="text-lg font-semibold">
|
|
724
|
+
Models
|
|
725
|
+
</h2>
|
|
366
726
|
{/* Why this priority, in its words: the page says it once. */}
|
|
367
727
|
{choosesHere && app.actions.setPriority ? (
|
|
368
728
|
<PriorityPicker
|
|
@@ -398,7 +758,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
398
758
|
</th>
|
|
399
759
|
<th className="p-3 font-normal">
|
|
400
760
|
<Tip term="seriousMistakes" side="bottom">
|
|
401
|
-
|
|
761
|
+
Must-pass misses
|
|
402
762
|
</Tip>
|
|
403
763
|
</th>
|
|
404
764
|
{showAttacks && (
|
|
@@ -714,16 +1074,16 @@ export function TestSettingSection(_props: { data: SuitePageData }) {
|
|
|
714
1074
|
return null;
|
|
715
1075
|
}
|
|
716
1076
|
|
|
1077
|
+
// From the app's color names, so its evalkeeper.css decides both themes.
|
|
717
1078
|
const BAR_TONE = {
|
|
718
|
-
meets:
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
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,
|
|
722
1082
|
} as const;
|
|
723
1083
|
|
|
724
1084
|
/**
|
|
725
1085
|
* Where the mistakes are: how often each check passed, for every model
|
|
726
|
-
* with a current test, beside each check's
|
|
1086
|
+
* with a current test, beside each check's aim. Must-pass checks first. The
|
|
727
1087
|
* checks section shows the live model alone; this shows which model fails
|
|
728
1088
|
* which check.
|
|
729
1089
|
*/
|
|
@@ -732,7 +1092,8 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
732
1092
|
const tested = rows.filter((r) => r.test && !r.test.stale);
|
|
733
1093
|
if (!tested.length) return null;
|
|
734
1094
|
const checks = [...suite.checks].sort(
|
|
735
|
-
(a, b) =>
|
|
1095
|
+
(a, b) =>
|
|
1096
|
+
SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity),
|
|
736
1097
|
);
|
|
737
1098
|
return (
|
|
738
1099
|
<section aria-labelledby="check-breakdown" className="space-y-3">
|
|
@@ -744,9 +1105,9 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
744
1105
|
<p className="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs">
|
|
745
1106
|
{(
|
|
746
1107
|
[
|
|
747
|
-
["meets", "Meets
|
|
748
|
-
["close", "Within 10 points"],
|
|
749
|
-
["below", "Further
|
|
1108
|
+
["meets", "Meets its aim"],
|
|
1109
|
+
["close", "Within 10 points of it"],
|
|
1110
|
+
["below", "Further off"],
|
|
750
1111
|
] as const
|
|
751
1112
|
).map(([k, text]) => (
|
|
752
1113
|
<span key={k} className="flex items-center gap-1.5">
|
|
@@ -760,7 +1121,11 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
760
1121
|
<thead className="text-xs text-muted">
|
|
761
1122
|
<tr>
|
|
762
1123
|
<th className="py-2 pr-4 font-normal">Check</th>
|
|
763
|
-
<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>
|
|
764
1129
|
{tested.map((r) => (
|
|
765
1130
|
<th key={r.key} className="py-2 pr-3 font-normal">
|
|
766
1131
|
{r.label}
|
|
@@ -773,11 +1138,7 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
773
1138
|
<tr key={c.key}>
|
|
774
1139
|
<td className="py-1.5 pr-4">
|
|
775
1140
|
<span className="mr-2">{c.label}</span>
|
|
776
|
-
<
|
|
777
|
-
tone={c.severity === "serious" ? "serious" : "neutral"}
|
|
778
|
-
>
|
|
779
|
-
{c.severity}
|
|
780
|
-
</Chip>
|
|
1141
|
+
<SeverityChip severity={c.severity} />
|
|
781
1142
|
</td>
|
|
782
1143
|
<td className="py-1.5 pr-4 tabular-nums text-muted">
|
|
783
1144
|
{pct(checkBar(c))}
|
|
@@ -802,11 +1163,27 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
802
1163
|
</tr>
|
|
803
1164
|
))}
|
|
804
1165
|
<tr>
|
|
805
|
-
<td className="py-1.5 pr-4">
|
|
806
|
-
|
|
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>
|
|
807
1175
|
{tested.map((r) => (
|
|
808
|
-
<td key={r.key} className="py-1
|
|
809
|
-
{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
|
+
)}
|
|
810
1187
|
</td>
|
|
811
1188
|
))}
|
|
812
1189
|
</tr>
|
|
@@ -819,10 +1196,25 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
|
|
|
819
1196
|
}
|
|
820
1197
|
/** The feature's settings history, with rollback; not on an injection suite. */
|
|
821
1198
|
export function Versions({ data }: { data: SuitePageData }) {
|
|
822
|
-
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
|
+
);
|
|
823
1215
|
return (
|
|
824
1216
|
<>
|
|
825
|
-
{choosesHere && (
|
|
1217
|
+
{choosesHere && liveSettings && (
|
|
826
1218
|
<SettingsHistory
|
|
827
1219
|
app={app}
|
|
828
1220
|
suite={key}
|
|
@@ -836,33 +1228,28 @@ export function Versions({ data }: { data: SuitePageData }) {
|
|
|
836
1228
|
);
|
|
837
1229
|
}
|
|
838
1230
|
|
|
839
|
-
/** 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. */
|
|
840
1232
|
export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
841
1233
|
const { suite, live } = data;
|
|
842
1234
|
return (
|
|
843
1235
|
<>
|
|
844
|
-
<section className="space-y-3">
|
|
1236
|
+
<section id="checks" className="scroll-mt-4 space-y-3">
|
|
845
1237
|
<h2 className="text-lg font-semibold">
|
|
846
1238
|
Checks
|
|
847
1239
|
<InfoTip term="checks" />
|
|
848
1240
|
</h2>
|
|
849
1241
|
<div className="grid gap-3 md:grid-cols-2">
|
|
850
|
-
{/*
|
|
851
|
-
{
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
].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) => {
|
|
855
1246
|
const rate = live?.test?.byCheck[c.key];
|
|
856
1247
|
return (
|
|
857
1248
|
<Card key={c.key} className="space-y-1">
|
|
858
1249
|
<div className="flex justify-between gap-4">
|
|
859
1250
|
<h3 className="font-medium">{c.label}</h3>
|
|
860
|
-
<Tip term={c.severity} id={`severity-${c.key}`}>
|
|
861
|
-
<
|
|
862
|
-
tone={c.severity === "serious" ? "serious" : "neutral"}
|
|
863
|
-
>
|
|
864
|
-
{c.severity}
|
|
865
|
-
</Chip>
|
|
1251
|
+
<Tip term={c.severity} id={`severity-${c.key}`} align="end">
|
|
1252
|
+
<SeverityChip severity={c.severity} />
|
|
866
1253
|
</Tip>
|
|
867
1254
|
</div>
|
|
868
1255
|
<p className="readable text-sm text-muted">{c.description}</p>
|
|
@@ -882,8 +1269,8 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
|
882
1269
|
({rate.passed}/{rate.n}) ·{" "}
|
|
883
1270
|
</>
|
|
884
1271
|
)}
|
|
885
|
-
<Tip term="
|
|
886
|
-
<span className="text-muted">
|
|
1272
|
+
<Tip term="aim" id={`aim-${c.key}`}>
|
|
1273
|
+
<span className="text-muted">Aim: {pct(checkBar(c))}</span>
|
|
887
1274
|
</Tip>
|
|
888
1275
|
</p>
|
|
889
1276
|
</Card>
|
|
@@ -903,11 +1290,22 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
|
903
1290
|
* passes its action.
|
|
904
1291
|
*/
|
|
905
1292
|
export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
906
|
-
const { app, key, suite, cases } = data;
|
|
1293
|
+
const { app, key, suite, cases, replaced } = data;
|
|
907
1294
|
const { actions } = app;
|
|
908
1295
|
const inUse = cases.filter((c) => c.status !== "RETIRED");
|
|
909
1296
|
const drafts = draftAnswers(cases);
|
|
910
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;
|
|
911
1309
|
const injection = isInjectionSuite(suite) ? suite : null;
|
|
912
1310
|
const parts = [
|
|
913
1311
|
actions.useDraftsProvisionally && drafts.length > 0 && (
|
|
@@ -950,6 +1348,8 @@ export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
|
950
1348
|
: `No cases yet. Start with the suite's ${fresh.length} starter ${fresh.length === 1 ? "case" : "cases"}.`}{" "}
|
|
951
1349
|
Each needs your review and counts only once you confirm it, unless the
|
|
952
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.`}
|
|
953
1353
|
</p>
|
|
954
1354
|
<form action={actions.addStarters}>
|
|
955
1355
|
<input type="hidden" name="suite" value={key} />
|
|
@@ -990,10 +1390,6 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
990
1390
|
const { app, key, b, suite, rows, attackBoards } = data;
|
|
991
1391
|
// A feature's attack cases are a tab of its answer key.
|
|
992
1392
|
const attacked = attackBoards.filter((a) => a.cases > 0);
|
|
993
|
-
// Attack tests set up but not made yet: nothing else on this page says so.
|
|
994
|
-
const unmade = app.actions.makeAttackCases
|
|
995
|
-
? attackBoards.filter((a) => a.cases === 0)
|
|
996
|
-
: [];
|
|
997
1393
|
const guide =
|
|
998
1394
|
suite.answerGuide ??
|
|
999
1395
|
(suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
|
|
@@ -1052,32 +1448,6 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1052
1448
|
return (
|
|
1053
1449
|
// The weekly check links here to review drafts.
|
|
1054
1450
|
<section id="answer-key" className="scroll-mt-4 space-y-3">
|
|
1055
|
-
{unmade.length > 0 && b.cases > 0 && (
|
|
1056
|
-
<Card className="space-y-3">
|
|
1057
|
-
<p className="readable text-sm">
|
|
1058
|
-
<ShieldAlert
|
|
1059
|
-
aria-hidden
|
|
1060
|
-
className="mr-1.5 inline h-4 w-4 text-warn"
|
|
1061
|
-
/>
|
|
1062
|
-
This feature has attack tests set up, but no attack cases yet. Each
|
|
1063
|
-
is one of its confirmed cases with an attack planted where text it
|
|
1064
|
-
can't trust goes, so a test shows whether a model follows it.
|
|
1065
|
-
<InfoTip term="attacksResisted" />
|
|
1066
|
-
</p>
|
|
1067
|
-
<div className="flex flex-wrap gap-2">
|
|
1068
|
-
{unmade.map((a) => (
|
|
1069
|
-
<form key={a.suite.key} action={app.actions.makeAttackCases}>
|
|
1070
|
-
<input type="hidden" name="suite" value={a.suite.key} />
|
|
1071
|
-
<Submit variant="quiet">
|
|
1072
|
-
{unmade.length > 1
|
|
1073
|
-
? `Make attack cases: ${a.suite.label}`
|
|
1074
|
-
: "Make attack cases"}
|
|
1075
|
-
</Submit>
|
|
1076
|
-
</form>
|
|
1077
|
-
))}
|
|
1078
|
-
</div>
|
|
1079
|
-
</Card>
|
|
1080
|
-
)}
|
|
1081
1451
|
{attacked.length === 0 ? (
|
|
1082
1452
|
cases
|
|
1083
1453
|
) : (
|
|
@@ -1095,21 +1465,31 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1095
1465
|
suite={a.suite}
|
|
1096
1466
|
rows={a.rows}
|
|
1097
1467
|
heading={
|
|
1098
|
-
<
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
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>
|
|
1104
1475
|
}
|
|
1105
1476
|
tools={
|
|
1106
1477
|
<>
|
|
1107
|
-
<
|
|
1108
|
-
|
|
1109
|
-
|
|
1478
|
+
<Tip
|
|
1479
|
+
control
|
|
1480
|
+
term="addAttack"
|
|
1481
|
+
id={`add-attack-${a.suite.key}`}
|
|
1482
|
+
side="bottom"
|
|
1483
|
+
align="end"
|
|
1110
1484
|
>
|
|
1111
|
-
|
|
1112
|
-
|
|
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>
|
|
1113
1493
|
{app.actions.makeAttackCases && (
|
|
1114
1494
|
<form action={app.actions.makeAttackCases}>
|
|
1115
1495
|
<input
|
|
@@ -1117,7 +1497,20 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1117
1497
|
name="suite"
|
|
1118
1498
|
value={a.suite.key}
|
|
1119
1499
|
/>
|
|
1120
|
-
<
|
|
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>
|
|
1121
1514
|
</form>
|
|
1122
1515
|
)}
|
|
1123
1516
|
</>
|
|
@@ -1209,13 +1602,14 @@ function UnderAttack({
|
|
|
1209
1602
|
}
|
|
1210
1603
|
|
|
1211
1604
|
/**
|
|
1212
|
-
* Keeping the answer key useful: easy cases to retire (past
|
|
1605
|
+
* Keeping the answer key useful: easy cases to retire (past the suite's
|
|
1606
|
+
* target number of cases),
|
|
1213
1607
|
* cases models split on and near-duplicates to check, old drafts, and
|
|
1214
1608
|
* tags with a single case. Shows only what needs a look, and nothing on
|
|
1215
1609
|
* an injection suite, whose cases are made from its base suite's.
|
|
1216
1610
|
*/
|
|
1217
1611
|
export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
1218
|
-
const { app, key, suite, health: h, choosesHere, splitBy } = data;
|
|
1612
|
+
const { app, key, suite, health: h, choosesHere, splitBy, target } = data;
|
|
1219
1613
|
const thin = h.tags.filter(([, n]) => n === 1).map(([t]) => t);
|
|
1220
1614
|
const needs =
|
|
1221
1615
|
h.easyToRetire.length ||
|
|
@@ -1241,7 +1635,7 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1241
1635
|
const retire = h.easyToRetire.length > 0 || h.staleDrafts.length > 0;
|
|
1242
1636
|
return (
|
|
1243
1637
|
<section className="space-y-3" aria-labelledby="answer-key-health">
|
|
1244
|
-
<h2 id="answer-key-health" className="text-lg font-semibold">
|
|
1638
|
+
<h2 id="answer-key-health" className="scroll-mt-4 text-lg font-semibold">
|
|
1245
1639
|
Answer key health
|
|
1246
1640
|
<InfoTip term="answerKeyHealth" />
|
|
1247
1641
|
</h2>
|
|
@@ -1267,11 +1661,15 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1267
1661
|
const names = (xs: string[]) =>
|
|
1268
1662
|
new Intl.ListFormat("en-US").format(xs);
|
|
1269
1663
|
return (
|
|
1664
|
+
// The tint spans the panel; the words keep their
|
|
1665
|
+
// readable width inside it.
|
|
1270
1666
|
<li
|
|
1271
1667
|
key={c.id}
|
|
1272
|
-
className="space-y-2 rounded-md bg-tint p-3"
|
|
1668
|
+
className="w-full space-y-2 rounded-md bg-tint p-3"
|
|
1273
1669
|
>
|
|
1274
|
-
<div className="font-medium">
|
|
1670
|
+
<div className="readable font-medium">
|
|
1671
|
+
{caseLink(c)}
|
|
1672
|
+
</div>
|
|
1275
1673
|
{by && (
|
|
1276
1674
|
<p className="readable text-xs text-muted">
|
|
1277
1675
|
{by.right.length > 0 &&
|
|
@@ -1336,18 +1734,35 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1336
1734
|
or two to each.
|
|
1337
1735
|
<InfoTip term="tagCoverage" />
|
|
1338
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
|
+
)}
|
|
1339
1742
|
{draftMore && suite.draftMore ? (
|
|
1340
1743
|
<form action={draftMore} className="space-y-2">
|
|
1341
1744
|
<input type="hidden" name="suite" value={key} />
|
|
1342
1745
|
<ul className="flex flex-wrap gap-1.5">
|
|
1343
1746
|
{thin.map((t) => (
|
|
1344
1747
|
<li key={t}>
|
|
1345
|
-
|
|
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
|
+
>
|
|
1346
1753
|
<input
|
|
1347
1754
|
type="checkbox"
|
|
1348
1755
|
name="topic"
|
|
1349
1756
|
value={t}
|
|
1350
|
-
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"
|
|
1351
1766
|
/>
|
|
1352
1767
|
{t}
|
|
1353
1768
|
</label>
|
|
@@ -1363,40 +1778,27 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1363
1778
|
</p>
|
|
1364
1779
|
</form>
|
|
1365
1780
|
) : (
|
|
1366
|
-
<
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
<
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
</a>
|
|
1380
|
-
</li>
|
|
1381
|
-
))}
|
|
1382
|
-
</ul>
|
|
1383
|
-
<a
|
|
1384
|
-
href="#add-case="
|
|
1385
|
-
className={`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
1386
|
-
>
|
|
1387
|
-
<Plus aria-hidden className="h-4 w-4" />
|
|
1388
|
-
Add a case
|
|
1389
|
-
</a>
|
|
1390
|
-
</div>
|
|
1391
|
-
<p className="readable text-xs text-muted">
|
|
1392
|
-
A suite with <code>draftMore</code> drafts whole cases for the
|
|
1393
|
-
topics you pick instead.
|
|
1394
|
-
</p>
|
|
1395
|
-
</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>
|
|
1396
1794
|
)}
|
|
1397
1795
|
<details className="group">
|
|
1398
|
-
<summary className="cursor-pointer text-muted">
|
|
1399
|
-
|
|
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
|
|
1400
1802
|
</summary>
|
|
1401
1803
|
<ul className="mt-2 flex flex-wrap gap-1.5">
|
|
1402
1804
|
{h.tags.map(([t, n]) => (
|
|
@@ -1419,8 +1821,9 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1419
1821
|
Every model got {cases(h.easyToRetire.length)} fully right in{" "}
|
|
1420
1822
|
{EASY_MIN_ROUNDS} or more rounds of testing, so they no longer
|
|
1421
1823
|
tell models apart. Retiring them keeps{" "}
|
|
1422
|
-
{h.inUse - h.easyToRetire.length} cases, at or above the
|
|
1423
|
-
of {
|
|
1824
|
+
{h.inUse - h.easyToRetire.length} cases, at or above the
|
|
1825
|
+
suite's target of {target}. Recent tests are rescored for
|
|
1826
|
+
free.
|
|
1424
1827
|
<InfoTip term="easyCases" />
|
|
1425
1828
|
</p>
|
|
1426
1829
|
{retireEasy && (
|
|
@@ -1477,6 +1880,7 @@ export async function SuitePage({
|
|
|
1477
1880
|
<div className="space-y-8">
|
|
1478
1881
|
<RefreshWhile active={data.testing} />
|
|
1479
1882
|
<SuiteHeader data={data} />
|
|
1883
|
+
<TodoSection data={data} />
|
|
1480
1884
|
<ChosenOnBase data={data} />
|
|
1481
1885
|
<SuggestionCard data={data} />
|
|
1482
1886
|
<CasesInInstructions data={data} />
|