docs: 优化审查提示词,禁止 subagent 读取文件,明确 apply 阶段不动主规范
config.yaml: subagent 限定为计算密集/多步骤任务,文件读取用 Read 工具 prompt-proposal-review.md: 收集阶段加入读取约束和分步策略,复核补全待澄清清单 prompt-apply-review.md: 禁止同步主规范,新增 Spec 覆盖完整性扫描与补充流程
This commit is contained in:
@@ -421,29 +421,35 @@ describe("API 路由", () => {
|
||||
});
|
||||
|
||||
test("损坏的 failure JSON 返回 null 而不崩溃", async () => {
|
||||
const targets = store.getTargets();
|
||||
const t1Id = targets[0]!.id;
|
||||
const originalWarn = console.warn;
|
||||
console.warn = () => undefined;
|
||||
try {
|
||||
const targets = store.getTargets();
|
||||
const t1Id = targets[0]!.id;
|
||||
|
||||
store.insertCheckResult({
|
||||
durationMs: 100,
|
||||
failure: { kind: "error", message: "test", path: "$", phase: "body" },
|
||||
matched: false,
|
||||
observation: null,
|
||||
targetId: t1Id,
|
||||
timestamp: "2025-06-01T00:00:00.000Z",
|
||||
});
|
||||
store.insertCheckResult({
|
||||
durationMs: 100,
|
||||
failure: { kind: "error", message: "test", path: "$", phase: "body" },
|
||||
matched: false,
|
||||
observation: null,
|
||||
targetId: t1Id,
|
||||
timestamp: "2025-06-01T00:00:00.000Z",
|
||||
});
|
||||
|
||||
(store as unknown as { db: { prepare: (sql: string) => { run: (...args: unknown[]) => void } } }).db
|
||||
.prepare("UPDATE check_results SET failure = ? WHERE target_id = ? AND timestamp = ?")
|
||||
.run("{invalid json!!!", t1Id, "2025-06-01T00:00:00.000Z");
|
||||
(store as unknown as { db: { prepare: (sql: string) => { run: (...args: unknown[]) => void } } }).db
|
||||
.prepare("UPDATE check_results SET failure = ? WHERE target_id = ? AND timestamp = ?")
|
||||
.run("{invalid json!!!", t1Id, "2025-06-01T00:00:00.000Z");
|
||||
|
||||
const from = "2025-06-01T00:00:00.000Z";
|
||||
const to = "2025-06-01T23:59:59.999Z";
|
||||
const response = await fetch(`${baseUrl}/api/targets/${t1Id}/history?from=${from}&to=${to}`);
|
||||
const body = (await response.json()) as HistoryResponse;
|
||||
const from = "2025-06-01T00:00:00.000Z";
|
||||
const to = "2025-06-01T23:59:59.999Z";
|
||||
const response = await fetch(`${baseUrl}/api/targets/${t1Id}/history?from=${from}&to=${to}`);
|
||||
const body = (await response.json()) as HistoryResponse;
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(body.items).toHaveLength(1);
|
||||
expect(body.items[0]!.failure).toBeNull();
|
||||
expect(response.status).toBe(200);
|
||||
expect(body.items).toHaveLength(1);
|
||||
expect(body.items[0]!.failure).toBeNull();
|
||||
} finally {
|
||||
console.warn = originalWarn;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -165,6 +165,8 @@ describe("ProbeEngine", () => {
|
||||
return originalExecute(target, ctx);
|
||||
};
|
||||
|
||||
const originalWarn = console.warn;
|
||||
console.warn = () => undefined;
|
||||
try {
|
||||
const rejectTarget = makeCommandTarget("reject-cmd");
|
||||
const goodTarget = makeCommandTarget("good-cmd");
|
||||
@@ -192,6 +194,7 @@ describe("ProbeEngine", () => {
|
||||
expect(results[1]!["targetId"]).toBe("good-cmd");
|
||||
expect(results[1]!["matched"]).toBe(true);
|
||||
} finally {
|
||||
console.warn = originalWarn;
|
||||
checker.execute = originalExecute;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -143,8 +143,14 @@ describe("mapCheckResult", () => {
|
||||
});
|
||||
|
||||
test("损坏 observation JSON 返回 null observation", () => {
|
||||
const result = mapCheckResult(makeRow({ observation: "{invalid json" }), "http");
|
||||
expect(result.detail).toBeNull();
|
||||
expect(result.observation).toBeNull();
|
||||
const originalWarn = console.warn;
|
||||
console.warn = () => undefined;
|
||||
try {
|
||||
const result = mapCheckResult(makeRow({ observation: "{invalid json" }), "http");
|
||||
expect(result.detail).toBeNull();
|
||||
expect(result.observation).toBeNull();
|
||||
} finally {
|
||||
console.warn = originalWarn;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user