Skip to content

Conversation

@mashraf-222
Copy link
Contributor

@mashraf-222 mashraf-222 commented Nov 26, 2025

User description

Do validation for custom test directory while taking it from the user.

directory.validation.demo.mp4

PR Type

Bug fix


Description

  • Validate custom tests directory existence

  • Update inquirer Path to require exists


Diagram Walkthrough

flowchart LR
  InitCmd["Init command prompts user"] -- "asks for tests directory" --> InquirerPath["inquirer.Path with exists=True"]
  InquirerPath -- "validates directory exists" --> Success["Accept path"]
  InquirerPath -- "invalid path" --> RePrompt["Re-prompt user / show error"]
Loading

File Walkthrough

Relevant files
Bug fix
cmd_init.py
Enforce existing custom tests directory selection               

codeflash/cli_cmds/cmd_init.py

  • Add exists=True to inquirer.Path for tests path
  • Enforce that provided tests directory already exists
+4/-1     

@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.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

UX Behavior

Confirm how exists=True handles non-directory paths (e.g., files). Ensure it strictly enforces directories and provides clear user feedback when a file path is entered.

    "custom_tests_path",
    message="Enter the path to your tests directory",
    path_type=inquirer.Path.DIRECTORY,
    exists=True,
)
Cross-Platform Paths

Validate that inquirer.Path.DIRECTORY plus exists=True behaves consistently on Windows vs. Unix (symlinks, case sensitivity, network paths).

    path_type=inquirer.Path.DIRECTORY,
    exists=True,
)

@github-actions
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Permit creating new directory

Allow users to create a non-existing test directory by setting a create-on-confirm
flow instead of requiring it to exist. Prompt to create the directory if it doesn't
exist and handle potential filesystem errors. This prevents blocking initialization
when the desired directory is new.

codeflash/cli_cmds/cmd_init.py [428-433]

 inquirer.Path(
     "custom_tests_path",
-    message="Enter the path to your tests directory",
+    message="Enter the path to your tests directory (will be created if missing)",
     path_type=inquirer.Path.DIRECTORY,
-    exists=True,
+    exists=False,
 )
Suggestion importance[1-10]: 6

__

Why: The suggestion is contextually accurate and targets the newly added exists=True flag on the inquirer.Path prompt lines 428-433. Allowing non-existing directories can improve UX, but the improved_code only flips exists without implementing the proposed create-on-confirm handling, so impact is moderate.

Low

@KRRT7 KRRT7 merged commit 024ef1a into main Nov 26, 2025
21 of 23 checks passed
@KRRT7 KRRT7 deleted the ashraf/cf-875-we-are-not-validating-custom-test-paths-during-cmd-init branch November 26, 2025 05:04
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.

4 participants