fix: set language singleton early so git diff auto-detection works for non-Python languages#1859
fix: set language singleton early so git diff auto-detection works for non-Python languages#1859mashraf-222 wants to merge 2 commits intomainfrom
Conversation
…r all languages The language singleton was only set after function discovery, but get_git_diff() needs it during discovery to filter by file extension. Now set it in process_pyproject_config() based on the config file type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @mashraf-222's task in 9s —— View job PR Review Summary
Prek Checks
Mypy errors in Code Review
if "language" not in config:
config["language"] = "java" if config_file_path.name == "codeflash.toml" else "python"The inference is correct:
# Set the language singleton early so downstream code (e.g. get_git_diff)
# can use current_language_support() before function discovery.
if pyproject_config.get("language"):
set_current_language(pyproject_config["language"])Correct placement — Minor note: since The No bugs or security issues found. Duplicate DetectionNo duplicates detected. The two Test CoverageRelevant tests pass: 15/15 One gap: there is no dedicated unit test for the new language-inference logic in Last updated: 2026-03-18T00:36Z |
…r all languages The language singleton was only set after function discovery, but get_git_diff() needs it during discovery to filter by file extension. - config_parser.py: set config["language"] based on config file type (codeflash.toml → java, pyproject.toml → python) so all project types return a language - cli.py: call set_current_language() in process_pyproject_config() using the config value, before the optimizer runs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8c9aab5 to
d9dfb0b
Compare
Summary
Running
codeflash --subagentwithout--file(auto-detect mode) always found 0 functions for Java/JS/TS projects because the language singleton defaulted to Python whenget_git_diff()filtered by file extension.Fix
config_parser.py: Always setconfig["language"]based on config file type (codeflash.toml→ java,pyproject.toml→ python;package.jsonalready handled)cli.py: Callset_current_language()inprocess_pyproject_config()before the optimizer runsTesting
tests/test_git_utils.pypasscodeflash --subagent→ Java function discovered from git diff🤖 Generated with Claude Code