Optionalanswers?: ImportAnswers<Row>Where the rows came from, such as a file name.
Optionalsplit?: "DEV" | "TEST" | "auto"const { added, skipped } = await importCases({
store,
suite: ticketTriage,
source: "tickets-heldout.json",
rows: JSON.parse(await readFile("tickets-heldout.json", "utf8")),
map: (r) => ({ id: r.id, input: { body: r.text }, label: { queue: r.queue } }),
split: "TEST",
});
// Answers people already reviewed in an old harness:
await importCases({
store,
suite: ticketTriage,
source: "old-harness",
rows,
map,
answers: {
status: "CONFIRMED",
confirmedBy: (r) => r.reviewer,
at: (r) => r.reviewedAt,
},
});
Imports existing test data as cases for one suite. Every row is mapped and checked against the suite's input and answer schemas first; if any row fails, nothing is written and
CaseImportErrorlists them. Rows imported before (same source and id, retired ones included) are skipped, so it can run again after the file grows.Splits: "DEV" for cases you tune against, "TEST" for a held-out file, "auto" (the default) for new cases, split like cases added by hand.
A suite with a leak check (
withoutLeaks) has it run on every input before it's frozen;removedin the result lists what it took out of each case, and the case's note says so too.Answers arrive pending unless
answerssays otherwise (seeImportAnswers); import them confirmed only when a person reviewed them in the old system, naming who and when on every row.Run it against your development database; an app's own guard should refuse a production one.