test: tighten M3 preflight blocker classifications

This commit is contained in:
Code Queue Review
2026-05-22 22:48:38 +00:00
parent 0ff408696a
commit 012a89bfe1
3 changed files with 128 additions and 13 deletions
+21 -8
View File
@@ -7,7 +7,7 @@ import { access, mkdir, readFile, writeFile } from "node:fs/promises";
import { request as httpRequest } from "node:http";
import { request as httpsRequest } from "node:https";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { fileURLToPath, pathToFileURL } from "node:url";
import { activeReportLifecycle } from "../internal/dev-report-lifecycle.mjs";
import { DEV_ENDPOINT, DEV_FRONTEND_ENDPOINT, ENVIRONMENT_DEV } from "../internal/protocol/index.mjs";
@@ -143,7 +143,7 @@ function requireSafetyGates({ flags, dryRun, live }) {
const confirmedLive =
live &&
flags.has("--confirm-dev") &&
flags.has("--confirmed-non-production") &&
(flags.has("--expect-non-prod") || flags.has("--confirmed-non-production")) &&
!dryRun &&
!flags.has("--allow-live");
@@ -671,7 +671,8 @@ function createLiveOperationPlan() {
failureClassifications: Object.values(m3FailureClassifications),
refusalPolicy: [
"no arguments defaults to refusal",
"commands missing any of --live --confirm-dev --confirmed-non-production stay source/read-only",
"commands missing --live, --confirm-dev, or non-production confirmation stay source/read-only",
"non-production confirmation is --expect-non-prod; legacy --confirmed-non-production remains accepted",
"a dry-run, source, local, fixture, or read-only blocker report leaves liveOperation.status as not_run or blocked, never pass"
]
};
@@ -1715,9 +1716,21 @@ async function main() {
}
}
try {
await main();
} catch (error) {
console.error(`[dev-m3-smoke] ${error instanceof Error ? error.message : String(error)}`);
process.exitCode = 1;
export {
classifyDirectTargetBlockerScope,
classifyLiveOperationError,
createLiveOperationPlan,
hasRequiredM3Connection,
m3FailureClassifications,
parseArgs,
requireSafetyGates
};
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
try {
await main();
} catch (error) {
console.error(`[dev-m3-smoke] ${error instanceof Error ? error.message : String(error)}`);
process.exitCode = 1;
}
}