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:
@@ -3,7 +3,7 @@ import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { test } from "node:test";
|
||||
import { Ledger } from "../src/ledger/index.ts";
|
||||
import { beliefBook, queryMaterial } from "../src/materials/index.ts";
|
||||
import { beliefBook, cellNotRunEvent, queryMaterial } from "../src/materials/index.ts";
|
||||
import { adopt, selectBestExpected, settleAblation, type BatchInput, type SettleInput } from "../src/rules/index.ts";
|
||||
import { tempDir } from "./ledger-helpers.ts";
|
||||
import { batch, judged, material, NONE, P_A1, P_A2, protocolOf, r, study, studyUpTo, TABLE_C1, Writer } from "./materials-helpers.ts";
|
||||
@@ -31,8 +31,8 @@ const adoptInput = (baseline: number, candidates: Array<{ id: string; score: num
|
||||
function roundOneNoAdoption(t: import("node:test").TestContext, before: (w: Writer) => void): Writer {
|
||||
const w = fresh(t);
|
||||
before(w);
|
||||
w.protocol("r1-c1", protocolOf(P_A1, 1, "base", ["r1-a1-1"], [], ["c"]));
|
||||
w.protocol("r1-c2", protocolOf(P_A2, 1, "base", ["r1-a2-1"], [], ["c"]));
|
||||
w.protocol("r1-c1", protocolOf(P_A1, 1, "base", ["r1-a1-1"], ["c"]));
|
||||
w.protocol("r1-c2", protocolOf(P_A2, 1, "base", ["r1-a2-1"], ["c"]));
|
||||
const b1 = batch(1, 0.96, { "r1-c1": { a1: r(1.0, 1.1, 1.2) }, "r1-c2": { a1: r(0.95, 0.97, 0.99) } });
|
||||
assert.deepEqual(b1.output.chosen, ["r1-c1"]);
|
||||
w.decision("batch", 1, b1.input, b1.output);
|
||||
@@ -79,6 +79,12 @@ test("第二次预测:留池候选按 carried 判,不取它上一轮的第
|
||||
w.open("s1-fp", "firstPrediction", 1, ["a1"]);
|
||||
w.sub("s1-fp", "a1", "firstPrediction", "r1-c2", null, { range: r(4.441, 4.442, 4.443), body: "上一轮的第一次" });
|
||||
w.close("s1-fp");
|
||||
w.open("s1-crit", "critique", 1, ["a1"]);
|
||||
w.sub("s1-crit", "a1", "critique", "r1-a1-2", "r1-a1-2.a1.1", { target: "p1", body: "第 1 轮对乙方案的挑刺" });
|
||||
w.close("s1-crit");
|
||||
w.open("s1-resp", "response", 1, ["a1"]);
|
||||
w.sub("s1-resp", "a1", "response", "r1-c2", null, { replies: [{ critique: "r1-a1-2.a1.1", reply: "第 1 轮的答复" }], changes: {}, clauses: ["c"], body: "第 1 轮的答复正文" });
|
||||
w.close("s1-resp");
|
||||
});
|
||||
w.open("s2-prop", "proposal", 2, ["a1"]);
|
||||
w.close("s2-prop");
|
||||
@@ -87,6 +93,8 @@ test("第二次预测:留池候选按 carried 判,不取它上一轮的第
|
||||
const m = material(w.l, "secondPrediction", "a1", "s2-sp", "r1-c2", NONE);
|
||||
assert.ok(m.firstMessage.includes("(这是留池候选,本轮没有第一次预测)"));
|
||||
assert.ok(!m.firstMessage.includes("4.442"));
|
||||
// 留池候选沿用原来的冻结协议和回应(4.3 ①):答复从它第 1 轮的回应读。
|
||||
for (const x of ["第 1 轮对乙方案的挑刺", "作者的答复:第 1 轮的答复", "第 1 轮的答复正文"]) assert.ok(m.firstMessage.includes(x), x);
|
||||
});
|
||||
|
||||
test("离池:基线变了、从没入选的旧候选列在离开候选池里,不再写留池", (t) => {
|
||||
@@ -116,7 +124,7 @@ test("信念本的数按条文手算:少多少分、撑几成、世界比特
|
||||
};
|
||||
// 这里只要 c3 入选并跑过:选批记录的其余内容照规则算出,chosen 写成 c3。
|
||||
w.decision("batch", 1, input, { ...selectBestExpected(input), chosen: ["r1-v1-c3"] });
|
||||
w.protocol("r1-v1-c3", protocolOf(P_A1, 1, "base", ["r1-a1-1"], [], ["c"]));
|
||||
w.protocol("r1-v1-c3", protocolOf(P_A1, 1, "base", ["r1-a1-1"], ["c"]));
|
||||
w.l.append("code", { object: "r1-v1-c3", version: "v-c3", locations: TABLE_C1 });
|
||||
w.run("run-1", "forward", 1, "r1-v1-c3", judged(full, "main"));
|
||||
const a = adoptInput(b, [{ id: "r1-v1-c3", score: full }]);
|
||||
@@ -183,3 +191,52 @@ test("解释的现在交什么写明每人最多 M 条", (t) => {
|
||||
const m = material(studyUpTo(t, "explOpen1"), "explanation", "a1", "s1-expl", null, { changes: null, artifacts: {} });
|
||||
assert.ok(m.firstMessage.slice(m.firstMessage.lastIndexOf("# 现在交什么")).includes("最多 2 条"));
|
||||
});
|
||||
|
||||
/** 第 1 轮冻结 r1-c1(两个因子)、选中、跑出 run1Judged、采纳。 */
|
||||
function roundOneAdopted(t: import("node:test").TestContext, run1Judged: ReturnType<typeof judged>): Writer {
|
||||
const w = fresh(t);
|
||||
w.protocol("r1-c1", protocolOf(P_A1, 1, "base", ["r1-a1-1"], ["c"]));
|
||||
const b1 = batch(1, 0.96, { "r1-c1": { a1: r(1.0, 1.1, 1.2) } });
|
||||
w.decision("batch", 1, b1.input, b1.output);
|
||||
w.l.append("code", { object: "r1-c1", version: "v-c1", locations: TABLE_C1 });
|
||||
w.run("run-1", "forward", 1, "r1-c1", run1Judged);
|
||||
const a1 = adoptInput(0.96, [{ id: "r1-c1", score: 1.2 }]);
|
||||
w.decision("adopt", 1, a1, adopt(a1));
|
||||
return w;
|
||||
}
|
||||
|
||||
test("选批历史的每次运行后面原样写出任务的附加记录(合法化扣掉的分,方法.md 6.10 第 3 条)", (t) => {
|
||||
const extra = { legalization: { applied: true, deduction: { status: "measured", value: 0.0012 } } };
|
||||
const w = roundOneAdopted(t, { ...judged(1.2, "main"), extra });
|
||||
const book = beliefBook(w.l, study, 1);
|
||||
assert.ok(book.includes('任务的附加记录(含合法化,原样):{"legalization":{"applied":true,"deduction":{"status":"measured","value":0.0012}}}'), book);
|
||||
});
|
||||
|
||||
test("消融格因核验不通过、重做次数用完而不跑:没有运行,证据不足的原因从事件读,信念本照样写得出", (t) => {
|
||||
const w = roundOneAdopted(t, judged(1.2, "main"));
|
||||
// p1 跑了,答案出自被关掉的 p1 本身:只照实写答案出处,不另加"本该关着"。p2 不跑。
|
||||
w.l.append("code", { object: "r1-c1-p1", version: "v-c1-p1", locations: null });
|
||||
w.run("run-2", "ablation", 1, "r1-c1-p1", judged(1.08, "p1"));
|
||||
w.l.append("event", cellNotRunEvent("r1-c1-p2", "消融核验不通过,修复次数用完"));
|
||||
const settle: SettleInput = {
|
||||
baseline: 0.96,
|
||||
full: 1.2,
|
||||
direction: "maximize",
|
||||
epsilon: 0.01,
|
||||
knownBest: 2.635983,
|
||||
lambda: 0.1,
|
||||
factors: ["p1", "p2"],
|
||||
cells: [
|
||||
{ factor: "p1", outcome: { kind: "valid", score: 1.08 } },
|
||||
{ factor: "p2", outcome: { kind: "insufficient" } },
|
||||
],
|
||||
explanations: [{ id: "r1-a1-x1", author: "a1", cells: [{ factor: "p1", range: r(1.0, 1.1, 1.15) }, { factor: "p2", range: r(1.1, 1.15, 1.19) }] }],
|
||||
};
|
||||
w.l.append("settlement", { round: 1, result: { candidate: "r1-c1", input: settle, output: settleAblation(settle) } as never });
|
||||
const book = beliefBook(w.l, study, 2);
|
||||
assert.ok(book.includes("- r1-c1-p2 停滞扰动(停滞扰动的设定):候选 r1-c1,基线 base;证据不足:消融核验不通过,修复次数用完;测前合并范围"), book);
|
||||
// G = 1.2 − 0.96 = 0.24;关 p1 少 0.12,撑 0.5 → 50%。
|
||||
assert.ok(book.includes("关掉后 1.08,少 0.12 分,撑 50%"), book);
|
||||
assert.ok(book.includes("答案出自 p1"));
|
||||
assert.ok(!book.includes("本该关着"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user