@tea-agent/loop-agent 0.1.0-fe-test.4 → 0.1.0-fe-test.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/build-stamp.json +3 -3
- package/dist/executors/dag-pi-executor.js +3 -1
- package/dist/executors/shell-executor.js +45 -0
- package/dist/workflows/dag/dynamic-runtime/map.js +15 -2
- package/dist/workflows/dag/frontend-test-case-checklist.js +2 -0
- package/dist/workflows/dag/frontend-test-case-generation-assessment.js +69 -0
- package/dist/workflows/dag/frontend-test-case-manifest.js +6 -1
- package/dist/workflows/dag/frontend-test-result-contract.js +15 -1
- package/dist/workflows/dag/init-hybrid.js +95 -5
- package/dist/workflows/dag/types.js +21 -0
- package/docs/templates/frontend-test-dag.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
### 改进
|
|
13
13
|
|
|
14
|
+
- frontend-test 用例生成支持失败评估与定向修复:缺失或非法 Case 会进入有界 repair map,修复耗尽后仍保留在 manifest/result 中并明确标记 generation blocked,不再丢失或伪造结果;生成与修复 child 使用 64 KiB、8 次操作的受限读取预算。
|
|
15
|
+
- frontend-test 用例生成并发从 4 调整为 3,并使用节点级 filesystem-only 文件快照归属 writer 变更,避免并发生成不同 Case 时把兄弟节点文件误判为越界写入或 `actual diff is unavailable`。
|
|
14
16
|
- 修复顶部一级「观测」入口被恢复工作区残留的 DAG 或上次观测对象劫持的问题:现在点击该入口始终回到当前 Workspace 的运行总览,具体 DAG 仍通过「全屏观测」等显式入口打开。
|
|
15
17
|
- 修复节点检查器通俗字段旁的问号只有图标、悬浮时看不到具体说明的问题;问号现在支持鼠标悬浮和键盘聚焦,并显示对应字段含义及原技术字段。
|
|
16
18
|
- Next 发布测试升级到 Vitest 4.1.11,采用上游 worker RPC 修复,避免所有断言通过后仍因 `onTaskUpdate` 通讯超时阻断发包;同时隔离会改写构建产物的 package-surface 测试,并恢复两条此前被错误嵌套、实际未执行的 Console 更新回归;发布门禁继续严格检查 unhandled errors。
|
package/dist/build-stamp.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"version": "0.1.0-fe-test.
|
|
4
|
-
"gitSha": "
|
|
5
|
-
"builtAt": "2026-09-
|
|
3
|
+
"version": "0.1.0-fe-test.5",
|
|
4
|
+
"gitSha": "ef1a523bc35556c92feb821d487775ce7a869901",
|
|
5
|
+
"builtAt": "2026-09-08T14:27:23.942Z"
|
|
6
6
|
}
|
|
@@ -3880,7 +3880,9 @@ export async function executeDagPiNode(input, meta, piStepFn = executePiStep, wr
|
|
|
3880
3880
|
let beforeWorkspaceSnapshot;
|
|
3881
3881
|
let beforePathFingerprints;
|
|
3882
3882
|
/** tools-only and filesystem-only keep the tool sandbox but skip Git baseline. */
|
|
3883
|
-
const filesystemOnly = isWriteTask &&
|
|
3883
|
+
const filesystemOnly = isWriteTask &&
|
|
3884
|
+
(input.task.writeGuardPolicy === "filesystem-only" ||
|
|
3885
|
+
meta.spec.backendTestWorkspaceControl === "filesystem-only");
|
|
3884
3886
|
const skipGitWriteGuard = isWriteTask && (input.task.writeGuardPolicy === "tools-only" || filesystemOnly);
|
|
3885
3887
|
if (isWriteTask && filesystemOnly) {
|
|
3886
3888
|
try {
|
|
@@ -22,6 +22,7 @@ import { copyFrontendTestStandardScenarios } from "../workflows/dag/frontend-tes
|
|
|
22
22
|
import { probeFrontendTestEnvironment } from "../workflows/dag/frontend-test-environment-probe.js";
|
|
23
23
|
import { renderFrontendTestL5Report } from "../workflows/dag/frontend-test-l5-report.js";
|
|
24
24
|
import { validateFrontendCaseChecklist } from "../workflows/dag/frontend-test-case-checklist.js";
|
|
25
|
+
import { assessFrontendCaseGeneration } from "../workflows/dag/frontend-test-case-generation-assessment.js";
|
|
25
26
|
import { materializeFrontendTestCaseManifest } from "../workflows/dag/frontend-test-case-manifest.js";
|
|
26
27
|
import { selectFrontendRerunCandidates } from "../workflows/dag/frontend-test-rerun-candidates.js";
|
|
27
28
|
import { renderFrontendTestHtmlReport } from "../workflows/dag/frontend-test-html-report.js";
|
|
@@ -3172,6 +3173,31 @@ async function executeFrontendTestEvidenceValidation(input, meta) {
|
|
|
3172
3173
|
};
|
|
3173
3174
|
}
|
|
3174
3175
|
}
|
|
3176
|
+
async function executeFrontendTestCaseGenerationAssessment(input, meta) {
|
|
3177
|
+
const started = Date.now();
|
|
3178
|
+
try {
|
|
3179
|
+
const gate = input.task.shell?.frontendTestCaseGenerationAssessment;
|
|
3180
|
+
const state = JSON.parse(await readFile(path.join(meta.runDir, "state.json"), "utf8"));
|
|
3181
|
+
const raw = state.nodes?.[gate.plannerNodeId]?.stdout;
|
|
3182
|
+
if (!raw)
|
|
3183
|
+
throw new Error(`frontend-test planner output missing: ${gate.plannerNodeId}`);
|
|
3184
|
+
const match = raw.match(/\{[\s\S]*\}/);
|
|
3185
|
+
if (!match)
|
|
3186
|
+
throw new Error("frontend-test planner output is not JSON");
|
|
3187
|
+
const planned = JSON.parse(match[0]);
|
|
3188
|
+
if (!Array.isArray(planned.cases))
|
|
3189
|
+
throw new Error("frontend-test planner output must contain cases");
|
|
3190
|
+
const assessment = await assessFrontendCaseGeneration({
|
|
3191
|
+
workspaceRoot: input.cwd,
|
|
3192
|
+
plannerCases: planned.cases,
|
|
3193
|
+
declaredAcIds: gate.declaredAcIds ?? [],
|
|
3194
|
+
});
|
|
3195
|
+
return { ok: true, stdout: `${JSON.stringify(assessment)}\n`, stderr: "", failureCategory: "success", durationMs: Date.now() - started };
|
|
3196
|
+
}
|
|
3197
|
+
catch (error) {
|
|
3198
|
+
return { ok: false, stdout: "", stderr: error instanceof Error ? error.message : String(error), failureCategory: "invalid-output", durationMs: Date.now() - started };
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3175
3201
|
async function executeFrontendTestCasePackageFinalize(input, meta) {
|
|
3176
3202
|
const started = Date.now();
|
|
3177
3203
|
try {
|
|
@@ -3219,6 +3245,22 @@ async function executeFrontendTestCasePackageFinalize(input, meta) {
|
|
|
3219
3245
|
const index = ["# 前端功能测试用例索引", "", ...cases.map((c) => `- ${c.caseId}: ${c.title}(${c.dimension}) | AC: ${c.acIds.join(", ") || "无"} | 数据策略: ${c.dataStrategy}`), ""].join("\n");
|
|
3220
3246
|
await writeFile(path.join(root, "index.md"), index, "utf8");
|
|
3221
3247
|
await writeFile(path.join(root, "manifest.draft.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
3248
|
+
const generationAssessment = await assessFrontendCaseGeneration({
|
|
3249
|
+
workspaceRoot: input.cwd,
|
|
3250
|
+
plannerCases: cases,
|
|
3251
|
+
declaredAcIds: gate.declaredAcIds ?? [],
|
|
3252
|
+
});
|
|
3253
|
+
await writeFile(path.join(root, "generation-assessment.json"), JSON.stringify(generationAssessment, null, 2) + "\n", "utf8");
|
|
3254
|
+
if (generationAssessment.repairCases.length > 0) {
|
|
3255
|
+
for (const repair of generationAssessment.repairCases) {
|
|
3256
|
+
const entry = manifest.cases.find((candidate) => candidate.caseId === repair.caseId);
|
|
3257
|
+
if (entry) {
|
|
3258
|
+
entry.generationStatus = "blocked";
|
|
3259
|
+
entry.generationBlockedReason = `generation-repair-required:${repair.reasons.join(",")}`;
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
await writeFile(path.join(root, "manifest.draft.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
3263
|
+
}
|
|
3222
3264
|
const checklist = await validateFrontendCaseChecklist({ workspaceRoot: input.cwd, declaredAcIds: gate.declaredAcIds ?? [] });
|
|
3223
3265
|
if (checklist.issues.length)
|
|
3224
3266
|
throw new Error(`frontend-test checklist blocked: ${JSON.stringify(checklist.issues)}`);
|
|
@@ -3704,6 +3746,9 @@ async function executeDagShellNodeInner(input, meta) {
|
|
|
3704
3746
|
if (shell?.frontendTestCaseManifest) {
|
|
3705
3747
|
return executeFrontendTestCaseManifest(input, meta);
|
|
3706
3748
|
}
|
|
3749
|
+
if (shell?.frontendTestCaseGenerationAssessment) {
|
|
3750
|
+
return executeFrontendTestCaseGenerationAssessment(input, meta);
|
|
3751
|
+
}
|
|
3707
3752
|
if (shell?.frontendTestCasePackageFinalize) {
|
|
3708
3753
|
return executeFrontendTestCasePackageFinalize(input, meta);
|
|
3709
3754
|
}
|
|
@@ -257,6 +257,11 @@ export async function executeDynamicMapExpansion(input) {
|
|
|
257
257
|
const workerLimit = Math.min(8, Math.max(1, input.expansion.maxConcurrency ?? 1));
|
|
258
258
|
let nextChildIndex = 0;
|
|
259
259
|
const claimedChildIds = new Set();
|
|
260
|
+
const failurePolicy = input.expansion.childFailurePolicy ?? {
|
|
261
|
+
claimRemaining: false,
|
|
262
|
+
barrier: input.expansion.tolerateChildFailures ? "record" : "fail",
|
|
263
|
+
materialize: input.expansion.tolerateChildFailures ? "case-evidence" : "none",
|
|
264
|
+
};
|
|
260
265
|
let stopClaiming = tokenBudgetExhausted;
|
|
261
266
|
const runChild = async (childIndex) => {
|
|
262
267
|
const child = children[childIndex];
|
|
@@ -281,7 +286,10 @@ export async function executeDynamicMapExpansion(input) {
|
|
|
281
286
|
});
|
|
282
287
|
totalTokensUsed += input.state.nodes[child.id]?.tokensUsed ?? 0;
|
|
283
288
|
const record = input.state.nodes[child.id];
|
|
284
|
-
if (record &&
|
|
289
|
+
if (record &&
|
|
290
|
+
record.status !== "FINISHED" &&
|
|
291
|
+
!isBudgetBlockedRecord(record) &&
|
|
292
|
+
!failurePolicy.claimRemaining) {
|
|
285
293
|
stopClaiming = true;
|
|
286
294
|
}
|
|
287
295
|
if (tokenBudget?.maxTotalTokens !== undefined && totalTokensUsed >= tokenBudget.maxTotalTokens) {
|
|
@@ -329,7 +337,8 @@ export async function executeDynamicMapExpansion(input) {
|
|
|
329
337
|
// Opt-in (frontend-test via tolerateChildFailures): materialize case-level
|
|
330
338
|
// failed/blocked evidence and keep the map barrier green so validate /
|
|
331
339
|
// result / retrospect can still run. Default maps stay fail-closed on child ERROR.
|
|
332
|
-
const tolerateChildFailures =
|
|
340
|
+
const tolerateChildFailures = failurePolicy.barrier === "record" ||
|
|
341
|
+
input.expansion.tolerateChildFailures === true;
|
|
333
342
|
const caseOutcomeNotes = [];
|
|
334
343
|
if (tolerateChildFailures) {
|
|
335
344
|
for (let index = 0; index < childNodeIds.length; index += 1) {
|
|
@@ -347,6 +356,10 @@ export async function executeDynamicMapExpansion(input) {
|
|
|
347
356
|
: `executor-error:${record.failureCategory || record.status || "unknown"}`;
|
|
348
357
|
const outcomeStatus = infra ? "blocked" : "failed";
|
|
349
358
|
try {
|
|
359
|
+
if (failurePolicy.materialize === "none") {
|
|
360
|
+
caseOutcomeNotes.push({ nodeId, reason, status: outcomeStatus });
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
350
363
|
if (outcomeStatus === "blocked") {
|
|
351
364
|
await materializeBlockedCaseEvidence({
|
|
352
365
|
cwd: input.cwd,
|
|
@@ -346,6 +346,8 @@ export async function validateFrontendCaseChecklist(input) {
|
|
|
346
346
|
issues.push({ ruleId: "case-id-shape", caseId: id, detail: "caseId must be FE-<FEATURE>-<NNN>-<dimension>, never AC-FE-*" });
|
|
347
347
|
if (typeof item?.caseId === "string" && /^AC-/i.test(item.caseId))
|
|
348
348
|
issues.push({ ruleId: "case-id-is-ac", caseId: id, detail: "caseId must not be an acceptance id" });
|
|
349
|
+
if (item?.generationStatus === "blocked")
|
|
350
|
+
continue;
|
|
349
351
|
const casePath = typeof item?.casePath === "string" ? item.casePath : "";
|
|
350
352
|
const expectedPath = typeof item?.caseId === "string" ? frontendTestCasePath(layout, item.caseId) : "";
|
|
351
353
|
const absolute = path.resolve(input.workspaceRoot, casePath);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { access, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { defaultFrontendTestLayout, frontendTestCasePath } from "./frontend-test-layout.js";
|
|
5
|
+
function sha256(value) {
|
|
6
|
+
return createHash("sha256").update(value).digest("hex");
|
|
7
|
+
}
|
|
8
|
+
async function isFile(filePath) {
|
|
9
|
+
try {
|
|
10
|
+
return (await stat(filePath)).isFile();
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function caseIdOf(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && typeof value.caseId === "string"
|
|
18
|
+
? value.caseId
|
|
19
|
+
: "";
|
|
20
|
+
}
|
|
21
|
+
/** Compare the immutable planner inventory with generated case files. */
|
|
22
|
+
export async function assessFrontendCaseGeneration(input) {
|
|
23
|
+
const layout = input.layout ?? defaultFrontendTestLayout();
|
|
24
|
+
const validCases = [];
|
|
25
|
+
const repairCases = [];
|
|
26
|
+
for (const plannerCase of input.plannerCases) {
|
|
27
|
+
const caseId = caseIdOf(plannerCase);
|
|
28
|
+
const relativePath = frontendTestCasePath(layout, caseId);
|
|
29
|
+
const absolutePath = path.resolve(input.workspaceRoot, relativePath);
|
|
30
|
+
const reasons = [];
|
|
31
|
+
if (!caseId)
|
|
32
|
+
reasons.push("invalid-case-id");
|
|
33
|
+
if (!caseId || !(await isFile(absolutePath)))
|
|
34
|
+
reasons.push("missing-file");
|
|
35
|
+
let content = "";
|
|
36
|
+
if (reasons.length === 0) {
|
|
37
|
+
try {
|
|
38
|
+
content = await readFile(absolutePath, "utf8");
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
reasons.push("unreadable-file");
|
|
42
|
+
}
|
|
43
|
+
if (!content.trim())
|
|
44
|
+
reasons.push("empty-file");
|
|
45
|
+
}
|
|
46
|
+
if (reasons.length === 0) {
|
|
47
|
+
const requiredSections = ["## 测试点", "## 测试步骤", "## 预期结果"];
|
|
48
|
+
if (!requiredSections.every((section) => content.includes(section)))
|
|
49
|
+
reasons.push("case-structure-invalid");
|
|
50
|
+
if (!content.includes("playwright-cli "))
|
|
51
|
+
reasons.push("missing-playwright-steps");
|
|
52
|
+
if (!content.includes(caseId))
|
|
53
|
+
reasons.push("case-id-not-traceable");
|
|
54
|
+
}
|
|
55
|
+
if (reasons.length === 0)
|
|
56
|
+
validCases.push({ caseId, casePath: relativePath, sha256: sha256(content) });
|
|
57
|
+
else
|
|
58
|
+
repairCases.push({ caseId, casePath: relativePath, plannerCase, reasons, initialChild: input.initialChildren?.[caseId] });
|
|
59
|
+
}
|
|
60
|
+
return { schemaVersion: 1, expectedCount: input.plannerCases.length, validCases, repairCases };
|
|
61
|
+
}
|
|
62
|
+
export async function assertFrontendGenerationInventory(input) {
|
|
63
|
+
const expected = new Set(input.plannerCases.map(caseIdOf));
|
|
64
|
+
const layout = input.layout ?? defaultFrontendTestLayout();
|
|
65
|
+
const casesRoot = path.resolve(input.workspaceRoot, layout.casesDir);
|
|
66
|
+
await access(casesRoot);
|
|
67
|
+
for (const caseId of expected)
|
|
68
|
+
await access(path.join(casesRoot, `${caseId}.md`));
|
|
69
|
+
}
|
|
@@ -75,6 +75,10 @@ export async function materializeFrontendTestCaseManifest(input) {
|
|
|
75
75
|
}
|
|
76
76
|
const casePath = frontendTestCasePath(layout, c.caseId);
|
|
77
77
|
const evidenceDir = frontendTestEvidenceDir(layout, c.caseId);
|
|
78
|
+
const generationStatus = c.generationStatus === "blocked" ? "blocked" : "runnable";
|
|
79
|
+
const generationBlockedReason = typeof c.generationBlockedReason === "string" && c.generationBlockedReason.trim()
|
|
80
|
+
? c.generationBlockedReason.trim()
|
|
81
|
+
: undefined;
|
|
78
82
|
for (const [k, v] of [
|
|
79
83
|
["casePath", casePath],
|
|
80
84
|
["evidenceDir", evidenceDir],
|
|
@@ -83,7 +87,7 @@ export async function materializeFrontendTestCaseManifest(input) {
|
|
|
83
87
|
fail("unsafe-path", `${k}: ${v}`);
|
|
84
88
|
}
|
|
85
89
|
const casePathAbs = path.join(input.workspaceRoot, casePath);
|
|
86
|
-
const body = await readFile(casePathAbs).catch(() => null);
|
|
90
|
+
const body = generationStatus === "blocked" ? "blocked generation case" : await readFile(casePathAbs).catch(() => null);
|
|
87
91
|
if (body === null)
|
|
88
92
|
fail("case-file-missing", `missing case file ${casePath} (filename must equal caseId.md)`);
|
|
89
93
|
if (seenCasePath.has(casePath))
|
|
@@ -98,6 +102,7 @@ export async function materializeFrontendTestCaseManifest(input) {
|
|
|
98
102
|
evidenceDir,
|
|
99
103
|
dimension: c.dimension,
|
|
100
104
|
acIds,
|
|
105
|
+
...(generationStatus === "blocked" ? { generationStatus, generationBlockedReason: generationBlockedReason ?? "generation-repair-exhausted" } : {}),
|
|
101
106
|
});
|
|
102
107
|
}
|
|
103
108
|
const payload = `${JSON.stringify({ schemaVersion: 1, cases }, null, 2)}\n`;
|
|
@@ -555,7 +555,21 @@ export async function materializeFrontendTestResult(input) {
|
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
|
|
558
|
+
let caseContent;
|
|
559
|
+
let testPoints = [];
|
|
560
|
+
try {
|
|
561
|
+
({ caseContent, testPoints } = await readFrontendCaseContent(input.workspaceRoot, item.casePath, layout));
|
|
562
|
+
}
|
|
563
|
+
catch (error) {
|
|
564
|
+
if (item.generationStatus !== "blocked")
|
|
565
|
+
throw error;
|
|
566
|
+
status = "blocked";
|
|
567
|
+
blockedReason = typeof item.generationBlockedReason === "string" && item.generationBlockedReason.trim()
|
|
568
|
+
? item.generationBlockedReason.trim()
|
|
569
|
+
: "generation-repair-exhausted";
|
|
570
|
+
advisoryFindings.push({ ruleId: "generation-blocked", caseId: item.caseId, detail: blockedReason ?? "generation-repair-exhausted" });
|
|
571
|
+
caseContent = { purpose: "用例生成未完成", preconditions: [], steps: [], expectedResults: [] };
|
|
572
|
+
}
|
|
559
573
|
// Parse bounded fixed sections from execution.md. Missing optional
|
|
560
574
|
// summary/steps are advisory only and never downgrade a passed status.
|
|
561
575
|
let executionSummary = "";
|
|
@@ -5579,6 +5579,9 @@ function applyBackendTestLayoutToDagSpec(spec, layout) {
|
|
|
5579
5579
|
if (Array.isArray(child.forbiddenPaths)) {
|
|
5580
5580
|
child.forbiddenPaths = child.forbiddenPaths.map(rewrite);
|
|
5581
5581
|
}
|
|
5582
|
+
if (Array.isArray(child.readSet)) {
|
|
5583
|
+
child.readSet = child.readSet.map((entry) => typeof entry === "string" ? rewrite(entry) : entry);
|
|
5584
|
+
}
|
|
5582
5585
|
}
|
|
5583
5586
|
if (task.shell?.commands) {
|
|
5584
5587
|
task.shell.commands = task.shell.commands.map(rewrite);
|
|
@@ -5628,6 +5631,21 @@ function applyFrontendTestLayoutToDagSpec(spec, layout) {
|
|
|
5628
5631
|
}
|
|
5629
5632
|
spec.globalConstraints = spec.globalConstraints?.map(rewrite);
|
|
5630
5633
|
spec.successCriteria = spec.successCriteria?.map(rewrite);
|
|
5634
|
+
// Dynamic child contracts contain additional nested prompts and read sets;
|
|
5635
|
+
// rewrite every string so custom test roots cannot retain the default path.
|
|
5636
|
+
const rewriteNested = (value) => {
|
|
5637
|
+
if (typeof value === "string")
|
|
5638
|
+
return rewrite(value);
|
|
5639
|
+
if (Array.isArray(value))
|
|
5640
|
+
return value.map(rewriteNested);
|
|
5641
|
+
if (value && typeof value === "object") {
|
|
5642
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
5643
|
+
value[key] = rewriteNested(entry);
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5646
|
+
return value;
|
|
5647
|
+
};
|
|
5648
|
+
rewriteNested(spec);
|
|
5631
5649
|
spec.frontendTestLayout = layout;
|
|
5632
5650
|
}
|
|
5633
5651
|
function allowedPathsCoverFrontendTestRoot(allowedPaths, testRoot) {
|
|
@@ -5914,23 +5932,95 @@ function buildFrontendTestHybridDag(sources) {
|
|
|
5914
5932
|
itemName: "case",
|
|
5915
5933
|
maxItems: config.maxCasesPerBatch,
|
|
5916
5934
|
maxExpandedNodes: config.maxCasesPerBatch,
|
|
5917
|
-
maxConcurrency:
|
|
5935
|
+
maxConcurrency: 3,
|
|
5936
|
+
childFailurePolicy: {
|
|
5937
|
+
claimRemaining: true,
|
|
5938
|
+
barrier: "record",
|
|
5939
|
+
materialize: "none",
|
|
5940
|
+
},
|
|
5918
5941
|
childIdPrefix: "generate-frontend-functional-case",
|
|
5919
5942
|
childTask: {
|
|
5920
5943
|
executor: "pi", role: "implementer", skills: ["playwright-cli-case-generator"], toolProfile: "write", complexity: "HIGH",
|
|
5921
|
-
writePolicy: "exclusive", writeGuardPolicy: "
|
|
5944
|
+
writePolicy: "exclusive", writeGuardPolicy: "filesystem-only",
|
|
5922
5945
|
allowedPaths: [...ragWriteSet, "testcase/frontend/cases/{{case.caseId}}.md"],
|
|
5923
|
-
writeSet: ["testcase/frontend/cases/{{case.caseId}}.md"],
|
|
5946
|
+
writeSet: ["testcase/frontend/cases/{{case.caseId}}.md"],
|
|
5947
|
+
readSet: [...ragWriteSet],
|
|
5948
|
+
readBudget: { maxFiles: 4, maxBytes: 65536, maxOperations: 8, onExhaustion: "return-guidance" },
|
|
5949
|
+
forbiddenPaths: forbidden,
|
|
5950
|
+
writerOutcomePolicy: { type: "implementation-outcome-v1", requireChangedFiles: true },
|
|
5924
5951
|
outputContract: "生成一个完整中文 Case Markdown 文件;不得写其他文件。",
|
|
5925
5952
|
subtaskPromptTemplate: "你是一名资深前端测试专家。只读取冻结 RAG 与 planner case {{case.caseId}},不打开、连接或探索页面,不调用 playwright-cli,不猜测不存在的事实。只写 testcase/frontend/cases/{{case.caseId}}.md,遵循 docs/templates/frontend-test-case.example.md、playwright-cli 行合同、fresh snapshot/ref、URL 安全、U/D 数据归属和 evidence 要求。不要写 index.md、manifest、其他 Case 或 evidence;不要增加 Case、修改 ID/AC。",
|
|
5926
5953
|
},
|
|
5927
5954
|
},
|
|
5928
5955
|
},
|
|
5929
5956
|
];
|
|
5957
|
+
tasks.push({
|
|
5958
|
+
id: "assess-frontend-case-generation-shell",
|
|
5959
|
+
depends_on: ["generate-frontend-functional-cases-map"],
|
|
5960
|
+
role: "verifier",
|
|
5961
|
+
executor: "shell",
|
|
5962
|
+
complexity: "LOW",
|
|
5963
|
+
writePolicy: "exclusive",
|
|
5964
|
+
writeSet: ["testcase/frontend/cases/**"],
|
|
5965
|
+
allowedPaths: [...ragWriteSet, ...casesWriteSet],
|
|
5966
|
+
forbiddenPaths: forbidden,
|
|
5967
|
+
outputContract: "JSON generation assessment with expectedCount, validCases, and repairCases.",
|
|
5968
|
+
subtask_prompt: "Compare the planner inventory with generated frontend Case files; never delete or rewrite valid files.",
|
|
5969
|
+
shell: {
|
|
5970
|
+
// The dedicated executor operation handles this node; keep a harmless command for generic shell validation.
|
|
5971
|
+
commands: ["true"],
|
|
5972
|
+
frontendTestCaseGenerationAssessment: {
|
|
5973
|
+
plannerNodeId: "plan-frontend-functional-cases-pi",
|
|
5974
|
+
declaredAcIds,
|
|
5975
|
+
},
|
|
5976
|
+
cwd: ".",
|
|
5977
|
+
timeoutMs: 120000,
|
|
5978
|
+
},
|
|
5979
|
+
}, {
|
|
5980
|
+
id: "repair-frontend-case-generation-map",
|
|
5981
|
+
depends_on: ["assess-frontend-case-generation-shell"],
|
|
5982
|
+
role: "implementer",
|
|
5983
|
+
executor: "static",
|
|
5984
|
+
complexity: "LOW",
|
|
5985
|
+
writePolicy: "none",
|
|
5986
|
+
allowedPaths: [],
|
|
5987
|
+
forbiddenPaths: forbidden,
|
|
5988
|
+
outputContract: "Bounded repair barrier; only missing or invalid frontend Cases are expanded.",
|
|
5989
|
+
subtask_prompt: "Expand only assessment repairCases into bounded frontend Case writer children.",
|
|
5990
|
+
static: { resultMarkdown: "Frontend case generation repair barrier." },
|
|
5991
|
+
dynamicExpansion: {
|
|
5992
|
+
type: "map_agent",
|
|
5993
|
+
workflowNodeId: "repair-frontend-case-generation-map",
|
|
5994
|
+
itemsFrom: "$.nodes['assess-frontend-case-generation-shell'].output.repairCases",
|
|
5995
|
+
itemName: "case",
|
|
5996
|
+
maxItems: config.maxCasesPerBatch,
|
|
5997
|
+
maxExpandedNodes: config.maxCasesPerBatch,
|
|
5998
|
+
maxConcurrency: 2,
|
|
5999
|
+
childFailurePolicy: { claimRemaining: true, barrier: "record", materialize: "none" },
|
|
6000
|
+
childIdPrefix: "repair-frontend-functional-case",
|
|
6001
|
+
childTask: {
|
|
6002
|
+
executor: "pi",
|
|
6003
|
+
role: "implementer",
|
|
6004
|
+
skills: ["playwright-cli-case-generator"],
|
|
6005
|
+
toolProfile: "write",
|
|
6006
|
+
complexity: "HIGH",
|
|
6007
|
+
writePolicy: "exclusive",
|
|
6008
|
+
writeGuardPolicy: "tools-only",
|
|
6009
|
+
allowedPaths: [...ragWriteSet, "testcase/frontend/cases/{{case.caseId}}.md"],
|
|
6010
|
+
writeSet: ["testcase/frontend/cases/{{case.caseId}}.md"],
|
|
6011
|
+
readSet: [...ragWriteSet, "testcase/frontend/cases/{{case.caseId}}.md"],
|
|
6012
|
+
readBudget: { maxFiles: 5, maxBytes: 65536, maxOperations: 8, onExhaustion: "return-guidance" },
|
|
6013
|
+
forbiddenPaths: forbidden,
|
|
6014
|
+
writerOutcomePolicy: { type: "implementation-outcome-v1", requireChangedFiles: true },
|
|
6015
|
+
outputContract: "Repair exactly one frontend Case Markdown file; do not touch valid sibling Cases.",
|
|
6016
|
+
subtaskPromptTemplate: "Repair only testcase/frontend/cases/{{case.caseId}}.md using frozen RAG and this planner item. Address the assessment reasons without shrinking coverage; do not write index, manifest, or evidence.",
|
|
6017
|
+
},
|
|
6018
|
+
},
|
|
6019
|
+
});
|
|
5930
6020
|
if (blockingReview) {
|
|
5931
6021
|
tasks.push({
|
|
5932
6022
|
id: "review-frontend-cases-pi",
|
|
5933
|
-
depends_on: ["
|
|
6023
|
+
depends_on: ["repair-frontend-case-generation-map"],
|
|
5934
6024
|
role: "reviewer",
|
|
5935
6025
|
executor: "pi",
|
|
5936
6026
|
complexity: "HIGH",
|
|
@@ -5997,7 +6087,7 @@ function buildFrontendTestHybridDag(sources) {
|
|
|
5997
6087
|
}
|
|
5998
6088
|
const checklistDependsOn = blockingReview
|
|
5999
6089
|
? ["final-frontend-case-review-gate-shell"]
|
|
6000
|
-
: ["
|
|
6090
|
+
: ["repair-frontend-case-generation-map"];
|
|
6001
6091
|
tasks.push({
|
|
6002
6092
|
id: "finalize-frontend-case-package-shell",
|
|
6003
6093
|
depends_on: checklistDependsOn,
|
|
@@ -650,6 +650,12 @@ export const dagFrontendTestCasePackageFinalizeSchema = z
|
|
|
650
650
|
declaredAcIds: z.array(z.string()).optional(),
|
|
651
651
|
})
|
|
652
652
|
.strict();
|
|
653
|
+
export const dagFrontendTestCaseGenerationAssessmentSchema = z
|
|
654
|
+
.object({
|
|
655
|
+
plannerNodeId: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
656
|
+
declaredAcIds: z.array(z.string()).optional(),
|
|
657
|
+
})
|
|
658
|
+
.strict();
|
|
653
659
|
export const dagFrontendTestCaseManifestSchema = z
|
|
654
660
|
.object({
|
|
655
661
|
maxCases: z.number().int().min(1).optional(),
|
|
@@ -742,6 +748,7 @@ export const dagShellConfigSchema = z.object({
|
|
|
742
748
|
frontendTestHtmlReport: dagFrontendTestHtmlReportSchema.optional(),
|
|
743
749
|
frontendTestCaseManifest: dagFrontendTestCaseManifestSchema.optional(),
|
|
744
750
|
frontendTestCasePackageFinalize: dagFrontendTestCasePackageFinalizeSchema.optional(),
|
|
751
|
+
frontendTestCaseGenerationAssessment: dagFrontendTestCaseGenerationAssessmentSchema.optional(),
|
|
745
752
|
frontendTestRerunCandidates: dagFrontendTestRerunCandidatesSchema.optional(),
|
|
746
753
|
frontendTestResultFinalize: dagFrontendTestResultFinalizeSchema.optional(),
|
|
747
754
|
frontendTestReports: dagFrontendTestReportsSchema.optional(),
|
|
@@ -796,6 +803,13 @@ export const dagDynamicExpansionChildTaskSchema = z.object({
|
|
|
796
803
|
writeSet: z.array(z.string()).optional(),
|
|
797
804
|
/** Template-rendered strict repository-relative read allowlist. */
|
|
798
805
|
readSet: z.array(z.string()).optional(),
|
|
806
|
+
readBudget: z.object({
|
|
807
|
+
maxFiles: z.number().int().positive(),
|
|
808
|
+
maxBytes: z.number().int().positive(),
|
|
809
|
+
maxMs: z.number().int().positive().optional(),
|
|
810
|
+
maxOperations: z.number().int().positive().optional(),
|
|
811
|
+
onExhaustion: z.enum(["return-guidance"]).optional(),
|
|
812
|
+
}).strict().optional(),
|
|
799
813
|
/**
|
|
800
814
|
* Materialized-child pass-through fields for bounded Pi writer children
|
|
801
815
|
* (backend-test md/pytest case sharding). All optional so legacy
|
|
@@ -805,6 +819,11 @@ export const dagDynamicExpansionChildTaskSchema = z.object({
|
|
|
805
819
|
writeGuardPolicy: dagWriteGuardPolicySchema.optional(),
|
|
806
820
|
retryPolicy: dagRetryPolicySchema.optional(),
|
|
807
821
|
});
|
|
822
|
+
export const dagChildFailurePolicySchema = z.object({
|
|
823
|
+
claimRemaining: z.boolean().default(false),
|
|
824
|
+
barrier: z.enum(["fail", "record"]).default("fail"),
|
|
825
|
+
materialize: z.enum(["none", "case-evidence"]).default("none"),
|
|
826
|
+
}).strict();
|
|
808
827
|
export const dagDynamicExpansionSchema = z.object({
|
|
809
828
|
type: z.enum(["map_agent", "verify_agent"]),
|
|
810
829
|
workflowNodeId: z
|
|
@@ -844,6 +863,8 @@ export const dagDynamicExpansionSchema = z.object({
|
|
|
844
863
|
* (sharded migration and other map_agent workflows).
|
|
845
864
|
*/
|
|
846
865
|
tolerateChildFailures: z.boolean().optional(),
|
|
866
|
+
/** Explicitly separates claim, barrier, and evidence behavior for child failures. */
|
|
867
|
+
childFailurePolicy: dagChildFailurePolicySchema.optional(),
|
|
847
868
|
});
|
|
848
869
|
export const dagDynamicReductionSchema = z.object({
|
|
849
870
|
type: z.literal("verified_findings_report"),
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"itemName": "case",
|
|
175
175
|
"maxItems": 50,
|
|
176
176
|
"maxExpandedNodes": 50,
|
|
177
|
-
"maxConcurrency":
|
|
177
|
+
"maxConcurrency": 3,
|
|
178
178
|
"childIdPrefix": "generate-frontend-functional-case",
|
|
179
179
|
"childTask": {
|
|
180
180
|
"executor": "pi",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"writeSet": [
|
|
199
199
|
"testcase/frontend/cases/{{case.caseId}}.md"
|
|
200
200
|
],
|
|
201
|
-
"writeGuardPolicy": "
|
|
201
|
+
"writeGuardPolicy": "filesystem-only"
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
},
|