Skip to content

Commit 99f613d

Browse files
Fix KeyError when baseline database is missing
Added 'summary' key to error return paths in analyze() method. This fixes the crash when running performance tests for the first time without a baseline database. Tested locally: script now exits gracefully with exit code 0 when no baseline is available. Co-Authored-By: Alex Peng <[email protected]>
1 parent 685bed3 commit 99f613d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/performance-regression-detector.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ def analyze(self) -> Dict[str, Any]:
170170
"message": "No baseline results available for comparison",
171171
"regressions": [],
172172
"improvements": [],
173-
"stable": []
173+
"stable": [],
174+
"summary": {
175+
"total_benchmarks": 0,
176+
"regressions_found": 0,
177+
"improvements_found": 0,
178+
"stable_benchmarks": 0
179+
}
174180
}
175181

176182
if not current_results:
@@ -180,7 +186,13 @@ def analyze(self) -> Dict[str, Any]:
180186
"message": "No current results found",
181187
"regressions": [],
182188
"improvements": [],
183-
"stable": []
189+
"stable": [],
190+
"summary": {
191+
"total_benchmarks": len(baseline_results),
192+
"regressions_found": 0,
193+
"improvements_found": 0,
194+
"stable_benchmarks": 0
195+
}
184196
}
185197

186198
for baseline in baseline_results:

0 commit comments

Comments
 (0)