feat(workflow): add end-to-end workflow debug test command and condition branch explanation
This commit is contained in:
1 parent
26a6b7318c
commit
fe6183dd44
13 files changed
+1026
-3
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
getJobFailedExecutions,
|
||||
isTaskExecutionFailed,
|
||||
listPlatforms,
|
||||
explainConditionBranches,
|
||||
} from "../../../domains/platform/services.js";
|
||||
import type { WorkflowTaskExecution } from "../../../domains/platform/types.js";
|
||||
import { stringOption, numberOption, booleanOption } from "../../parser.js";
|
||||
@@ -402,6 +403,8 @@ export async function handleJob(parsed: CliParsedArgs, runtime: CliRuntime): Pro
|
||||
]);
|
||||
const failedExecutions = await enrichFailedExecutions(client, jobId, failedPage.items);
|
||||
|
||||
const conditionDiagnoses = explainConditionBranches(tree);
|
||||
|
||||
if (runtime.jsonMode) {
|
||||
return {
|
||||
stdout: printJson(
|
||||
@@ -410,6 +413,7 @@ export async function handleJob(parsed: CliParsedArgs, runtime: CliRuntime): Pro
|
||||
job,
|
||||
executionTree: tree,
|
||||
failedExecutions,
|
||||
conditionDiagnoses,
|
||||
},
|
||||
runtime.outputOptions
|
||||
),
|
||||
@@ -473,6 +477,25 @@ export async function handleJob(parsed: CliParsedArgs, runtime: CliRuntime): Pro
|
||||
);
|
||||
}
|
||||
|
||||
if (conditionDiagnoses.length > 0) {
|
||||
outLines.push("");
|
||||
outLines.push("── 💡 条件分支跳过诊断 (为什么没有走内部子任务?) ──");
|
||||
for (const diag of conditionDiagnoses) {
|
||||
outLines.push(` ⚠️ [${diag.conditionNodeName}] ${diag.conditionNodeLabel} (Execution ID: ${diag.conditionNodeId})`);
|
||||
outLines.push(` • 判定结论: ${diag.summary}`);
|
||||
outLines.push(` • 未执行子任务: ${diag.skippedTaskNames.join(", ")}`);
|
||||
if (diag.rules.length > 0) {
|
||||
outLines.push(" • 规则比对明细:");
|
||||
for (const r of diag.rules) {
|
||||
const statusIcon = r.matched ? "✅" : "❌";
|
||||
const missTag = r.isMissing ? " [⚠️ 属性缺失]" : "";
|
||||
outLines.push(` ${statusIcon} ${r.leftLabel} ${r.operatorLabel} ${JSON.stringify(r.expectedValue)}${missTag}`);
|
||||
outLines.push(` ↳ ${r.detail}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
stdout: `${outLines.join("\n")}\n`,
|
||||
stderr: "",
|
||||
|
||||
Reference in new issue
Block a user