perf(web): add idempotent batch verification fast paths
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

This commit is contained in:
mes123456
2026-09-03 20:29:51 +08:00
parent b849eb657b
commit b28b365f3a
19 changed files with 652 additions and 71 deletions

View File

@@ -2,7 +2,7 @@ import fs from "node:fs";
import path from "node:path";
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import { recordFailure } from "./wbv2-failure-ledger.mjs";
import { createFailureLedgerSession } from "./wbv2-failure-ledger.mjs";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const abs = (file) => path.join(root, file);
@@ -10,6 +10,7 @@ const supervisorRoot = "tests/golden/WBV2";
const supervisorLog = `${supervisorRoot}/continuous-supervisor.log`;
const checkpointPath = `${supervisorRoot}/continuous-supervisor.json`;
const lockPath = `${supervisorRoot}/continuous-supervisor.lock`;
const failureLedger = createFailureLedgerSession(root, { logPaths: [`${supervisorRoot}/continuous-supervisor.log`] });
const valueArg = (name, fallback) => {
const index = process.argv.indexOf(name);
@@ -158,7 +159,7 @@ try {
}
if (child.code !== 0) {
const reason = after.task === before.task ? "child_failed_same_task" : "child_failed_after_queue_advance";
recordFailure(root, { task: before.task, phase: "supervisor", reason, childExit: child.code });
failureLedger.record({ task: before.task, phase: "supervisor", reason, childExit: child.code });
writeCheckpoint({ state: "blocked", iteration: iteration + 1, before, after, reason, childExit: child.code });
exitCode = 3;
break;
@@ -170,7 +171,7 @@ try {
break;
}
if (after.task === before.task) {
recordFailure(root, { task: before.task, phase: "supervisor", reason: "child_exited_without_queue_advance", childExit: child.code });
failureLedger.record({ task: before.task, phase: "supervisor", reason: "child_exited_without_queue_advance", childExit: child.code });
writeCheckpoint({ state: "blocked", iteration: iteration + 1, before, after, reason: "child_exited_without_queue_advance", childExit: child.code });
exitCode = 4;
break;
@@ -193,6 +194,7 @@ try {
}
}
finally {
failureLedger.flush();
releaseLock();
}
process.exitCode = exitCode;