Commit graph

140 commits

Author SHA1 Message Date
Kevin Turcios
151df774a4 perf: use --effort low for java-tracer E2E to reduce CI time 2026-04-10 08:29:46 -05:00
HeshamHM28
f5777947c6 Merge remote-tracking branch 'origin/main' into cf-java-void-optimization 2026-04-09 08:15:53 +00:00
HeshamHM28
f42b58bb98 feat: implement bubble sort optimization and corresponding tests in Java 2026-04-03 14:55:09 +02:00
HeshamHM28
20f76a30dd fix(test): move --no-pr before optimize subcommand in e2e tracer test
--no-pr is a top-level codeflash flag, not an optimize subcommand flag.
Placing it after optimize caused it to be passed to the JVM as an
unrecognized option.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 06:56:27 +00:00
HeshamHM28
aeeca5c241 fix(java): find mvnw in parent dirs and respect --no-pr in tracer path
- Walk up parent directories when looking for mvnw wrapper, fixing
  multi-module projects where mvnw is in the root but optimizer runs
  from a submodule
- Respect user's --no-pr flag in Java tracer path instead of hardcoding
  no_pr=True, allowing PR creation from tracer-based optimizations
- Add --no-pr to e2e tracer test script

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 06:46:44 +00:00
HeshamHM28
5add169ba9
Merge branch 'main' into java-config-redesign 2026-03-27 14:10:00 +02:00
Ubuntu
c5b3687d52 refactor: remove zero-config logic from java-config-redesign branch
Zero-config Java support (auto-detection from build files, codeflash.toml
elimination) is handled separately in cf-java-zero-config-strategy. This
commit strips those changes, keeping only bug fixes:
- JFR parser, ReplayHelper, instrumentation, replay tests
- Multi-module test root resolution
- JUnit 4/5 test framework detection
- add_help=False for optimize subparser

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 07:39:29 +00:00
HeshamHM28
e7d07d073f Auto config 2026-03-26 06:38:33 +02:00
misrasaurabh1
be616d1d1f fix: flush e2e test output to CI logs in real-time
Use print(flush=True) instead of logging.info for subprocess output so
CI logs show progress in real-time instead of buffering until completion.
Also set PYTHONUNBUFFERED=1 for the subprocess.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:05:16 -07:00
misrasaurabh1
0fc5bba763 fix: e2e java tracer runs on all codeflash changes and validates replay tests + speedups
- Trigger on any codeflash/** or tests/** changes (not just java subset)
- Validate replay test files are discovered per-function
- Already validates: replay test generation, global discovery count,
  optimization success, and minimum speedup percentage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:34:56 -07:00
misrasaurabh1
3f95ff604a feat: eliminate codeflash.toml — auto-detect Java config from build files
Java projects no longer need a standalone config file. Codeflash reads
config from pom.xml <properties> or gradle.properties, and auto-detects
source/test roots from build tool conventions.

Changes:
- Add parse_java_project_config() to read codeflash.* properties from
  pom.xml and gradle.properties
- Add multi-module Maven scanning: parses each module's pom.xml for
  <sourceDirectory> and <testSourceDirectory>, picks module with most
  Java files as source root, identifies test modules by name
- Route Java projects through build-file detection in config_parser.py
  before falling back to pyproject.toml
- Detect Java language from pom.xml/build.gradle presence (no config needed)
- Fix project_root for multi-module projects (was resolving to sub-module)
- Fix JFR parser / separators (JVM uses com/example, normalized to com.example)
- Fix graceful timeout (SIGTERM before SIGKILL for JFR dump + shutdown hooks)
- Remove isRecording() check from TracingTransformer (was preventing class
  instrumentation for classes loaded during serialization)
- Delete all codeflash.toml files from fixtures and code_to_optimize
- Add 33 config detection tests
- Update docs for zero-config Java setup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 19:11:06 -07:00
misrasaurabh1
c31f83726a fix: ensure src/test/java directory exists before config validation
Git doesn't track empty directories, so src/test/java must be created
before process_pyproject_config validates tests-root exists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 23:19:44 -07:00
misrasaurabh1
0a83002555 fix: Java tracer e2e test script for CI compatibility
- Use `uv run -m codeflash.main` instead of direct file path
- Remove redundant --no-pr (already hardcoded in _run_java_tracer)
- Clean up leftover replay tests between retry attempts
- Add error logging for subprocess output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 23:17:27 -07:00
misrasaurabh1
c699093a26 Initial e2e tracer implementation 2026-03-18 23:03:35 -07:00
Kevin Turcios
eceac13fc3 Merge remote-tracking branch 'origin/main' into omni-java
# Conflicts:
#	.claude/rules/architecture.md
#	.claude/rules/code-style.md
#	.github/workflows/claude.yml
#	.github/workflows/duplicate-code-detector.yml
#	codeflash/api/aiservice.py
#	codeflash/cli_cmds/console.py
#	codeflash/cli_cmds/logging_config.py
#	codeflash/code_utils/deduplicate_code.py
#	codeflash/discovery/discover_unit_tests.py
#	codeflash/languages/base.py
#	codeflash/languages/code_replacer.py
#	codeflash/languages/javascript/mocha_runner.py
#	codeflash/languages/javascript/support.py
#	codeflash/languages/python/support.py
#	codeflash/optimization/function_optimizer.py
#	codeflash/verification/parse_test_output.py
#	codeflash/verification/verification_utils.py
#	codeflash/verification/verifier.py
#	packages/codeflash/package-lock.json
#	packages/codeflash/package.json
#	tests/languages/javascript/test_support_dispatch.py
#	tests/test_codeflash_capture.py
#	tests/test_languages/test_javascript_test_runner.py
#	tests/test_multi_file_code_replacement.py
2026-03-04 01:52:32 -05:00
Kevin Turcios
ca149fa2d0 fix: use relpath for main.py in E2E test utilities
Take omni-main-java's fix for E2E test runner path resolution —
uses os.path.relpath from __file__ instead of hardcoded relative path.
Also adds codeflash.toml detection for Java projects.
2026-03-04 00:19:02 -05:00
Kevin Turcios
af7ce7fce2 fix: cherry-pick main improvements into omni-java branch
- Take main's JS improvements: Mocha CJS support, ESM/CJS handling,
  sanitize_mocha_imports, vitest benchmarking fixes
- Update instrument_existing_test API: remove test_string param, read from
  file internally (aligned across Python, JS, Java support classes)
- Take main's equivalence.py with pass_fail_only parameter
- Take main's models.py, critic.py, env_utils.py, replay_test.py fixes
- Take main's PythonFunctionOptimizer parse_line_profile fix
- Skip files where our branch has Java-specific additions main doesn't
  have (create_pr, discover_unit_tests, parse_test_output, optimizer,
  verification_utils, config_parser, cmd_init, detector, support.py
  protocol methods)
2026-03-03 23:59:26 -05:00
Kevin Turcios
754727c8f2 fix: resolve e2e failures (path, pass_fail_only, Java context, codeflash.toml)
- Use os.path.relpath for main.py path in e2e tests
- Remove pass_fail_only kwarg from JS/Java function optimizers
- Fix Java e2e test to use JavaFunctionOptimizer for code context
- Detect codeflash.toml in e2e test runner (not just pyproject.toml)
2026-03-02 16:08:21 -05:00
Kevin Turcios
83831ac25e fix: resolve e2e test path and pass_fail_only issues
- Use os.path.relpath for main.py path (works for any cwd depth)
- Remove pass_fail_only kwarg from JS/Java compare_test_results fallback
  (main removed this parameter from equivalence.compare_test_results)
2026-03-02 16:01:46 -05:00
Kevin Turcios
bd3ec8f09d test: sync dual-changed test files from main with omni-java fixes
Updates inject_profiling_into_existing_test calls to include test_string
parameter. Takes main's test refactoring for multi-file code replacement
and codeflash capture.
2026-03-02 15:30:16 -05:00
Kevin Turcios
b6af185998 fix: split discovery and instrumentation log messages for E2E harnesses
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".
2026-03-02 02:16:50 -05:00
Kevin Turcios
85d1d4fbf6 Merge commit '6020c4fa' into sync-main-batch-3 2026-02-19 20:33:09 -05:00
Kevin Turcios
6c092b5e7f fix: update expected coverage lines for optimized async e2e code
The optimized code removes `import time`, shifting all function lines
up by 1. Update expected_lines from [10-20] to [9-19] to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 09:45:51 +00:00
HeshamHM28
dc1083b3f9 add java jdk 2026-02-18 03:47:42 +02:00
HeshamHM28
ca4f01f7c5 Add Java end to end tests 2026-02-16 08:43:51 +02:00
misrasaurabh1
198487bf81 format and lint all 2026-01-29 01:39:48 -08:00
misrasaurabh1
0c7c40a0a7 fix some e2e tests 2026-01-28 16:00:56 -08:00
misrasaurabh1
52de78ac0a fix tests 2026-01-27 22:34:04 -08:00
misrasaurabh1
54ef71090e add e2e test for CI 2026-01-27 20:54:01 -08:00
Kevin Turcios
f87b30403a test: validate concurrency acceptance reason in async E2E test
Ensure the async E2E test verifies that optimizations are accepted
for the correct reason (concurrency improvement).
2026-01-23 01:45:03 -05:00
Kevin Turcios
dc563465e0 feat: add acceptance reason validation to E2E tests
Add expected_acceptance_reason field to TestConfig and update the
improvement regex to capture and validate the improvement type.
2026-01-23 01:44:59 -05:00
Kevin Turcios
4e84286d8c Update end_to_end_test_tracer_replay.py 2026-01-09 02:17:13 -05:00
Kevin Turcios
827c15acde update both of these 2026-01-09 02:07:25 -05:00
Kevin Turcios
70eb224d52 simplify E2E replay test 2026-01-09 02:01:12 -05:00
Aseem Saxena
1bece54f28
Merge branch 'main' into no-gen-test-arg 2025-12-30 09:09:28 -08:00
Kevin Turcios
59c796e3df clarify things 2025-12-29 17:39:54 -05:00
Kevin Turcios
094e20efcc modify expectations 2025-12-29 17:39:45 -05:00
Kevin Turcios
c47e480106 it should be 13 2025-12-29 17:14:46 -05:00
Kevin Turcios
de13030889 fix this one too 2025-12-29 17:10:18 -05:00
Kevin Turcios
04b05ac7b3 Update end_to_end_test_utilities.py 2025-12-29 15:31:46 -05:00
Kevin Turcios
c402d4c098 Revert "Update end_to_end_test_utilities.py"
This reverts commit ecf875daeb.
2025-12-29 13:16:42 -05:00
Codeflash Bot
c910149307 fix arg insert order 2025-12-29 10:06:23 -08:00
Codeflash Bot
8fe2232543 validate stdout for gen tests 2025-12-29 10:02:36 -08:00
Codeflash Bot
fa22744747 add no-gen-tests arg to test config 2025-12-29 09:55:54 -08:00
Kevin Turcios
a364fb12d1 revert module root removal 2025-12-27 19:07:53 -05:00
Kevin Turcios
67431ff4a0 fix expectation 2025-12-27 18:58:27 -05:00
Kevin Turcios
ecf875daeb Update end_to_end_test_utilities.py 2025-12-27 17:50:31 -05:00
Kevin Turcios
2e34d83c52
remove test_framework from pyproject.toml (#955)
* follow up

* remove requirement

* Delete uv.lock

* refresh uv-lock

* first pass

* cleanup test_framework here

* cleanup

* code_review

* cleanup tests

* fix for E2E

* fix tests dir missing

* one more cleanup

* cancel-in-progress

* Revert "cancel-in-progress"

This reverts commit f4bb9079cb.

* not needed here

* lower threshold and cleanup comments

* debug

* temp

* debug

Revert "debug"

This reverts commit fc3655149486c8b980e245e97b8304232086f08d.

fix(discover): Fix pytest discovery for futurehouse structure

Revert "fix(discover): Fix pytest discovery for futurehouse structure"

This reverts commit 40c48882b7413f5876af0e2e08d8f17a65bab091.

Reapply "debug"

This reverts commit c8297e57fbdca2462a8ca1199657748b8bc225e9.

Revert "not needed here"

This reverts commit dd2c5cdf76.

Revert "lower threshold and cleanup comments"

This reverts commit 0e2f57e292.

Reapply "lower threshold and cleanup comments"

This reverts commit e3b24f4a2967551eca8a19f96bf6647b23acdbbc.

Reapply "not needed here"

This reverts commit aec32103c931ff6d57dfa0d012113c2cec5d37a7.

Revert "Reapply "debug""

This reverts commit 77ab9f34f858a17fb29764c544769a0eb72ce7f0.

Reapply "fix(discover): Fix pytest discovery for futurehouse structure"

This reverts commit 506b94ab4fe17a7c8e0d458253812758cced3f22.

feat(futurehouse): Make futurehouse structure pytest compatible

* Revert "debug"

This reverts commit 271c5a37ec.

* Revert "temp"

This reverts commit b363acda1c.

* Revert "debug"

This reverts commit ac29b6beb3.

* just for now
2025-12-09 02:53:08 -08:00
Kevin Turcios
321640cb60
CF-900 allow async optimizations by default (#938)
* remove --async

* include it by default

* don't crash for --async

* pre-commit
2025-11-23 16:36:13 -05:00
Codeflash Bot
cdaf4a893a expected unittests should be 0, code_to_optimize/code_directories/simple_tracer_e2e/tests folder is empty 2025-11-04 15:07:13 -08:00