- Extend LanguageSupport protocol in base.py with Java-needed methods
(parse_test_xml, compare_test_results, replace_function_definitions, etc.)
- Add Java to language registry
- Update models.py with Java-related fields
- Refactor function_optimizer.py base class for language-agnostic dispatch
- Add normalizers package, deduplicate_code, coverage_utils modules
- Update verification modules for Java XML test output parsing
- Update Python/JS support and function_optimizer for protocol changes
- Add parse_xml.py for Python XML test result parsing
Add java-e2e-tests.yml, e2e-java-fibonacci-nogit.yaml workflows,
codeflash-optimize-java.yaml template, and update unit-tests.yaml
to include Java test paths.
Sample Maven project (code_to_optimize/java/) with Calculator, BubbleSort,
Fibonacci, StringUtils, etc. plus JUnit 5 tests for E2E validation.
Also adds java_maven test fixture for unit tests.
Maven project providing the Java-side runtime for codeflash optimizations:
Comparator, Serializer, ResultWriter, Blackhole, BenchmarkContext,
and a bytecode-level line profiler agent (ASM-based).
Includes comprehensive unit tests.
Consolidates duplicate-code-detector.yml into claude.yml as a step in
the pr-review job. Adds concurrency groups with cancel-in-progress to
prevent comment spam from racing workflow runs.
When a user targets a function that exists in the file but is not exported,
show a clear message suggesting they add an export statement, instead of
the generic "function not found" error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow init_js_project(), should_modify_package_json_config(), and
collect_js_setup_info() to run without interactive prompts when
skip_confirm=True. Uses auto-detected defaults instead of prompting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add NotImplementedError guard in all 3 test dispatchers (behavioral,
benchmarking, line-profile) for frameworks other than jest and vitest.
Previously, mocha and other frameworks silently fell through to Jest,
causing confusing failures. Now users get a clear error message.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve `module.exports = varName` where varName is an object literal
containing methods. For patterns like `const utils = { match() {} };
module.exports = utils;`, the individual methods are now recognized as
exported. This fixes function discovery for CJS libraries like Moleculer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Post-process find_functions() to mark functions as exported when they appear
in named export clauses like `export { joinBy }`. This fixes discovery for
TypeScript codebases (e.g., Strapi) that define const arrow functions and
export them via a separate export statement.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ship a zero-dependency jest-reporter.js inside the codeflash runtime package
instead of requiring the external jest-junit npm package. This ensures the
reporter is always available when codeflash is installed, fixing Jest-based
projects (Strapi, Moleculer) that failed because jest-junit wasn't installed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use XML structure instead of markdown for clearer step boundaries
- Resolve stale review threads via GraphQL instead of leaving them
- Positive framing instead of negation for instructions
- Replace aggressive language with calm direct instructions
- Add /simplify skill invocation for code quality pass
- Add verification checkpoint at the end
- Auto-close stale codeflash optimization PRs (age, conflicts, CI failures, deleted functions)
- Remove inline comment MCP tool, add Skill tool
Use self.default_file_extension in format_code and a treesitter_language
property in validate_syntax so TypeScriptSupport inherits both methods
from JavaScriptSupport instead of duplicating them.
Protocol methods with default bodies on a Protocol class are not
inherited by implementations. Add explicit detect_module_system and
adjust_test_config_for_discovery to PythonSupport.
Add JAVA enum value, is_java() helper, registry import guard, and Java
test frameworks (junit5/junit4/testng) as zero-behavior-change scaffolding.
Add 6 new LanguageSupport protocol methods/properties
(default_language_version, valid_test_frameworks,
test_result_serialization_format, load_coverage,
adjust_test_config_for_discovery, detect_module_system,
process_generated_test_strings) and implement them in PythonSupport and
JavaScriptSupport.
Replace 12 is_python()/is_javascript() guards across aiservice.py (5),
parse_test_output.py (4), verifier.py (2), and discover_unit_tests.py (1)
with protocol dispatch, moving ~40 lines of JS instrumentation logic from
verifier.py into JavaScriptSupport.
Also add imported_type_skeletons field to CodeContext and
JAVA_TESTCASE_TIMEOUT constant for upcoming Java support.
- Add JS optimizer, normalizer, and support files to architecture tree
- Update key entry points table for per-function optimization and test execution
- Add protocol dispatch preference to language-patterns rules
- Fix stale context path in optimization-patterns
- Add explicit utf-8 encoding rule scoped to new/changed code
- Update discover_functions calls to new (source, file_path) signature
- Use language-specific FunctionOptimizer subclasses in tests
- Add explicit utf-8 encoding to read_text()/write_text() for Windows
- Fix pytest fixture in TestTsJestSkipsConversion (was __init__)
- Update nonexistent file tests for source-based discover_functions
- Remove unused imports
- Extract JavaScriptFunctionOptimizer subclass with JS-specific overrides
for code context, candidate comparison, line profiling, and code replacement
- Replace is_python()/is_javascript() guards with LanguageSupport protocol
dispatch across optimizer, verification, and utility layers
- Move generate_concolic_tests into LanguageSupport (default no-op, Python
overrides with CrossHair)
- Collapse normalizer infrastructure: delete CodeNormalizer ABC and registry,
move implementations into language directories
- Unify discover_functions to source-based signature (source, file_path)
- Flatten function discovery indirection, making git-diff discovery work
for JS/TS
- Extract language-agnostic code replacer to languages/code_replacer.py
- Deduplicate error constants and function grouping logic into shared locations
- Restore pytest_cmd support in PythonSupport test runners
- Add empty-code guard in language-agnostic code replacer
- Fix tmpdir_path cleanup, self.args crash, UnboundLocalError in finally block
The return statement was outside the inner if-not block, causing all TestResults
(even populated ones) to return an empty dict.
Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
Log "Discovered N existing unit test files" after counting tests, and
"Instrumented N existing unit test files" after injecting profiling.
Python E2E harness matches "Discovered", JS harness matches "Instrumented".
The refactoring changed the log message from 'Discovered' to 'Instrumented',
breaking the E2E test regex in end_to_end_test_utilities.py:225.
Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
Add languages/python/function_optimizer.py and languages/python/optimizer.py
to the directory tree and Key Entry Points table.
Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add clarifying comment on shared replace_function_definitions_in_module import
- Remove misleading alias in test_unused_helper_revert.py, use PythonFunctionOptimizer directly
- Align base line_profiler_step return type to dict[str, Any]
- Fix latent bug: handle non-empty TestResults in line_profiler_step
The factory method was resolving the function AST from original_module_ast
before constructing PythonFunctionOptimizer, duplicating the _resolve_function_ast
hook. Now the hook handles resolution and the factory checks the result post-construction.