Skip to content

Commit dc9c11b

Browse files
committed
fix(qa): reject duplicate plugin gauntlet controls
1 parent 58552f6 commit dc9c11b

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

scripts/check-plugin-gateway-gauntlet.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ const DEFAULT_CPU_CORE_WARN = 0.9;
3535
const DEFAULT_HOT_WALL_WARN_MS = 30_000;
3636
const DEFAULT_MAX_RSS_WARN_MB = 1536;
3737
const DEFAULT_QA_PLUGIN_CHUNK_SIZE = 12;
38+
const SINGLE_VALUE_FLAGS = new Set([
39+
"--build-timeout-ms",
40+
"--command-timeout-ms",
41+
"--cpu-core-warn",
42+
"--hot-wall-warn-ms",
43+
"--limit",
44+
"--max-rss-warn-mb",
45+
"--output-dir",
46+
"--qa-cpu-regression-multiplier",
47+
"--qa-plugin-chunk-size",
48+
"--qa-timeout-ms",
49+
"--qa-wall-regression-multiplier",
50+
"--repo-root",
51+
"--rss-anomaly-multiplier",
52+
"--shard-index",
53+
"--shard-total",
54+
"--wall-anomaly-multiplier",
55+
]);
3856
const COMMAND_OUTPUT_MAX_BUFFER_BYTES = 16 * 1024 * 1024;
3957
const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;
4058
const ANSI_PATTERN = new RegExp(String.raw`\u001B\[[0-9;]*m`, "gu");
@@ -79,8 +97,15 @@ export function parseArgs(argv) {
7997
};
8098
const envIds = normalizeCsv(process.env.OPENCLAW_PLUGIN_GATEWAY_GAUNTLET_IDS);
8199
options.pluginIds.push(...envIds);
100+
const seenSingleValueFlags = new Set();
82101
parseArgv: for (let index = 0; index < args.length; index += 1) {
83102
const arg = args[index];
103+
if (SINGLE_VALUE_FLAGS.has(arg)) {
104+
if (seenSingleValueFlags.has(arg)) {
105+
throw new Error(`${arg} was provided more than once`);
106+
}
107+
seenSingleValueFlags.add(arg);
108+
}
84109
const readValue = () => {
85110
const value = args[index + 1];
86111
if (!value || value.startsWith("-")) {

test/scripts/plugin-gateway-gauntlet.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ describe("plugin gateway gauntlet helpers", () => {
150150
);
151151
});
152152

153+
it("rejects duplicate single-value controls", () => {
154+
expect(() =>
155+
parseArgs(["--output-dir", ".artifacts/one", "--output-dir", ".artifacts/two"]),
156+
).toThrow("--output-dir was provided more than once");
157+
expect(() => parseArgs(["--shard-total", "2", "--shard-total", "3"])).toThrow(
158+
"--shard-total was provided more than once",
159+
);
160+
});
161+
153162
it("rejects valued flags followed by another option", () => {
154163
for (const flag of [
155164
"--repo-root",

0 commit comments

Comments
 (0)