Skip to content

Conversation

@aseembits93
Copy link
Contributor

@aseembits93 aseembits93 commented Dec 23, 2025

Only for internal testing

PR Type

Enhancement


Description

  • Add '--no-gen-test' CLI flag

  • Disable test generation when flag set

  • Honor flag in optimization test pipeline


Diagram Walkthrough

flowchart LR
  CLI["CLI args parser"] -- "--no-gen-test flag" --> Args["Runtime args"]
  Args["Runtime args"] -- "no_gen_test=True" --> Gen["Test generation"]
  Gen["Test generation"] -- "skip creating tests" --> Pipeline["Optimization pipeline"]
Loading

File Walkthrough

Relevant files
Enhancement
cli.py
Introduce '--no-gen-test' CLI argument                                     

codeflash/cli_cmds/cli.py

  • Add new CLI argument --no-gen-test.
  • Provide help text describing behavior.
+3/-0     
function_optimizer.py
Conditionally disable test generation in optimizer             

codeflash/optimization/function_optimizer.py

  • Respect args.no_gen_test to skip generated tests.
  • Return empty GeneratedTestsList when flag enabled.
+4/-1     

@github-actions
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Make logging reflect skip

Adjust the log message when --no-gen-test is used to avoid misleading output.
Explicitly state that generation was skipped so operators don't misinterpret that
tests were produced.

codeflash/optimization/function_optimizer.py [1345-1346]

-logger.info(f"!lsp|Generated '{count_tests}' tests for '{self.function_to_optimize.function_name}'")
+if self.args.no_gen_test:
+    logger.info(f"!lsp|Skipped test generation for '{self.function_to_optimize.function_name}' due to --no-gen-test")
+else:
+    logger.info(f"!lsp|Generated '{count_tests}' tests for '{self.function_to_optimize.function_name}'")
Suggestion importance[1-10]: 6

__

Why: Updating the log when --no-gen-test is active improves accuracy and avoids confusion; it’s straightforward and contextually correct with minimal risk.

Low
Add backward-compatible plural flag

Normalize the flag name to plural to match phrasing elsewhere and reduce confusion.
Keep a backward-compatible alias so existing scripts don't break.

codeflash/cli_cmds/cli.py [83-85]

 parser.add_argument(
-    "--no-gen-test", action="store_true", help="Do not generate tests, use only existing tests for optimization."
+    "--no-gen-tests",
+    "--no-gen-test",
+    dest="no_gen_test",
+    action="store_true",
+    help="Do not generate tests; use only existing tests for optimization."
 )
Suggestion importance[1-10]: 5

__

Why: Adding a plural alias enhances UX while preserving dest for compatibility; it’s a minor, correct improvement with modest impact.

Low
Possible issue
Keep counts consistent with outputs

Preserve count_tests consistency with generated_tests. If --no-gen-test is set, also
set count_tests based on the empty list so downstream logic doesn't assume tests
exist. This avoids mismatches between the reported number of tests and the actual
generated list.

codeflash/optimization/function_optimizer.py [1347-1351]

 if self.args.no_gen_test:
     generated_tests = GeneratedTestsList(generated_tests=[])
+    count_tests = 0
+    concolic_test_str = None
+    function_to_concolic_tests = {}
 else:
     generated_tests = GeneratedTestsList(generated_tests=tests)
Suggestion importance[1-10]: 3

__

Why: Adjusting count_tests for --no-gen-test avoids a potential mismatch, but zeroing counts and nulling concolic_test_str/function_to_concolic_tests may be incorrect if concolic results were still computed. Partial correctness and uncertain impact lower the score.

Low

@aseembits93 aseembits93 changed the title No Generated Tests Argument No Generated Tests Argument (cf-953) Dec 28, 2025
@codeflash-ai codeflash-ai deleted a comment from claude bot Dec 29, 2025
@codeflash-ai codeflash-ai deleted a comment from claude bot Dec 29, 2025
@codeflash-ai codeflash-ai deleted a comment from CLAassistant Dec 29, 2025
@codeflash-ai codeflash-ai deleted a comment from github-actions bot Dec 29, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Codeflash Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@aseembits93 aseembits93 merged commit 6054ca5 into main Dec 30, 2025
22 of 27 checks passed
@aseembits93 aseembits93 deleted the no-gen-test-arg branch December 30, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants