perf(web): add idempotent batch verification fast paths
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user