Cap benchmark follow-up pass override for perf safety
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
073c115e50
commit
0afaeeb904
2 files changed
+12
-1
No files matched your search
@@ -161,6 +161,15 @@ describe("resolveBenchmarkFollowUpPassCount", () => {
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it("caps explicit overrides to avoid runaway workload", () => {
|
||||
expect(
|
||||
resolveBenchmarkFollowUpPassCount({
|
||||
T3CODE_DESKTOP_PERF_BENCHMARK_FOLLOW_UP_PASSES: "99",
|
||||
CI: "false",
|
||||
}),
|
||||
).toBe(5);
|
||||
});
|
||||
|
||||
it("ignores malformed overrides and falls back to CI default", () => {
|
||||
expect(
|
||||
resolveBenchmarkFollowUpPassCount({
|
||||
|
||||
@@ -15,6 +15,7 @@ type PerfBenchmarkEnv = {
|
||||
|
||||
const TRUE_VALUES = new Set(["1", "true", "yes", "on"]);
|
||||
const FALSE_VALUES = new Set(["0", "false", "no", "off"]);
|
||||
const MAX_BENCHMARK_FOLLOW_UP_PASSES = 5;
|
||||
|
||||
function parseBooleanLike(value: string | undefined): boolean | null {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
@@ -54,7 +55,8 @@ export function shouldRunOptionalRendererPerfInteractions(env: OptionalRendererT
|
||||
export function resolveBenchmarkFollowUpPassCount(env: PerfBenchmarkEnv): number {
|
||||
const raw = env.T3CODE_DESKTOP_PERF_BENCHMARK_FOLLOW_UP_PASSES?.trim();
|
||||
if (raw && /^\d+$/.test(raw)) {
|
||||
return Number.parseInt(raw, 10);
|
||||
const parsed = Number.parseInt(raw, 10);
|
||||
return Math.min(parsed, MAX_BENCHMARK_FOLLOW_UP_PASSES);
|
||||
}
|
||||
return isCiEnvironment(env.CI) ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user