Unified · Split
| @@ -161,6 +161,15 @@ describe("resolveBenchmarkFollowUpPassCount", () => { · 160 unmodified lines | ||
| 161 | 161 | ).toBe(0); |
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | + it("caps explicit overrides to avoid runaway workload", () => { | |
| 165 | + expect( | |
| 166 | + resolveBenchmarkFollowUpPassCount({ | |
| 167 | + T3CODE_DESKTOP_PERF_BENCHMARK_FOLLOW_UP_PASSES: "99", | |
| 168 | + CI: "false", | |
| 169 | + }), | |
| 170 | + ).toBe(5); | |
| 171 | + }); | |
| 172 | + | |
| 164 | 173 | it("ignores malformed overrides and falls back to CI default", () => { |
| 165 | 174 | expect( |
| 166 | 175 | resolveBenchmarkFollowUpPassCount({ |
| @@ -15,6 +15,7 @@ type PerfBenchmarkEnv = { · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | const TRUE_VALUES = new Set(["1", "true", "yes", "on"]); |
| 17 | 17 | const FALSE_VALUES = new Set(["0", "false", "no", "off"]); |
| 18 | +const MAX_BENCHMARK_FOLLOW_UP_PASSES = 5; | |
| 18 | 19 | |
| 19 | 20 | function parseBooleanLike(value: string | undefined): boolean | null { |
| 20 | 21 | const normalized = value?.trim().toLowerCase(); |
| @@ -54,7 +55,8 @@ export function shouldRunOptionalRendererPerfInteractions(env: OptionalRendererT · 33 unmodified lines | ||
| 54 | 55 | export function resolveBenchmarkFollowUpPassCount(env: PerfBenchmarkEnv): number { |
| 55 | 56 | const raw = env.T3CODE_DESKTOP_PERF_BENCHMARK_FOLLOW_UP_PASSES?.trim(); |
| 56 | 57 | if (raw && /^\d+$/.test(raw)) { |
| 57 | − return Number.parseInt(raw, 10); | |
| 58 | + const parsed = Number.parseInt(raw, 10); | |
| 59 | + return Math.min(parsed, MAX_BENCHMARK_FOLLOW_UP_PASSES); | |
| 58 | 60 | } |
| 59 | 61 | return isCiEnvironment(env.CI) ? 0 : 1; |
| 60 | 62 | } |