@crowandraven/evalkeeper 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +16 -0
  2. package/dist/activity.d.ts +58 -0
  3. package/dist/activity.js +125 -0
  4. package/dist/activity.js.map +1 -0
  5. package/dist/assertExpect.d.ts +52 -0
  6. package/dist/assertExpect.js +104 -0
  7. package/dist/assertExpect.js.map +1 -0
  8. package/dist/blind.d.ts +79 -0
  9. package/dist/blind.js +113 -0
  10. package/dist/blind.js.map +1 -0
  11. package/dist/cli/addPages.d.ts +6 -1
  12. package/dist/cli/addPages.js +19 -4
  13. package/dist/cli/addPages.js.map +1 -1
  14. package/dist/cli/main.d.ts +1 -1
  15. package/dist/cli/main.js +4 -3
  16. package/dist/cli/main.js.map +1 -1
  17. package/dist/compare.d.ts +38 -0
  18. package/dist/compare.js +62 -0
  19. package/dist/compare.js.map +1 -1
  20. package/dist/decisions.js +8 -0
  21. package/dist/decisions.js.map +1 -1
  22. package/dist/feedback.d.ts +17 -2
  23. package/dist/feedback.js +13 -2
  24. package/dist/feedback.js.map +1 -1
  25. package/dist/glossary.d.ts +22 -0
  26. package/dist/glossary.js +22 -0
  27. package/dist/glossary.js.map +1 -1
  28. package/dist/health.js +5 -3
  29. package/dist/health.js.map +1 -1
  30. package/dist/importCases.d.ts +76 -5
  31. package/dist/importCases.js +114 -14
  32. package/dist/importCases.js.map +1 -1
  33. package/dist/inInstructions.d.ts +47 -0
  34. package/dist/inInstructions.js +95 -0
  35. package/dist/inInstructions.js.map +1 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/memoryStore.js +3 -1
  40. package/dist/memoryStore.js.map +1 -1
  41. package/dist/readCheck.d.ts +116 -0
  42. package/dist/readCheck.js +321 -0
  43. package/dist/readCheck.js.map +1 -0
  44. package/dist/runner.d.ts +16 -0
  45. package/dist/runner.js +51 -3
  46. package/dist/runner.js.map +1 -1
  47. package/dist/settings.d.ts +81 -3
  48. package/dist/settings.js +160 -23
  49. package/dist/settings.js.map +1 -1
  50. package/dist/store.d.ts +10 -3
  51. package/dist/suggest.d.ts +10 -1
  52. package/dist/suggest.js +22 -4
  53. package/dist/suggest.js.map +1 -1
  54. package/dist/suiteContract.d.ts +23 -0
  55. package/dist/suiteContract.js +106 -0
  56. package/dist/suiteContract.js.map +1 -0
  57. package/dist/suites/crisisRisk.d.ts +83 -0
  58. package/dist/suites/crisisRisk.js +176 -0
  59. package/dist/suites/crisisRisk.js.map +1 -0
  60. package/dist/suites/crisisRiskCases.d.ts +40 -0
  61. package/dist/suites/crisisRiskCases.js +179 -0
  62. package/dist/suites/crisisRiskCases.js.map +1 -0
  63. package/dist/suites/hopelessness.d.ts +116 -0
  64. package/dist/suites/hopelessness.js +293 -0
  65. package/dist/suites/hopelessness.js.map +1 -0
  66. package/dist/suites/hopelessnessCases.d.ts +61 -0
  67. package/dist/suites/hopelessnessCases.js +242 -0
  68. package/dist/suites/hopelessnessCases.js.map +1 -0
  69. package/dist/suites/index.d.ts +11 -0
  70. package/dist/suites/index.js +12 -0
  71. package/dist/suites/index.js.map +1 -0
  72. package/dist/testing.d.ts +162 -12
  73. package/dist/testing.js +479 -115
  74. package/dist/testing.js.map +1 -1
  75. package/dist/types.d.ts +98 -0
  76. package/dist/types.js +68 -0
  77. package/dist/types.js.map +1 -1
  78. package/dist/weekly.d.ts +21 -3
  79. package/dist/weekly.js +18 -1
  80. package/dist/weekly.js.map +1 -1
  81. package/package.json +5 -1
  82. package/src/activity.ts +154 -0
  83. package/src/assertExpect.ts +168 -0
  84. package/src/blind.ts +138 -0
  85. package/src/cli/addPages.ts +20 -4
  86. package/src/cli/main.ts +4 -3
  87. package/src/compare.ts +85 -0
  88. package/src/decisions.ts +10 -0
  89. package/src/feedback.ts +20 -2
  90. package/src/glossary.ts +40 -0
  91. package/src/health.ts +5 -3
  92. package/src/importCases.ts +172 -33
  93. package/src/inInstructions.ts +105 -0
  94. package/src/index.ts +5 -0
  95. package/src/memoryStore.ts +2 -1
  96. package/src/readCheck.ts +458 -0
  97. package/src/runner.ts +74 -4
  98. package/src/settings.ts +192 -26
  99. package/src/store.ts +11 -3
  100. package/src/suggest.ts +33 -4
  101. package/src/suiteContract.ts +147 -0
  102. package/src/suites/crisisRisk.ts +250 -0
  103. package/src/suites/crisisRiskCases.ts +205 -0
  104. package/src/suites/hopelessness.ts +410 -0
  105. package/src/suites/hopelessnessCases.ts +286 -0
  106. package/src/suites/index.ts +11 -0
  107. package/src/testing.ts +646 -121
  108. package/src/types.ts +147 -0
  109. package/src/weekly.ts +39 -3
  110. package/starter/index.ts +8 -0
  111. package/templates/app/evals/[suite]/compare/page.tsx +385 -0
  112. package/templates/app/evals/[suite]/page.tsx +104 -31
  113. package/templates/app/evals/[suite]/rate/page.tsx +143 -0
  114. package/templates/app/evals/[suite]/runs/[runId]/page.tsx +84 -3
  115. package/templates/app/evals/[suite]/side-by-side/page.tsx +320 -0
  116. package/templates/app/evals/feedback/page.tsx +3 -0
  117. package/templates/app/evals/page.tsx +3 -0
  118. package/templates/components/evalkeeper/AnswerKey.tsx +2 -1
  119. package/templates/components/evalkeeper/DisagreementChip.tsx +35 -0
  120. package/templates/components/evalkeeper/ReadableOutput.tsx +97 -0
  121. package/templates/components/evalkeeper/RollBack.tsx +21 -1
  122. package/templates/components/evalkeeper/SettingsHistory.tsx +29 -5
  123. package/templates/components/evalkeeper/WeeklyCheck.tsx +34 -2
  124. package/templates/lib/evalkeeper/actions.ts +68 -4
  125. package/templates/lib/evalkeeper/weekly.ts +27 -4
