You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure the CLI actually supports the new '--worktree' flag and that its behavior is covered; otherwise runs may silently ignore or fail on unknown flag. Validate downstream handling and docs.
The test uses hardcoded function and file paths; confirm they are stable in CI. Consider deriving from a shared fixture or constant to avoid breakage if the sample code moves.
Use file via pathlib.Path(file) only when the file is run as a script to avoid issues in environments where file may not be set (e.g., some test runners). Fall back to Path.cwd() to ensure a valid path. This prevents crashes when resolving cwd.
Why: The fallback to Path.cwd() can prevent failures where __file__ is unset, improving robustness with minimal risk; it's accurate for the shown cwd line but not critical.
Low
General
Gate new CLI flag via env
Only append the --worktree flag when the underlying codeflash command supports it to avoid failures on older versions. Guard with an environment toggle so CI can disable it when unsupported. This reduces hard failures due to unknown CLI flags.
-if config.use_worktree:+if config.use_worktree and os.environ.get("CF_ENABLE_WORKTREE", "1") == "1":
base_command.append("--worktree")
Suggestion importance[1-10]: 5
__
Why: Adding an env guard reduces failures on older CLIs; however, it introduces a behavior toggle not present in the PR and requires importing os, making it a moderate-impact, optional safeguard.
Low
Set env flag in workflow
Ensure the workflow sets the environment toggle expected by tests when using worktree mode to avoid mismatches. Export an env var before running to explicitly enable worktree behavior. This prevents silent divergence across environments.
- name: Run Codeflash to optimize code
id: optimize_code
run: |
+ export CF_ENABLE_WORKTREE=1
uv run python tests/scripts/end_to_end_test_topological_sort_worktree.py
Suggestion importance[1-10]: 5
__
Why: Ensuring an env var is set in the workflow can coordinate with the proposed guard, but it's contingent on adopting that guard and is not necessary for current PR behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Tests, Enhancement
Description
Add E2E test using git worktree
Extend TestConfig with worktree flag
Pass --worktree to CLI when enabled
Update CI to run worktree E2E
Diagram Walkthrough
File Walkthrough
end_to_end_test_topological_sort.py
Remove legacy topological sort E2Etests/scripts/end_to_end_test_topological_sort.py
end_to_end_test_topological_sort_worktree.py
Add worktree-enabled E2E test scripttests/scripts/end_to_end_test_topological_sort_worktree.py
end_to_end_test_utilities.py
Support worktree flag in test utilitiestests/scripts/end_to_end_test_utilities.py
use_worktreeto TestConfig--worktreeCLI flag when sete2e-topological-sort.yaml
Update CI to run worktree E2E.github/workflows/e2e-topological-sort.yaml