feat: 诊断(任务书 18 第一块):诊断数学、四种提交、一次运行跑多个实验、账本与材料、flow 诊断各步
消融默认关,关掉时解释阶段一并跳过;选诊断实验用信息价值减成本。 eval/diagnosis/research.json 为第三块配置。vocab 字段说明的出口文字随提示词一起改,见下一次提交的 prompts/ 与同文件改动(本次含在内)。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -260,3 +260,23 @@ test("比较的行号:改一行、加几行、只删不加,新旧两边的
|
||||
// 给模型看的差异原文带 3 行上下文:三处改动相隔不到 6 行,合成一块。
|
||||
assert.match(result.diff, /^@@ -1,10 \+1,12 @@\n a\n-b\n\+B\n c\n d\n e\n\+X\n\+Y\n\+Z\n f\n g\n-h\n i\n j\n$/m);
|
||||
});
|
||||
|
||||
test("诊断程序(任务书 18):基线代码取出后放进只读的原始产物、改成诊断程序再存,产物被跳过,比较只看程序的改动,取出再存号不变", (t) => {
|
||||
const repo = newRepo(t);
|
||||
const baseline = save(repo, makeDir(t, { "initial.py": "a\nb\n", "evaluate.py": "e\n" }), []);
|
||||
const workDir = checkout(t, repo, baseline);
|
||||
// 原始产物放进实验员工作目录,设成只读(0444),与 tasks 的 placeBaselineArtifact 一样。
|
||||
mkdirSync(join(workDir, "baseline-artifact"));
|
||||
writeFileSync(join(workDir, "baseline-artifact", "solution.json"), "{}");
|
||||
chmodSync(join(workDir, "baseline-artifact", "solution.json"), 0o444);
|
||||
writeFileSync(join(workDir, "initial.py"), "a\nb\nexperiment\n");
|
||||
const excluded = ["__pycache__", "solution.json", "baseline-artifact"];
|
||||
const program = save(repo, workDir, excluded);
|
||||
assert.notEqual(program, baseline);
|
||||
const comparison = compareVersions(repo, baseline, program);
|
||||
assert.deepEqual(comparison.files.map((f) => f.path), ["initial.py"]);
|
||||
assert.deepEqual((comparison.files[0] as Extract<FileChange, { binary: false }>).hunks, [{ from: { after: 2 }, to: { start: 3, end: 3 } }]);
|
||||
const again = checkout(t, repo, program);
|
||||
assert.equal(existsSync(join(again, "baseline-artifact")), false);
|
||||
assert.equal(save(repo, again, excluded), program);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user