package/dist/testing.js CHANGED
@@ -1,26 +1,96 @@
1
1
  /**
2
- * The contracts every store must meet, as Vitest tests.
2
+ * The contracts every store and set of suites must meet, as tests. They
3
+ * register with Vitest by default, or with the test functions you pass
4
+ * (`node:test` with `assertExpect`, say), so Vitest stays optional.
3
5
  *
4
6
  * @module evalkeeper/testing
5
7
  */
6
- import { describe, expect, it } from "vitest";
7
8
  import { z } from "zod";
9
+ import { BLIND_RATER, blindRating, nextToRate, skipMark } from "./blind.js";
10
+ import { NO_INPUTS_KEPT, whyNotACase, } from "./feedback.js";
11
+ import { confirmedLabel } from "./labels.js";
8
12
  import { createRunner } from "./runner.js";
9
- import { SettingsConflict, } from "./settings.js";
13
+ import { CHANGE_KINDS, SettingsConflict, } from "./settings.js";
14
+ import { suiteContractProblems } from "./suiteContract.js";
15
+ import { readCheckSummary } from "./readCheck.js";
16
+ export { assertExpect, } from "./assertExpect.js";
10
17
  /**
11
- * The contract every EvalStore must meet, as Vitest tests. Run it against
12
- * your store to know the runner will work on it. `make` must return an
13
- * empty store each time it's called; `opts.without` names run settings
14
- * its tables have no column for.
18
+ * Vitest's test functions, or why they couldn't be loaded. A dynamic
19
+ * import (awaited as this module loads), so this module loads without
20
+ * Vitest when you pass your own test functions.
21
+ */
22
+ const vitest = await import("vitest").then((v) => ({
23
+ describe: v.describe,
24
+ it: v.it,
25
+ expect: v.expect,
26
+ afterAll: v.afterAll,
27
+ }), (e) => (e instanceof Error ? e : new Error(String(e))));
28
+ /** The test functions to register with: the ones given, else Vitest's. */
29
+ function testFunctions(given) {
30
+ if (given)
31
+ return given;
32
+ if (!(vitest instanceof Error))
33
+ return vitest;
34
+ throw new Error(`Vitest couldn't be loaded (${vitest.message}), so pass your own test functions: { test: { describe, it, expect: assertExpect } } with describe and it from "node:test", and assertExpect from this module.`);
35
+ }
36
+ /**
37
+ * A namer for each test: in a scoped contract, a fresh prefix per test
38
+ * (so tests don't see each other's rows); otherwise names as they are.
39
+ */
40
+ function scopeNames(scope) {
41
+ if (scope === undefined)
42
+ return () => (name) => name;
43
+ if (!scope.trim())
44
+ throw new Error('A contract\'s scope must be a prefix with some text in it, such as "contract-": an empty one would match every row.');
45
+ const run = Date.now().toString(36);
46
+ let n = 0;
47
+ return () => {
48
+ const prefix = `${scope}${run}-${(n++).toString(36)}-`;
49
+ return (name) => prefix + name;
50
+ };
51
+ }
52
+ /** Registers a scoped contract's cleanup, after checking it can run. */
53
+ function registerCleanup(t, opts) {
54
+ const { cleanup, scope } = opts;
55
+ if (!cleanup)
56
+ return;
57
+ if (scope === undefined)
58
+ throw new Error("cleanup needs a scope: it deletes only the rows the scope names. Without a scope, return an empty store from make instead.");
59
+ if (!t.afterAll)
60
+ throw new Error("cleanup runs after the contract's tests, so pass afterAll (node:test's after) with your test functions.");
61
+ t.afterAll(async () => {
62
+ await cleanup(scope);
63
+ });
64
+ }
65
+ /**
66
+ * The contract every EvalStore must meet. Run it against your store to
67
+ * know the runner will work on it. `make` must return an empty store each
68
+ * time it's called, unless `opts.scope` is set: then every suite the
69
+ * contract writes (and every request hash it picks) starts with the
70
+ * scope, the tests never look past their own rows, and `opts.cleanup`
71
+ * deletes those suites' cases, answers, tests, and outputs afterward, so
72
+ * it can run on a database that holds other rows. `opts.without` names
73
+ * run settings its tables have no column for; `opts.test` passes test
74
+ * functions other than Vitest's.
15
75
  *
16
76
  * @example
17
77
  * ```ts
18
78
  * import { describeStoreContract } from "@crowandraven/evalkeeper/testing";
19
79
  *
20
80
  * describeStoreContract("my store", () => myStore(freshDatabase()));
81
+ *
82
+ * // On a database with other rows: only rows starting "contract-" are
83
+ * // written, and cleanup deletes only those.
84
+ * describeStoreContract("our tables", () => prismaStore(prisma, map), {
85
+ * scope: "contract-",
86
+ * cleanup: (scope) => deleteScopedRows(prisma, scope, { map }),
87
+ * });
21
88
  * ```
22
89
  */
