@@ -311,12 +311,14 @@ def _handle_empty_queue(self) -> CandidateNode | None:
311311 lambda : setattr (self , "line_profiler_done" , True ),
312312 )
313313 if len (self .future_all_code_repair ) > 0 :
314- return self ._process_candidates (
314+ result = self ._process_candidates (
315315 self .future_all_code_repair ,
316316 "Repairing {0} candidates" ,
317317 "Added {0} candidates from repair, total candidates now: {1}" ,
318- lambda : self . future_all_code_repair . clear () ,
318+ None ,
319319 )
320+ self .future_all_code_repair .clear ()
321+ return result
320322 if self .line_profiler_done and not self .refinement_done :
321323 return self ._process_candidates (
322324 self .future_all_refinements ,
@@ -326,12 +328,14 @@ def _handle_empty_queue(self) -> CandidateNode | None:
326328 filter_candidates_func = self ._filter_refined_candidates ,
327329 )
328330 if len (self .future_adaptive_optimizations ) > 0 :
329- return self ._process_candidates (
331+ result = self ._process_candidates (
330332 self .future_adaptive_optimizations ,
331333 "Applying adaptive optimizations to {0} candidates" ,
332334 "Added {0} candidates from adaptive optimization, total candidates now: {1}" ,
333- lambda : self . future_adaptive_optimizations . clear () ,
335+ None ,
334336 )
337+ self .future_adaptive_optimizations .clear ()
338+ return result
335339 return None # All done
336340
337341 def _process_candidates (
@@ -596,9 +600,11 @@ def generate_and_instrument_tests(
596600 logger .debug (f"[PIPELINE] Wrote behavioral test to { generated_test .behavior_file_path } " )
597601
598602 # Save perf test source for debugging
599- with open ("/tmp/codeflash_perf_test_debug.test.ts" , "w" , encoding = "utf-8" ) as debug_f :
600- debug_f .write (generated_test .instrumented_perf_test_source )
601- logger .warning (f"[PERF DEBUG] Saved perf test to /tmp/codeflash_perf_test_debug.test.ts for inspection" )
603+ from pathlib import Path
604+
605+ debug_path = Path ("/tmp/codeflash_perf_test_debug.test.ts" ) # noqa: S108
606+ debug_path .write_text (generated_test .instrumented_perf_test_source , encoding = "utf-8" )
607+ logger .warning ("[PERF DEBUG] Saved perf test to /tmp/codeflash_perf_test_debug.test.ts for inspection" )
602608
603609 with generated_test .perf_file_path .open ("w" , encoding = "utf8" ) as f :
604610 f .write (generated_test .instrumented_perf_test_source )
@@ -2098,7 +2104,7 @@ def process_review(
20982104 formatted_generated_test = format_generated_code (concolic_test_str , self .args .formatter_cmds )
20992105 generated_tests_str += f"```{ code_lang } \n { formatted_generated_test } \n ```\n \n "
21002106
2101- existing_tests , replay_tests , concolic_tests = existing_tests_source_for (
2107+ existing_tests , replay_tests , _ = existing_tests_source_for (
21022108 self .function_to_optimize .qualified_name_with_modules_from_root (self .project_root ),
21032109 function_to_all_tests ,
21042110 test_cfg = self .test_cfg ,
0 commit comments