feat: 任务书 10,submissions 模块与 materials 修改
- 新增 src/submissions:先程序检查(14 条跨字段规则、不许改的文件、代码存不了、指标编号占用、提案数上限),全过再问 Jev;退回原因列出该写的全部编号;回应/统一拼冻结协议主体只在这一处;核验、消融核验通过没有。 - materials:挑刺单写"现在交什么";退回按阶段、作者、种类、对象找(ledger 退回记录加 target,表结构版本 4);核验材料去掉 Jev 预扫;信念本写合法化;删"本该关着";消融核验不通过可重做,不跑的格从 cellNotRun 事件读原因。 - 用户 2026-10-03 定:冻结协议去掉 replies、replyBody,第二次预测的答复从已公开的回应或统一读;takenMetricIds 加两个保留键;解释一律交 cells;Jev 退回只列判"是"的几问、用英文问题名。 - jev 判重材料带 keySettings;读代码工具删 offset;三处旧说法改正。 - 文档:结构.md 第四、七、八部分,WORK_LOG。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -220,15 +220,16 @@ test("退回:被退回的内容原样存;程序检查退回的 jev 为 null
|
||||
judgment("self_contradictory", 0.02, 0.6, "req-2"),
|
||||
judgment("too_vague", 0.1, 0.7, "req-3"),
|
||||
];
|
||||
ledger.append("rejection", { stageId: "s1", author: "r1", kind: "proposal", submitted: malformed, reason: "因子清单格式不对", jev: null });
|
||||
ledger.append("rejection", { stageId: "s1", author: "r1", kind: "proposal", target: null, submitted: malformed, reason: "因子清单格式不对", jev: null });
|
||||
ledger.append("rejection", {
|
||||
stageId: "s6", author: "r2", kind: "response", submitted: { body: "改了评测" }, reason: "冻结条款改动了评测", jev: clauses,
|
||||
stageId: "s6", author: "r2", kind: "response", target: "r1-c1", submitted: { body: "改了评测" }, reason: "冻结条款改动了评测", jev: clauses,
|
||||
});
|
||||
ledger.close();
|
||||
const reopened = Ledger.open(path);
|
||||
t.after(() => reopened.close());
|
||||
const rejections = reopened.records().filter((r) => r.kind === "rejection");
|
||||
assert.deepEqual(rejections.map((r) => r.content.submitted), [malformed, { body: "改了评测" }]);
|
||||
assert.deepEqual(rejections.map((r) => r.content.target), [null, "r1-c1"]);
|
||||
assert.equal(rejections[0]!.content.jev, null);
|
||||
assert.deepEqual(rejections[1]!.content.jev, [
|
||||
{ question: "changes_measurement", questionHash: "ab".repeat(32), threshold: 0.5, probability: 0.97, yes: true, requestId: "req-1" },
|
||||
@@ -237,6 +238,15 @@ test("退回:被退回的内容原样存;程序检查退回的 jev 为 null
|
||||
]);
|
||||
});
|
||||
|
||||
test("退回:对象字段必填,没有对象写 null;不写就拒收", (t) => {
|
||||
const { ledger, path } = freshLedger(t);
|
||||
assert.throws(
|
||||
() => ledger.append("rejection", { stageId: "s1", author: "r1", kind: "proposal", submitted: {}, reason: "缺对象", jev: null } as never),
|
||||
/账本记录"rejection"的内容不符合定义/,
|
||||
);
|
||||
assert.equal(countRows(path), 0);
|
||||
});
|
||||
|
||||
test("退回:jev 不合 JevJudgment 的拒收,一条都不写", (t) => {
|
||||
const { ledger, path } = freshLedger(t);
|
||||
const good = judgment("same_change", 0.9, 0.5, "req-1");
|
||||
@@ -256,7 +266,7 @@ test("退回:jev 不合 JevJudgment 的拒收,一条都不写", (t) => {
|
||||
];
|
||||
for (const jev of bad) {
|
||||
assert.throws(
|
||||
() => ledger.append("rejection", { stageId: "s1", author: "r1", kind: "proposal", submitted: {}, reason: "判为同一个改法", jev } as never),
|
||||
() => ledger.append("rejection", { stageId: "s1", author: "r1", kind: "proposal", target: null, submitted: {}, reason: "判为同一个改法", jev } as never),
|
||||
/账本记录"rejection"的内容不符合定义/,
|
||||
JSON.stringify(jev),
|
||||
);
|
||||
@@ -436,12 +446,12 @@ test("打开:表结构版本不对报错;不是空文件也不是账本的
|
||||
db.close();
|
||||
assert.throws(() => Ledger.open(wrongVersion), /版本是 99/);
|
||||
|
||||
// 版本 2 是"模型调用结束"还没有墙钟时间、退回还没有 Jev 判断数组时的账本,不迁移,打开报错。
|
||||
const previous = join(dir, "v2.db");
|
||||
const v2 = new DatabaseSync(previous);
|
||||
v2.exec("PRAGMA user_version = 2");
|
||||
v2.close();
|
||||
assert.throws(() => Ledger.open(previous), /版本是 2.*只认版本 3/s);
|
||||
// 版本 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);
|
||||
|
||||
const foreign = join(dir, "foreign.db");
|
||||
const other = new DatabaseSync(foreign);
|
||||
|
||||
Reference in New Issue
Block a user