feat: 研究编号只许小写、配置路径必须绝对;检验判重两个顺序取平均
任务书 13 第一部分,用户 2026-10-03 同意。 - config:studyId 限定小写字母、数字和 ._-;task、promptDir 必须以 / 开头。 - eval:research.json 路径改绝对,writeConfig 不再转换;quality.ts 第 2、6 问每对 A、B 与 B、A 各问一次取平均,两次原始概率都存。 - tests:大写编号、相对路径各加测试。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,7 @@ test("类型或取值不对报错,带字段路径", () => {
|
||||
[(c) => (c.runs = 0), /^\/runs:不能小于 1$/m],
|
||||
[(c) => (c.batchLimit = 1.5), /^\/batchLimit:应为整数$/m],
|
||||
[(c) => (c.studyId = "../x"), /^\/studyId:格式不对/m],
|
||||
[(c) => (c.task = " "), /^\/task:不能为空,也不能只有空白$/m],
|
||||
[(c) => (c.task = " "), /^\/task:必须是绝对路径(以 \/ 开头)$/m],
|
||||
[(c) => (c.devEntry = "false"), /^\/devEntry:应为true 或 false$/m],
|
||||
[(c) => ((c.models as Obj).researchers = []), /^\/models\/researchers:至少要有 1 项$/m],
|
||||
[(c) => (((c.models as Obj).verifier as Obj).thinking = null), /^\/models\/verifier\/thinking:只能是 "off"、"minimal"、"low"、"medium"、"high"、"xhigh"、"max" 之一$/m],
|
||||
@@ -91,6 +91,32 @@ test("类型或取值不对报错,带字段路径", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("研究编号带大写报错:它会进 Docker 镜像名,镜像名只认小写", () => {
|
||||
for (const id of ["Circle-1", "circle-A", "R0"]) {
|
||||
const config = fullConfig() as unknown as Obj;
|
||||
config.studyId = id;
|
||||
const message = errorOf(config);
|
||||
assert.match(message, /^\/studyId:格式不对/m);
|
||||
assert.match(message, /共 1 处/, message);
|
||||
}
|
||||
});
|
||||
|
||||
test("任务目录、提示词目录写相对路径报错,报错写明字段路径", () => {
|
||||
const cases: Array<[string, string]> = [
|
||||
["task", "tasks/circle_packing"],
|
||||
["task", "./tasks/circle_packing"],
|
||||
["promptDir", "prompts"],
|
||||
["promptDir", "../InfoRSI/prompts"],
|
||||
];
|
||||
for (const [field, path] of cases) {
|
||||
const config = fullConfig() as unknown as Obj;
|
||||
config[field] = path;
|
||||
const message = errorOf(config);
|
||||
assert.match(message, new RegExp(`^/${field}:必须是绝对路径(以 / 开头)$`, "m"));
|
||||
assert.match(message, /共 1 处/, message);
|
||||
}
|
||||
});
|
||||
|
||||
test("Jev 模型必填:少了、写 null、写空白都报错,不补 jev-latest", () => {
|
||||
const missing = fullConfig() as unknown as Obj;
|
||||
delete (missing.models as Obj).jev;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { join } from "node:path";
|
||||
import type { ResearchConfig } from "../src/config/index.ts";
|
||||
|
||||
// 两份写全的合法配置:完整流程一份、朴素循环一份。数值取方法.md 6.11 的现行值和参考项目真实用过的配置
|
||||
@@ -8,7 +9,7 @@ const glm = { provider: "iomgaa", model: "glm-5.3", thinking: "medium" } as cons
|
||||
export function fullConfig(): ResearchConfig {
|
||||
return {
|
||||
studyId: "circle-full-1",
|
||||
task: "tasks/circle_packing",
|
||||
task: join(import.meta.dirname, "..", "tasks", "circle_packing"),
|
||||
models: {
|
||||
researchers: [{ ...glm }, { ...glm }, { ...glm }],
|
||||
experimenter: { ...glm },
|
||||
@@ -21,7 +22,7 @@ export function fullConfig(): ResearchConfig {
|
||||
factorLimit: 3,
|
||||
maxRepairs: 1,
|
||||
lightChecks: { maxCount: 2, seconds: 5 },
|
||||
promptDir: "prompts",
|
||||
promptDir: join(import.meta.dirname, "..", "prompts"),
|
||||
devEntry: false,
|
||||
flow: {
|
||||
preset: "full",
|
||||
|
||||
Reference in New Issue
Block a user