feat: 诊断(任务书 18 第一块):诊断数学、四种提交、一次运行跑多个实验、账本与材料、flow 诊断各步
消融默认关,关掉时解释阶段一并跳过;选诊断实验用信息价值减成本。 eval/diagnosis/research.json 为第三块配置。vocab 字段说明的出口文字随提示词一起改,见下一次提交的 prompts/ 与同文件改动(本次含在内)。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -438,6 +438,16 @@ test("关掉再打开:读出的记录不变,序号接着往下排", (t) => {
|
||||
assert.equal(reopened.append("runStarted", { run: "run1" }).seq, 9);
|
||||
});
|
||||
|
||||
test("唯一约束:诊断结算按轮次,同一轮两次报错;同一轮的消融结算另算,不受它影响", (t) => {
|
||||
const { ledger, path } = freshLedger(t);
|
||||
ledger.append("diagnosisSettlement", { round: 1, result: { experiments: [] } });
|
||||
assert.throws(() => ledger.append("diagnosisSettlement", { round: 1, result: { experiments: [] } }), /diagnosis_settlement_once/);
|
||||
ledger.append("diagnosisSettlement", { round: 2, result: { experiments: [] } });
|
||||
ledger.append("settlement", { round: 1, result: { cells: {} } });
|
||||
assert.throws(() => ledger.append("diagnosisSettlement", { round: 3, run: "x", result: {} } as never), /diagnosisSettlement/);
|
||||
assert.equal(countRows(path), 3);
|
||||
});
|
||||
|
||||
test("打开:表结构版本不对报错;不是空文件也不是账本的库报错", (t) => {
|
||||
const dir = tempDir(t);
|
||||
const wrongVersion = join(dir, "v99.db");
|
||||
@@ -446,12 +456,12 @@ test("打开:表结构版本不对报错;不是空文件也不是账本的
|
||||
db.close();
|
||||
assert.throws(() => Ledger.open(wrongVersion), /版本是 99/);
|
||||
|
||||
// 版本 3 是退回还没有对象字段时的账本,不迁移,打开报错。
|
||||
const previous = join(dir, "v3.db");
|
||||
const v3 = new DatabaseSync(previous);
|
||||
v3.exec("PRAGMA user_version = 3");
|
||||
v3.close();
|
||||
assert.throws(() => Ledger.open(previous), /版本是 3.*只认版本 4/s);
|
||||
// 版本 4 是还没有诊断结算和诊断运行用途时的账本,不迁移,打开报错。
|
||||
const previous = join(dir, "v4.db");
|
||||
const v4 = new DatabaseSync(previous);
|
||||
v4.exec("PRAGMA user_version = 4");
|
||||
v4.close();
|
||||
assert.throws(() => Ledger.open(previous), /版本是 4.*只认版本 5/s);
|
||||
|
||||
const foreign = join(dir, "foreign.db");
|
||||
const other = new DatabaseSync(foreign);
|
||||
|
||||
Reference in New Issue
Block a user