23
90
  export function describeStoreContract(name, make, opts = {}) {
91
+ const t = testFunctions(opts.test);
92
+ const { describe, it, expect } = t;
93
+ const names = scopeNames(opts.scope);
24
94
  const newCase = (suite, over = {}) => ({
25
95
  suite,
26
96
  input: { text: "hello", nested: { n: 1 } },
@@ -55,10 +125,12 @@ export function describeStoreContract(name, make, opts = {}) {
55
125
  startedBy: null,
56
126
  });
57
127
  describe(`EvalStore contract: ${name}`, () => {
128
+ registerCleanup(t, opts);
58
129
  it("keeps a case's input, tags, and answers as given", async () => {
59
130
  const store = await make();
60
- const c = await store.createCase(newCase("s"));
61
- const [listed] = await store.listCases("s");
131
+ const n = names();
132
+ const c = await store.createCase(newCase(n("s")));
133
+ const [listed] = await store.listCases(n("s"));
62
134
  expect(listed?.id).toBe(c.id);
63
135
  expect(listed?.input).toEqual({ text: "hello", nested: { n: 1 } });
64
136
  expect(listed?.tags).toEqual(["a", "b"]);
@@ -69,24 +141,54 @@ export function describeStoreContract(name, make, opts = {}) {
69
141
  value: { want: "HELLO" },
70
142
  });
71
143
  });
144
+ it("keeps where a case came from and when, retired ones too", async () => {
145
+ // Drafts from activity and imports skip what they made before by
146
+ // source and sourceRef, so both must read back as written.
147
+ const store = await make();
148
+ const n = names();
149
+ const before = Date.now();
150
+ const c = await store.createCase(newCase(n("s"), {
151
+ status: "DRAFT",
152
+ source: "ACTIVITY",
153
+ sourceRef: "answer-42",
154
+ note: "Flagged by an admin.",
155
+ labels: [],
156
+ }));
157
+ await store.setCaseStatus(c.id, "RETIRED");
158
+ const [listed] = await store.listCases(n("s"), {
159
+ includeRetired: true,
160
+ });
161
+ expect(listed).toMatchObject({
162
+ status: "RETIRED",
163
+ source: "ACTIVITY",
164
+ sourceRef: "answer-42",
165
+ note: "Flagged by an admin.",
166
+ labels: [],
167
+ });
168
+ // Within a second either way: some databases round to the second.
169
+ expect(+(listed?.createdAt ?? 0)).toBeGreaterThanOrEqual(before - 1000);
170
+ expect(+(listed?.createdAt ?? 0)).toBeLessThanOrEqual(Date.now() + 1000);
171
+ });
72
172
  it("lists a suite's cases oldest first, leaving out retired ones", async () => {
73
173
  const store = await make();
74
- const first = await store.createCase(newCase("s"));
174
+ const n = names();
175
+ const first = await store.createCase(newCase(n("s")));
75
176
  // Apart in time: two cases made in the same millisecond have no
76
177
  // oldest one.
77
178
  await new Promise((r) => setTimeout(r, 5));
78
- const second = await store.createCase(newCase("s"));
79
- await store.createCase(newCase("other"));
179
+ const second = await store.createCase(newCase(n("s")));
180
+ await store.createCase(newCase(n("other")));
80
181
  await store.setCaseStatus(first.id, "RETIRED");
81
- expect((await store.listCases("s")).map((c) => c.id)).toEqual([
182
+ expect((await store.listCases(n("s"))).map((c) => c.id)).toEqual([
82
183
  second.id,
83
184
  ]);
84
185
  // On request, retired ones too, still oldest first.
85
- expect((await store.listCases("s", { includeRetired: true })).map((c) => c.id)).toEqual([first.id, second.id]);
186
+ expect((await store.listCases(n("s"), { includeRetired: true })).map((c) => c.id)).toEqual([first.id, second.id]);
86
187
  });
87
188
  it("adds answers without overwriting, and changes their status", async () => {
88
189
  const store = await make();
89
- const c = await store.createCase(newCase("s", { labels: [] }));
190
+ const n = names();
191
+ const c = await store.createCase(newCase(n("s"), { labels: [] }));
90
192
  const l = await store.addLabel(c.id, {
91
193
  kind: "EXPECTED",
92
194
  status: "PENDING",
@@ -96,24 +198,61 @@ export function describeStoreContract(name, make, opts = {}) {
96
198
  note: null,
97
199
  });
98
200
  await store.setLabelStatus(l.id, "CONFIRMED");
99
- const [listed] = await store.listCases("s");
201
+ const [listed] = await store.listCases(n("s"));
100
202
  expect(listed?.labels).toHaveLength(1);
101
203
  expect(listed?.labels[0]?.status).toBe("CONFIRMED");
102
204
  });
205
+ it("keeps each rater's blind rating and skip beside others' answers", async () => {
206
+ const store = await make();
207
+ const n = names();
208
+ const c = await store.createCase(newCase(n("s")));
209
+ const before = (await store.listCases(n("s")))[0]?.updatedAt;
210
+ // Apart in time, so a skip that touched the case would show.
211
+ await new Promise((r) => setTimeout(r, 5));
212
+ await store.addLabel(c.id, skipMark("rater-1"));
213
+ const [skipped] = await store.listCases(n("s"));
214
+ expect(skipped?.updatedAt).toEqual(before);
215
+ expect(skipped?.labels.find((l) => l.status === "SKIPPED")).toMatchObject({ value: null, raterId: "rater-1", raterRole: BLIND_RATER });
216
+ // The skip is never graded against: the owner's answer stays in use.
217
+ expect(confirmedLabel(skipped?.labels ?? [])?.value).toEqual({
218
+ want: "HELLO",
219
+ });
220
+ expect(nextToRate(await store.listCases(n("s")), "rater-1")).toBeNull();
221
+ expect(nextToRate(await store.listCases(n("s")), "rater-2")?.id).toBe(c.id);
222
+ await store.addLabel(c.id, blindRating({
223
+ raterId: "rater-2",
224
+ value: { want: "HI" },
225
+ reason: "It greets",
226
+ }));
227
+ const [rated] = await store.listCases(n("s"));
228
+ expect(rated?.labels).toHaveLength(3);
229
+ expect(rated?.labels.find((l) => l.raterId === "rater-2")).toMatchObject({
230
+ status: "CONFIRMED",
231
+ value: { want: "HI" },
232
+ note: "It greets",
233
+ });
234
+ // The owner's answer is still there, unchanged.
235
+ expect(rated?.labels.find((l) => l.raterRole === "OWNER")).toMatchObject({
236
+ status: "CONFIRMED",
237
+ value: { want: "HELLO" },
238
+ });
239
+ expect(nextToRate(await store.listCases(n("s")), "rater-2")).toBeNull();
240
+ });
103
241
  it("starts runs as running, lists them newest first, and filters", async () => {
104
242
  const store = await make();
105
- const a = await store.createRun(newRun("s"));
243
+ const n = names();
244
+ const a = await store.createRun(newRun(n("s")));
106
245
  await new Promise((r) => setTimeout(r, 5));
107
- const b = await store.createRun(newRun("s"));
246
+ const b = await store.createRun(newRun(n("s")));
108
247
  expect(a.status).toBe("RUNNING");
109
- expect((await store.listRuns("s")).map((r) => r.id)).toEqual([
248
+ expect((await store.listRuns(n("s"))).map((r) => r.id)).toEqual([
110
249
  b.id,
111
250
  a.id,
112
251
  ]);
113
- expect(await store.listRuns("s", { limit: 1 })).toHaveLength(1);
252
+ expect(await store.listRuns(n("s"), { limit: 1 })).toHaveLength(1);
114
253
  await store.updateRun(a.id, { status: "SUCCEEDED" });
115
- expect((await store.listRuns("s", { status: "SUCCEEDED" })).map((r) => r.id)).toEqual([a.id]);
116
- expect(await store.getRun("missing")).toBeNull();
254
+ expect((await store.listRuns(n("s"), { status: "SUCCEEDED" })).map((r) => r.id)).toEqual([a.id]);
255
+ expect(await store.getRun(n("missing"))).toBeNull();
117
256
  });
118
257
  const runSettings = [
119
258
  ["temperature", "temperature", 0.7],
@@ -123,36 +262,49 @@ export function describeStoreContract(name, make, opts = {}) {
123
262
  if (opts.without?.includes(field)) {
124
263
  it(`refuses a ${words} it has no column for, and keeps none`, async () => {
125
264
  const store = await make();
126
- await expect(store.createRun({ ...newRun("s"), [field]: value })).rejects.toThrow(field);
127
- const none = await store.createRun({ ...newRun("s"), [field]: null });
265
+ const n = names();
266
+ await expect(store.createRun({ ...newRun(n("s")), [field]: value })).rejects.toThrow(field);
267
+ const none = await store.createRun({
268
+ ...newRun(n("s")),
269
+ [field]: null,
270
+ });
128
271
  expect((await store.getRun(none.id))?.[field] ?? null).toBeNull();
129
272
  });
130
273
  continue;
131
274
  }
132
275
  it(`keeps the ${words} a run was tested at`, async () => {
133
276
  const store = await make();
134
- const set = await store.createRun({ ...newRun("s"), [field]: value });
135
- const none = await store.createRun({ ...newRun("s"), [field]: null });
277
+ const n = names();
278
+ const set = await store.createRun({
279
+ ...newRun(n("s")),
280
+ [field]: value,
281
+ });
282
+ const none = await store.createRun({
283
+ ...newRun(n("s")),
284
+ [field]: null,
285
+ });
136
286
  expect((await store.getRun(set.id))?.[field]).toBe(value);
137
287
  expect((await store.getRun(none.id))?.[field] ?? null).toBeNull();
138
288
  });
139
289
  }
140
290
  it("updates a run only while it has the status it's guarded by", async () => {
141
291
  const store = await make();
142
- const r = await store.createRun(newRun("s"));
292
+ const n = names();
293
+ const r = await store.createRun(newRun(n("s")));
143
294
  await store.updateRun(r.id, { status: "FAILED" }, { status: "RUNNING" });
144
295
  await store.updateRun(r.id, { status: "SUCCEEDED" }, { status: "RUNNING" });
145
296
  expect((await store.getRun(r.id))?.status).toBe("FAILED");
146
297
  });
147
298
  it("stores outputs and scores, and finds only originals to reuse", async () => {
148
299
  const store = await make();
149
- const c = await store.createCase(newCase("s"));
150
- const r = await store.createRun(newRun("s"));
300
+ const n = names();
301
+ const c = await store.createCase(newCase(n("s")));
302
+ const r = await store.createRun(newRun(n("s")));
151
303
  const base = {
152
304
  runId: r.id,
153
305
  caseId: c.id,
154
306
  repeat: 1,
155
- requestHash: "h",
307
+ requestHash: n("h"),
156
308
  output: { text: "HELLO" },
157
309
  error: null,
158
310
  scores: null,
@@ -169,18 +321,19 @@ export function describeStoreContract(name, make, opts = {}) {
169
321
  expect(outs.find((x) => x.id === o.id)?.scores).toEqual([
170
322
  { key: "match", pass: true },
171
323
  ]);
172
- const found = await store.findReusableOutput("h", new Date(0));
324
+ const found = await store.findReusableOutput(n("h"), new Date(0));
173
325
  expect(found?.id).toBe(o.id);
174
326
  expect(found?.output).toEqual({ text: "HELLO" });
175
- expect(await store.findReusableOutput("h", new Date(Date.now() + 60_000))).toBeNull();
327
+ expect(await store.findReusableOutput(n("h"), new Date(Date.now() + 60_000))).toBeNull();
176
328
  });
177
329
  it("lists several tests' outputs and reusable hashes in one call, where it can", async () => {
178
330
  const store = await make();
179
- const c = await store.createCase(newCase("s"));
331
+ const n = names();
332
+ const c = await store.createCase(newCase(n("s")));
180
333
  const [r1, r2, r3] = await Promise.all([
181
- store.createRun(newRun("s")),
182
- store.createRun(newRun("s")),
183
- store.createRun(newRun("s")),
334
+ store.createRun(newRun(n("s"))),
335
+ store.createRun(newRun(n("s"))),
336
+ store.createRun(newRun(n("s"))),
184
337
  ]);
185
338
  const base = {
186
339
  caseId: c.id,
@@ -192,40 +345,41 @@ export function describeStoreContract(name, make, opts = {}) {
192
345
  ms: 12,
193
346
  reused: false,
194
347
  };
195
- await store.createOutput({ ...base, runId: r1.id, requestHash: "a" });
196
- await store.createOutput({ ...base, runId: r2.id, requestHash: "b" });
348
+ await store.createOutput({ ...base, runId: r1.id, requestHash: n("a") });
349
+ await store.createOutput({ ...base, runId: r2.id, requestHash: n("b") });
197
350
  await store.createOutput({
198
351
  ...base,
199
352
  runId: r2.id,
200
- requestHash: "c",
353
+ requestHash: n("c"),
201
354
  reused: true,
202
355
  });
203
356
  await store.createOutput({
204
357
  ...base,
205
358
  runId: r3.id,
206
- requestHash: "d",
359
+ requestHash: n("d"),
207
360
  error: "boom",
208
361
  output: null,
209
362
  });
210
363
  if (store.listOutputsFor) {
211
364
  const outs = await store.listOutputsFor([r1.id, r2.id]);
212
- expect(outs.map((o) => o.requestHash).sort()).toEqual(["a", "b", "c"]);
365
+ expect(outs.map((o) => o.requestHash).sort()).toEqual([n("a"), n("b"), n("c")].sort());
213
366
  expect(await store.listOutputsFor([])).toEqual([]);
214
367
  }
215
368
  if (store.findReusableHashes) {
216
369
  expect([
217
- ...(await store.findReusableHashes(["a", "b", "c", "d", "e"], new Date(0))),
218
- ].sort()).toEqual(["a", "b"]);
219
- expect((await store.findReusableHashes(["a"], new Date(Date.now() + 60_000)))
220
- .size).toBe(0);
370
+ ...(await store.findReusableHashes(["a", "b", "c", "d", "e"].map(n), new Date(0))),
371
+ ].sort()).toEqual([n("a"), n("b")].sort());
372
+ expect((await store.findReusableHashes([n("a")], new Date(Date.now() + 60_000))).size).toBe(0);
221
373
  expect((await store.findReusableHashes([], new Date(0))).size).toBe(0);
222
374
  }
223
375
  });
224
376
  it("runs a whole test through the runner", async () => {
225
377
  const store = await make();
378
+ const n = names();
379
+ const key = n("contract");
226
380
  const echo = {
227
- key: "contract",
228
- operation: "contract",
381
+ key,
382
+ operation: key,
229
383
  priority: { favor: "quality" },
230
384
  label: "Contract",
231
385
  description: "Uppercases text.",
@@ -248,17 +402,14 @@ export function describeStoreContract(name, make, opts = {}) {
248
402
  inputFromForm: () => ({ text: "" }),
249
403
  title: (i) => i.text,
250
404
  };
251
- await store.createCase(newCase("contract"));
405
+ await store.createCase(newCase(key));
252
406
  const runner = createRunner({
253
407
  store,
254
408
  suites: [echo],
255
409
  models: { "model-a": { label: "Model A", provider: "acme" } },
256
410
  promptVersion: () => "v1",
257
411
  });
258
- const { run } = await runner.createRun({
259
- suite: "contract",
260
- model: "model-a",
261
- });
412
+ const { run } = await runner.createRun({ suite: key, model: "model-a" });
262
413
  await runner.runEval(run.id);
263
414
  const done = await store.getRun(run.id);
264
415
  expect(done?.status).toBe("SUCCEEDED");
@@ -268,74 +419,181 @@ export function describeStoreContract(name, make, opts = {}) {
268
419
  }
269
420
  /**
270
421
  * The contract every FeedbackStore must meet. `make` must return an empty
271
- * store each time it's called.
422
+ * store each time it's called, unless `opts.scope` is set (see
423
+ * `describeStoreContract`): then every feature the contract rates starts
424
+ * with the scope, and its lists ask for those features only.
425
+ * `opts.without` names columns the store's table doesn't have (an app's
426
+ * own thumbs table without inputs or statuses, say).
427
+ *
428
+ * @param name - What the tests are called, e.g. "our thumbs table".
429
+ * @param make - Returns the store to test (an empty one, unless scoped).
430
+ * @param opts - A scope and cleanup, missing columns, and test functions.
431
+ *
432
+ * @example
433
+ * ```ts
434
+ * describeFeedbackStoreContract(
435
+ * "our thumbs table",
436
+ * () => prismaFeedbackStore(prisma, feedbackMap),
437
+ * {
438
+ * without: ["input", "output", "status", "caseId"],
439
+ * scope: "contract-",
440
+ * cleanup: (scope) => deleteScopedRows(prisma, scope, { feedbackMap }),
441
+ * },
442
+ * );
443
+ * ```
272
444
  */
273
- export function describeFeedbackStoreContract(name, make) {
274
- const rating = (over = {}) => ({
275
- operation: "triage",
276
- targetId: "answer-1",
277
- raterId: "person-1",
278
- rating: "DOWN",
445
+ export function describeFeedbackStoreContract(name, make, opts = {}) {
446
+ const t = testFunctions(opts.test);
447
+ const { describe, it, expect } = t;
448
+ const names = scopeNames(opts.scope);
449
+ const scoped = opts.scope !== undefined;
450
+ const lacks = (c) => opts.without?.includes(c) ?? false;
451
+ const kept = {
279
452
  reason: "Wrong queue",
280
453
  excerpt: "billing",
281
454
  input: { subject: "Refund", body: "Please refund me." },
282
455
  output: { category: "bug" },
456
+ };
457
+ /** What a store keeps of `kept`: null for each column it lacks. */
458
+ const keeps = {
459
+ reason: lacks("reason") ? null : kept.reason,
460
+ excerpt: lacks("excerpt") ? null : kept.excerpt,
461
+ input: lacks("input") ? null : kept.input,
462
+ output: lacks("output") ? null : kept.output,
463
+ };
464
+ const rating = (operation, over = {}) => ({
465
+ operation,
466
+ targetId: "answer-1",
467
+ raterId: "person-1",
468
+ rating: "DOWN",
469
+ ...keeps,
283
470
  ...over,
284
471
  });
285
472
  describe(`FeedbackStore contract: ${name}`, () => {
286
- it("keeps a rating with its reason, input, and output, open", async () => {
473
+ registerCleanup(t, opts);
474
+ it("keeps a rating with its reason, excerpt, input, and output, open", async () => {
287
475
  const store = await make();
288
- const f = await store.rate(rating());
476
+ const op = names()("triage");
477
+ const f = await store.rate(rating(op));
289
478
  expect(f).toMatchObject({
290
- operation: "triage",
479
+ operation: op,
480
+ targetId: "answer-1",
481
+ raterId: "person-1",
291
482
  rating: "DOWN",
292
- reason: "Wrong queue",
293
- excerpt: "billing",
294
- input: { subject: "Refund", body: "Please refund me." },
295
- output: { category: "bug" },
483
+ ...keeps,
296
484
  status: "OPEN",
297
485
  caseId: null,
298
486
  });
487
+ const listed = await store.listFeedback({ operation: op });
488
+ expect(listed).toHaveLength(1);
489
+ expect(listed[0]).toMatchObject({
490
+ id: f.id,
491
+ operation: op,
492
+ targetId: "answer-1",
493
+ raterId: "person-1",
494
+ rating: "DOWN",
495
+ ...keeps,
496
+ status: "OPEN",
497
+ });
299
498
  });
300
499
  it("keeps one rating per person per answer, and reopens a changed one", async () => {
301
500
  const store = await make();
302
- const first = await store.rate(rating());
303
- await store.setFeedbackStatus(first.id, "DISMISSED");
304
- const changed = await store.rate(rating({ rating: "UP" }));
501
+ const op = names()("triage");
502
+ const first = await store.rate(rating(op));
503
+ if (!lacks("status"))
504
+ await store.setFeedbackStatus(first.id, "DISMISSED");
505
+ const changed = await store.rate(rating(op, { rating: "UP" }));
305
506
  expect(changed.id).toBe(first.id);
507
+ expect(changed.rating).toBe("UP");
306
508
  expect(changed.status).toBe("OPEN");
307
509
  expect(changed.reason).toBeNull();
308
- await store.rate(rating({ raterId: "person-2" }));
309
- expect(await store.listFeedback()).toHaveLength(2);
510
+ await store.rate(rating(op, { raterId: "person-2" }));
511
+ expect(await store.listFeedback(scoped ? { operation: op } : {})).toHaveLength(2);
310
512
  });
311
513
  it("takes a rating back", async () => {
312
514
  const store = await make();
313
- await store.rate(rating());
314
- await store.clearRating("person-1", "triage", "answer-1");
315
- expect(await store.listFeedback()).toHaveLength(0);
515
+ const op = names()("triage");
516
+ await store.rate(rating(op));
517
+ await store.clearRating("person-1", op, "answer-1");
518
+ expect(await store.listFeedback(scoped ? { operation: op } : {})).toHaveLength(0);
316
519
  });
317
520
  it("filters by feature, rating, status, and date, newest first", async () => {
318
521
  const store = await make();
319
- const a = await store.rate(rating({ targetId: "a" }));
522
+ const n = names();
523
+ const op = n("triage");
524
+ const mine = scoped ? { operation: op } : {};
525
+ const a = await store.rate(rating(op, { targetId: "a" }));
320
526
  await new Promise((r) => setTimeout(r, 5));
321
- const b = await store.rate(rating({ targetId: "b", rating: "UP" }));
322
- await store.rate(rating({ targetId: "c", operation: "summary" }));
323
- expect((await store.listFeedback({ operation: "triage" })).map((f) => f.id)).toEqual([b.id, a.id]);
324
- expect(await store.listFeedback({ rating: "UP" })).toHaveLength(1);
325
- await store.setFeedbackStatus(a.id, "CASED", "case-1");
326
- const cased = await store.listFeedback({ status: "CASED" });
327
- expect(cased.map((f) => [f.id, f.caseId])).toEqual([[a.id, "case-1"]]);
527
+ const b = await store.rate(rating(op, { targetId: "b", rating: "UP" }));
528
+ await store.rate(rating(n("summary"), { targetId: "c" }));
529
+ expect((await store.listFeedback({ operation: op })).map((f) => f.id)).toEqual([b.id, a.id]);
530
+ expect((await store.listFeedback({ ...mine, rating: "UP" })).map((f) => f.id)).toEqual([b.id]);
531
+ expect((await store.listFeedback({ ...mine, rating: "DOWN" })).length).toBe(scoped ? 1 : 2);
532
+ if (lacks("status")) {
533
+ // Every rating reads as open, and none can be anything else.
534
+ expect(await store.listFeedback({ ...mine, status: "OPEN" })).toHaveLength(scoped ? 2 : 3);
535
+ expect(await store.listFeedback({ ...mine, status: "CASED" })).toHaveLength(0);
536
+ }
537
+ else {
538
+ const caseId = lacks("caseId") ? null : "case-1";
539
+ await store.setFeedbackStatus(a.id, "CASED", caseId);
540
+ const cased = await store.listFeedback({ ...mine, status: "CASED" });
541
+ expect(cased.map((f) => [f.id, f.caseId])).toEqual([[a.id, caseId]]);
542
+ }
328
543
  expect(await store.listFeedback({ since: new Date(Date.now() + 60_000) })).toHaveLength(0);
329
544
  expect(await store.listFeedback({ limit: 1 })).toHaveLength(1);
330
545
  });
546
+ for (const column of ["reason", "excerpt", "input", "output"]) {
547
+ if (!lacks(column))
548
+ continue;
549
+ it(`refuses a rating's ${column} it has no column for, and keeps none`, async () => {
550
+ const store = await make();
551
+ const op = names()("triage");
552
+ await expect(store.rate(rating(op, { [column]: kept[column] }))).rejects.toThrow(column);
553
+ expect(await store.listFeedback({ operation: op })).toHaveLength(0);
554
+ });
555
+ }
556
+ if (lacks("input"))
557
+ it("says in plain words that no rating can become a case", async () => {
558
+ const store = await make();
559
+ const op = names()("triage");
560
+ const f = await store.rate(rating(op));
561
+ expect(f.keepsInputs).toBe(false);
562
+ expect(whyNotACase(f, undefined)).toBe(NO_INPUTS_KEPT);
563
+ const [read] = await store.listFeedback({ operation: op });
564
+ expect(read && whyNotACase(read, undefined)).toBe(NO_INPUTS_KEPT);
565
+ });
566
+ if (lacks("status"))
567
+ it("refuses a status it has no column for, and leaves the rating open", async () => {
568
+ const store = await make();
569
+ const op = names()("triage");
570
+ const f = await store.rate(rating(op));
571
+ await expect(store.setFeedbackStatus(f.id, "DISMISSED")).rejects.toThrow("status");
572
+ const [read] = await store.listFeedback({ operation: op });
573
+ expect(read?.status).toBe("OPEN");
574
+ });
575
+ if (lacks("caseId") && !lacks("status"))
576
+ it("refuses a case id it has no column for, and changes nothing", async () => {
577
+ const store = await make();
578
+ const op = names()("triage");
579
+ const f = await store.rate(rating(op));
580
+ await expect(store.setFeedbackStatus(f.id, "CASED", "case-1")).rejects.toThrow("caseId");
581
+ const [read] = await store.listFeedback({ operation: op });
582
+ expect(read).toMatchObject({ status: "OPEN", caseId: null });
583
+ });
331
584
  });
332
585
  }
333
586
  /**
334
587
  * The contract every SettingsStore must meet. `make` must return an empty
335
- * store each time it's called; `opts.without` names settings its tables
336
- * have no column for (see `StoreContractOptions`).
588
+ * store each time it's called, unless `opts.scope` is set (see
589
+ * `describeStoreContract`): then every feature the contract versions
590
+ * starts with the scope. `opts.without` names settings its tables have no
591
+ * column for (see `StoreContractOptions`).
337
592
  */
338
593
  export function describeSettingsStoreContract(name, make, opts = {}) {
594
+ const t = testFunctions(opts.test);
595
+ const { describe, it, expect } = t;
596
+ const names = scopeNames(opts.scope);
339
597
  const settings = (model) => ({
340
598
  model,
341
599
  fallbackModel: null,
@@ -350,29 +608,34 @@ export function describeSettingsStoreContract(name, make, opts = {}) {
350
608
  expectLive,
351
609
  });
352
610
  describe(`SettingsStore contract: ${name}`, () => {
611
+ registerCleanup(t, opts);
353
612
  it("has nothing live until the first switch, then numbers versions", async () => {
354
613
  const store = await make();
355
- expect(await store.liveVersion("triage")).toBeNull();
356
- const v1 = await store.switchTo("triage", create("a", null));
357
- const v2 = await store.switchTo("triage", create("b", v1.id));
614
+ const op = names()("triage");
615
+ expect(await store.liveVersion(op)).toBeNull();
616
+ const v1 = await store.switchTo(op, create("a", null));
617
+ const v2 = await store.switchTo(op, create("b", v1.id));
358
618
  expect([v1.number, v2.number]).toEqual([1, 2]);
359
619
  expect(v2).toMatchObject({
360
- operation: "triage",
620
+ operation: op,
361
621
  model: "b",
362
622
  promptVersion: "p1",
363
623
  });
364
- expect((await store.liveVersion("triage"))?.id).toBe(v2.id);
365
- expect((await store.listVersions("triage")).map((v) => v.number)).toEqual([2, 1]);
624
+ expect((await store.liveVersion(op))?.id).toBe(v2.id);
625
+ expect((await store.listVersions(op)).map((v) => v.number)).toEqual([
626
+ 2, 1,
627
+ ]);
366
628
  });
367
629
  it("logs every switch, newest first, with who, why, and evidence", async () => {
368
630
  const store = await make();
369
- const v1 = await store.switchTo("triage", create("a", null));
370
- await store.switchTo("triage", {
631
+ const op = names()("triage");
632
+ const v1 = await store.switchTo(op, create("a", null));
633
+ await store.switchTo(op, {
371
634
  ...create("b", v1.id),
372
635
  kind: "PROMOTE",
373
636
  evidence: { runId: "r1", verdict: "BETTER" },
374
637
  });
375
- const [latest, first] = await store.listChanges("triage");
638
+ const [latest, first] = await store.listChanges(op);
376
639
  expect(latest).toMatchObject({
377
640
  kind: "PROMOTE",
378
641
  fromVersionId: v1.id,
@@ -381,33 +644,36 @@ export function describeSettingsStoreContract(name, make, opts = {}) {
381
644
  evidence: { runId: "r1", verdict: "BETTER" },
382
645
  });
383
646
  expect(first).toMatchObject({ kind: "CHANGE", fromVersionId: null });
384
- expect(await store.listChanges("triage", { limit: 1 })).toHaveLength(1);
647
+ expect(await store.listChanges(op, { limit: 1 })).toHaveLength(1);
385
648
  });
386
649
  it("makes an earlier version live again without a new one", async () => {
387
650
  const store = await make();
388
- const v1 = await store.switchTo("triage", create("a", null));
389
- const v2 = await store.switchTo("triage", create("b", v1.id));
390
- await store.switchTo("triage", {
651
+ const op = names()("triage");
652
+ const v1 = await store.switchTo(op, create("a", null));
653
+ const v2 = await store.switchTo(op, create("b", v1.id));
654
+ await store.switchTo(op, {
391
655
  versionId: v1.id,
392
656
  kind: "ROLLBACK",
393
657
  reason: "b was worse",
394
658
  by: "person-1",
395
659
  expectLive: v2.id,
396
660
  });
397
- expect((await store.liveVersion("triage"))?.id).toBe(v1.id);
398
- expect(await store.listVersions("triage")).toHaveLength(2);
661
+ expect((await store.liveVersion(op))?.id).toBe(v1.id);
662
+ expect(await store.listVersions(op)).toHaveLength(2);
399
663
  });
400
664
  it("refuses a switch decided against a live version that changed", async () => {
401
665
  const store = await make();
402
- const v1 = await store.switchTo("triage", create("a", null));
403
- await store.switchTo("triage", create("b", v1.id));
404
- await expect(store.switchTo("triage", create("c", v1.id))).rejects.toBeInstanceOf(SettingsConflict);
405
- expect((await store.liveVersion("triage"))?.model).toBe("b");
406
- expect(await store.listVersions("triage")).toHaveLength(2);
666
+ const op = names()("triage");
667
+ const v1 = await store.switchTo(op, create("a", null));
668
+ await store.switchTo(op, create("b", v1.id));
669
+ await expect(store.switchTo(op, create("c", v1.id))).rejects.toBeInstanceOf(SettingsConflict);
670
+ expect((await store.liveVersion(op))?.model).toBe("b");
671
+ expect(await store.listVersions(op)).toHaveLength(2);
407
672
  });
408
673
  it("keeps a version's reasoning setting as named, even a newer one", async () => {
409
674
  const store = await make();
410
- const v1 = await store.switchTo("triage", {
675
+ const op = names()("triage");
676
+ const v1 = await store.switchTo(op, {
411
677
  ...create("a", null),
412
678
  create: {
413
679
  settings: { ...settings("a"), reasoningEffort: "xhigh" },
@@ -415,27 +681,29 @@ export function describeSettingsStoreContract(name, make, opts = {}) {
415
681
  },
416
682
  });
417
683
  expect(v1.reasoningEffort).toBe("xhigh");
418
- expect((await store.liveVersion("triage"))?.reasoningEffort).toBe("xhigh");
684
+ expect((await store.liveVersion(op))?.reasoningEffort).toBe("xhigh");
419
685
  });
420
686
  if (opts.without?.includes("temperature")) {
421
687
  it("refuses a temperature it has no column for, and keeps none", async () => {
422
688
  const store = await make();
423
- await expect(store.switchTo("triage", {
689
+ const op = names()("triage");
690
+ await expect(store.switchTo(op, {
424
691
  ...create("a", null),
425
692
  create: {
426
693
  settings: { ...settings("a"), temperature: 0.4 },
427
694
  promptVersion: "p1",
428
695
  },
429
696
  })).rejects.toThrow("temperature");
430
- expect(await store.liveVersion("triage")).toBeNull();
431
- const v1 = await store.switchTo("triage", create("a", null));
697
+ expect(await store.liveVersion(op)).toBeNull();
698
+ const v1 = await store.switchTo(op, create("a", null));
432
699
  expect(v1.temperature ?? null).toBeNull();
433
700
  });
434
701
  }
435
702
  else {
436
703
  it("keeps a version's temperature", async () => {
437
704
  const store = await make();
438
- const v1 = await store.switchTo("triage", {
705
+ const op = names()("triage");
706
+ const v1 = await store.switchTo(op, {
439
707
  ...create("a", null),
440
708
  create: {
441
709
  settings: { ...settings("a"), temperature: 0.4 },
@@ -443,18 +711,114 @@ export function describeSettingsStoreContract(name, make, opts = {}) {
443
711
  },
444
712
  });
445
713
  expect(v1.temperature).toBe(0.4);
446
- expect((await store.liveVersion("triage"))?.temperature).toBe(0.4);
447
- const v2 = await store.switchTo("triage", create("b", v1.id));
714
+ expect((await store.liveVersion(op))?.temperature).toBe(0.4);
715
+ const v2 = await store.switchTo(op, create("b", v1.id));
448
716
  expect(v2.temperature ?? null).toBeNull();
449
717
  });
450
718
  }
719
+ it("keeps every kind of change, with its evidence", async () => {
720
+ const store = await make();
721
+ const op = names()("triage");
722
+ let live = (await store.switchTo(op, create("a", null))).id;
723
+ for (const kind of CHANGE_KINDS.slice(1))
724
+ live = (await store.switchTo(op, {
725
+ ...create(kind.toLowerCase(), live),
726
+ kind,
727
+ evidence: kind === "PROMOTE" ? { runId: "r1" } : undefined,
728
+ })).id;
729
+ const changes = await store.listChanges(op);
730
+ expect(changes.map((c) => c.kind)).toEqual([...CHANGE_KINDS].reverse());
731
+ expect(changes.map((c) => c.evidence)).toEqual([
732
+ null,
733
+ null,
734
+ null,
735
+ null,
736
+ { runId: "r1" },
737
+ null,
738
+ ]);
739
+ });
451
740
  it("keeps each feature's versions and live one apart", async () => {
452
741
  const store = await make();
453
- await store.switchTo("triage", create("a", null));
454
- const other = await store.switchTo("summary", create("x", null));
742
+ const n = names();
743
+ await store.switchTo(n("triage"), create("a", null));
744
+ const other = await store.switchTo(n("summary"), create("x", null));
455
745
  expect(other.number).toBe(1);
456
- expect((await store.liveVersion("triage"))?.model).toBe("a");
746
+ expect((await store.liveVersion(n("triage")))?.model).toBe("a");
457
747
  });
458
748
  });
459
749
  }
750
+ /**
751
+ * The contract every set of suites should meet, so people confirming
752
+ * answers weeks later (and the pages) can read them: unique keys, a label
753
+ * and help for every top-level field of each suite's input and answer,
754
+ * a description for every check, and starter cases that fit the suite's
755
+ * own schemas. One test per suite, listing what's missing in plain words
756
+ * (`suiteContractProblems`).
757
+ *
758
+ * @param name - What the tests are called, e.g. "our suites".
759
+ * @param suites - Every suite the app registers.
760
+ * @param opts - Test functions other than Vitest's.
761
+ *
762
+ * @example
763
+ * ```ts
764
+ * import { describeSuiteContract } from "@crowandraven/evalkeeper/testing";
765
+ * import { SUITES } from "../lib/suites";
766
+ *
767
+ * describeSuiteContract("our suites", SUITES);
768
+ * ```
769
+ */
770
+ export function describeSuiteContract(name, suites, opts = {}) {
771
+ const { describe, it, expect } = testFunctions(opts.test);
772
+ describe(`Suite contract: ${name}`, () => {
773
+ it("has unique keys", () => {
774
+ expect(suiteContractProblems(suites).filter((p) => p.endsWith("another suite has the same key."))).toEqual([]);
775
+ });
776
+ for (const suite of suites)
777
+ it(`${suite.key}: every field, check, and starter can be read`, () => {
778
+ expect(suiteContractProblems([suite]), "What's missing for people to read this suite").toEqual([]);
779
+ });
780
+ });
781
+ }
782
+ /**
783
+ * A read-only check, as a test, that a store mapped onto your own tables
784
+ * reads what's already there: one test per suite that fails listing every
785
+ * case, answer, test, and output that doesn't parse, with counts. It only
786
+ * reads, so it's the check to run first, on a copy of real data. Pass the
787
+ * report from `checkStoreReads` (any store) or `prismaReadCheck` (sees a
788
+ * Prisma table's values before the store fills in defaults).
789
+ *
790
+ * @param name - What the tests are called, e.g. "our answer key".
791
+ * @param check - Makes the report; called once, when the tests run.
792
+ * @param opts - The suite keys to name a test for, and test functions
793
+ * other than Vitest's.
794
+ *
795
+ * @example
796
+ * ```ts
797
+ * import { describeMappedReadCheck } from "@crowandraven/evalkeeper/testing";
798
+ * import { prismaReadCheck } from "@crowandraven/evalkeeper-prisma";
799
+ *
800
+ * describeMappedReadCheck(
801
+ * "our answer key",
802
+ * () => prismaReadCheck(prisma, map, { suites: SUITES }),
803
+ * { suites: SUITES.map((s) => s.key) },
804
+ * );
805
+ * ```
806
+ */
807
+ export function describeMappedReadCheck(name, check, opts) {
808
+ const { describe, it, expect } = testFunctions(opts.test);
809
+ let report = null;
810
+ const once = () => (report ??= check());
811
+ describe(`Read check: ${name}`, () => {
812
+ for (const key of opts.suites)
813
+ it(`${key}: every case, answer, test, and output reads`, async () => {
814
+ const found = (await once()).suites.find((s) => s.suite === key);
815
+ expect(found, `The check found no report for ${key}`).toMatchObject({
816
+ suite: key,
817
+ });
818
+ if (!found)
819
+ return;
820
+ expect(found.problems, readCheckSummary({ suites: [found] }).join("\n")).toEqual([]);
821
+ });
822
+ });
823
+ }
460
824
  //# sourceMappingURL=testing.js.map