mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-11 12:17:57 +02:00
fix(ito): close ECC workload release gates
This commit is contained in:
+20
-8
@@ -15,12 +15,18 @@ const SUPPORTED_COMMANDS = Object.freeze([
|
||||
"serve", "train", "workload-status", "workload-cancel", "workload-cleanup",
|
||||
]);
|
||||
const CANONICAL_PACKAGE_PATH = "cli/ito-compute-cli";
|
||||
const CANONICAL_ENTRY_SEGMENTS = Object.freeze([
|
||||
const SOURCE_CANONICAL_ENTRY_SEGMENTS = Object.freeze([
|
||||
...CANONICAL_PACKAGE_PATH.split("/"),
|
||||
"dist",
|
||||
"bin",
|
||||
"ito.js",
|
||||
]);
|
||||
const NPM_CANONICAL_ENTRY_SEGMENTS = Object.freeze([
|
||||
"ito-compute-cli",
|
||||
"dist",
|
||||
"bin",
|
||||
"ito.js",
|
||||
]);
|
||||
const EXECUTABLE_OVERRIDE = "ECC_ITO_CLI_EXECUTABLE";
|
||||
const MAX_OUTPUT_BYTES = 10 * 1024 * 1024;
|
||||
const NODE_QUALIFICATION_TIMEOUT_MS = 31 * 60 * 1000;
|
||||
@@ -213,6 +219,10 @@ function parseArgs(argv, environment = process.env) {
|
||||
"--entitlement", "--artifact-ref", "--image-digest",
|
||||
"--max-runtime-seconds", "--max-incremental-cost-usd", "--idempotency-key",
|
||||
], ["--checkpoint-ref"]);
|
||||
const costIndex = withoutJson.indexOf("--max-incremental-cost-usd");
|
||||
if (withoutJson[costIndex + 1] !== "0") {
|
||||
throw new Error("--max-incremental-cost-usd must be exactly 0 until workload accounting is deployed.");
|
||||
}
|
||||
}
|
||||
if (command === "workload-status" || command === "workload-cancel" || command === "workload-cleanup") {
|
||||
validateRunLifecycleArgs(withoutJson);
|
||||
@@ -275,13 +285,15 @@ function isCanonicalItoEntry(candidate) {
|
||||
.normalize(candidate)
|
||||
.split(path.sep)
|
||||
.filter(Boolean);
|
||||
if (pathSegments.length < CANONICAL_ENTRY_SEGMENTS.length) return false;
|
||||
const candidateTail = pathSegments.slice(-CANONICAL_ENTRY_SEGMENTS.length);
|
||||
return candidateTail.every((segment, index) => {
|
||||
const expected = CANONICAL_ENTRY_SEGMENTS[index];
|
||||
return process.platform === "win32"
|
||||
? segment.toLowerCase() === expected.toLowerCase()
|
||||
: segment === expected;
|
||||
return [SOURCE_CANONICAL_ENTRY_SEGMENTS, NPM_CANONICAL_ENTRY_SEGMENTS].some((expectedSegments) => {
|
||||
if (pathSegments.length < expectedSegments.length) return false;
|
||||
const candidateTail = pathSegments.slice(-expectedSegments.length);
|
||||
return candidateTail.every((segment, index) => {
|
||||
const expected = expectedSegments[index];
|
||||
return process.platform === "win32"
|
||||
? segment.toLowerCase() === expected.toLowerCase()
|
||||
: segment === expected;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user