feat: 任务书 06,workspace 模块与 task.json 的"不存"清单
workspace 用一个裸仓库存代码版本,版本号是目录树编号,不造提交,每个版本挂 refs/versions/ 引用防清理。 存版本自己遍历目录、hash-object --no-filters 存,不用 git add;符号链接等特殊文件交回"存不了"。 取出用 ls-tree 加 cat-file 原样写出:实测 git archive 会按树里的 .gitattributes 丢文件、改换行符。 git 子进程不读系统和用户的配置,另关掉系统和用户的 attributes 文件:实测只关配置时 ~/.config/git/attributes 仍会被读。 比较交回文件级改动、新旧两边行号范围的块,以及带上下文的 diff 原文。 tasks:task.json 加必填的 unversionedNames,protectedFiles 删掉 solution.json。 全新上下文审阅一轮,采纳一条:注明块可以为空(空文件增删、只改可执行位)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -148,6 +148,7 @@ test("读任务:task.json 的值、Dockerfile 所在目录、TASK.md 全文;
|
||||
assert.equal(task.facts.epsilon, 0.01);
|
||||
assert.equal(task.facts.knownBest, 2.635983);
|
||||
assert.deepEqual(task.facts.run, { wallSeconds: 120, cores: 1, runtime: "runc" });
|
||||
assert.deepEqual(task.facts.unversionedNames, ["__pycache__", ".git", "solution.json", "metrics.json"]);
|
||||
assert.ok(existsSync(join(task.dir, "Dockerfile")));
|
||||
assert.match(task.guide, /^# 填圆任务/);
|
||||
const ids = metricDefinitions(task).map((d) => `${d.layer}:${d.id}`);
|
||||
@@ -173,12 +174,14 @@ test("task.json:缺字段、多字段、类型不对,一次全部列出,
|
||||
extra: true,
|
||||
} as Record<string, unknown>;
|
||||
delete bad.protectedFiles;
|
||||
delete bad.unversionedNames;
|
||||
assert.throws(
|
||||
() => checkTaskFacts(bad),
|
||||
(error: Error) => {
|
||||
const lines = error.message.split("\n").slice(1);
|
||||
assert.match(error.message, /^task\.json 不合格,共 6 处/);
|
||||
assert.match(error.message, /^task\.json 不合格,共 7 处/);
|
||||
assert.ok(lines.some((l) => l.startsWith("/protectedFiles:缺少")), error.message);
|
||||
assert.ok(lines.some((l) => l.startsWith("/unversionedNames:缺少")), error.message);
|
||||
assert.ok(lines.some((l) => l.startsWith("/extra:不认识的字段")), error.message);
|
||||
assert.ok(lines.some((l) => l.startsWith("/epsilon:")), error.message);
|
||||
assert.ok(lines.some((l) => l.startsWith("/knownBest:应为数字,没有就写 null")), error.message);
|
||||
@@ -188,6 +191,8 @@ test("task.json:缺字段、多字段、类型不对,一次全部列出,
|
||||
},
|
||||
);
|
||||
assert.deepEqual(checkTaskFacts({ ...good, knownBest: null }).knownBest, null);
|
||||
// "不存"清单只写名字:带 / 的写法在任何一层都对不上,报错。
|
||||
assert.throws(() => checkTaskFacts({ ...good, unversionedNames: ["lib/__pycache__"] }), /\/unversionedNames\/0:格式不对/);
|
||||
});
|
||||
|
||||
test("读任务:task.json 不是合法 JSON 时报错带文件路径", (t) => {
|
||||
|
||||
Reference in New Issue
Block a user