@@ -37,6 +37,7 @@ class TestConfig:
3737 benchmarks_root : Optional [pathlib .Path ] = None
3838 use_worktree : bool = False
3939 no_gen_tests : bool = False
40+ expected_acceptance_reason : Optional [str ] = None # "runtime", "throughput", "concurrency"
4041
4142
4243def clear_directory (directory_path : str | pathlib .Path ) -> None :
@@ -176,7 +177,7 @@ def validate_output(stdout: str, return_code: int, expected_improvement_pct: int
176177 logging .error ("Failed to find performance improvement message" )
177178 return False
178179
179- improvement_match = re .search (r"📈 ([\d,]+)% improvement" , stdout )
180+ improvement_match = re .search (r"📈 ([\d,]+)% (?:(\w+) )? improvement" , stdout )
180181 if not improvement_match :
181182 logging .error ("Could not find improvement percentage in output" )
182183 return False
@@ -193,6 +194,15 @@ def validate_output(stdout: str, return_code: int, expected_improvement_pct: int
193194 logging .error (f"Performance improvement rate { improvement_x } x not above { config .min_improvement_x } x" )
194195 return False
195196
197+ if config .expected_acceptance_reason is not None :
198+ actual_reason = improvement_match .group (2 )
199+ if not actual_reason :
200+ logging .error ("Could not find acceptance reason type in output" )
201+ return False
202+ if actual_reason != config .expected_acceptance_reason :
203+ logging .error (f"Expected acceptance reason '{ config .expected_acceptance_reason } ', got '{ actual_reason } '" )
204+ return False
205+
196206 if config .expected_unit_tests_count is not None :
197207 # Match the global test discovery message from optimizer.py which counts test invocations
198208 # Format: "Discovered X existing unit tests and Y replay tests in Z.Zs at /path/to/tests"
0 commit comments