fix(qa): reject duplicate model resolution perf controls · openclaw/openclaw@0850d83
vincentkoc
·
2026-06-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -132,12 +132,17 @@ function parseNonNegativeInt(flag: string, fallback: number, args = process.argv
|
132 | 132 | } |
133 | 133 | |
134 | 134 | function validateCliArgs(args = process.argv.slice(2)): void { |
| 135 | +const seenValueFlags = new Set<string>(); |
135 | 136 | for (let index = 0; index < args.length; index += 1) { |
136 | 137 | const arg = args[index] ?? ""; |
137 | 138 | if (BOOLEAN_FLAGS.has(arg)) { |
138 | 139 | continue; |
139 | 140 | } |
140 | 141 | if (VALUE_FLAGS.has(arg)) { |
| 142 | +if (seenValueFlags.has(arg)) { |
| 143 | +throw new CliArgumentError(`${arg} was provided more than once`); |
| 144 | +} |
| 145 | +seenValueFlags.add(arg); |
141 | 146 | const value = args[index + 1]; |
142 | 147 | if (!value || value.startsWith("-")) { |
143 | 148 | throw new CliArgumentError(`${arg} requires a value`); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,4 +48,12 @@ describe("issue 78851 model resolution profiler CLI", () => {
|
48 | 48 | expect(result.stdout).toBe(""); |
49 | 49 | expect(result.stderr.trim()).toBe("--providers requires a value"); |
50 | 50 | }); |
| 51 | + |
| 52 | +it("rejects duplicate value flags before starting the profiler", () => { |
| 53 | +const result = runProfiler("--providers", "48", "--providers", "96"); |
| 54 | + |
| 55 | +expect(result.status).toBe(1); |
| 56 | +expect(result.stdout).toBe(""); |
| 57 | +expect(result.stderr.trim()).toBe("--providers was provided more than once"); |
| 58 | +}); |
51 | 59 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。