Commit graph

188 commits

Author SHA1 Message Date
Kevin Turcios
ecf4e63eca perf: reduce Java E2E looping time to 5s and cache runtime JAR build
Make TOTAL_LOOPING_TIME configurable via CODEFLASH_LOOPING_TIME env var
(defaults to 10s). Set to 5s in Java E2E CI jobs to cut verification
time per candidate. Also cache the codeflash-runtime JAR keyed on
source hash to skip mvn install when unchanged.
2026-04-10 09:02:45 -05:00
Kevin Turcios
21f61ec93d ci: add java_tracer_e2e fixture path to e2e_java change detection
The fixture directory wasn't in the path filter, so changes to
Workload.java didn't trigger the java E2E tests.
2026-04-10 03:08:03 -05:00
Kevin Turcios
72a41a5665
Merge pull request #2055 from codeflash-ai/perf/defer-cli-imports
perf: defer cli.py imports for 7.7x faster --help
2026-04-10 01:59:57 -05:00
Kevin Turcios
79d47e0fae chore: delete disabled codeflash.yaml workflow
JS ESM integration test — disabled and superseded by ci.yaml's e2e-js matrix.
2026-04-10 01:51:52 -05:00
Kevin Turcios
992e91abc7 fix: prevent ruff auto-format from rewriting version.py placeholders
uv-dynamic-versioning rewrites version.py on every `uv run`, so the
ruff auto-format job was inadvertently committing dev version strings.
Restore version.py files after formatting and revert the ones already
changed on this branch.
2026-04-09 23:21:25 -05:00
Kevin Turcios
b7bcd0fe2e ci: add code_to_optimize/js/ to e2e_js path filter
The change detection for JS E2E tests was missing the test fixture
directory, so PRs that only modify JS test data (like this one) were
skipped. Java already had its equivalent path included.
2026-04-09 22:26:19 -05:00
Kevin Turcios
5b6318fcbb fix(ci): add shell: bash to conditional install step for Windows
The bash [[ ]] syntax fails on Windows runners which default to
PowerShell. Explicitly setting shell: bash fixes the ParserError.
2026-04-09 22:22:11 -05:00
Kevin Turcios
7c4d98c6e7 ci: restore uv venv --seed in claude.yml
uv venv --seed makes pip available in the venv, which the
Claude Code action may need.
2026-04-09 22:08:59 -05:00
Kevin Turcios
be4c459d01 ci: upgrade action versions, add uv cache, fix broken paths, DRY publish
- Bump actions/checkout v4/v5 → v6, setup-node v4 → v6, setup-java v4 → v5,
  prek-action v1 → v2, github-script v6 → v7, aws-credentials v4 → v6,
  claude-code-action v1.0.89 → v1
- Add enable-cache: true to all astral-sh/setup-uv steps
- Remove redundant uv venv --seed (uv sync creates venvs automatically)
- Merge double uv sync steps in unit-tests into single conditional
- Fix codeflash.yaml: broken path filter and working-directory
- Consolidate duplicate publish jobs into a single matrix job
- Remove generate_release_notes overridden by manual body
2026-04-09 22:06:41 -05:00
Kevin Turcios
e2eb677d18 Optimize CI caching and remove duplicate Java workflow
- Delete standalone java-e2e-tests.yml (duplicate of ci.yaml e2e-java)
- Add npm cache to e2e-js jobs via setup-node cache option
- Consolidate Maven build: mvn clean package + install → single mvn install
- Add .github/workflows/ci.yaml and .github/actions/** to push paths
  so CI validates its own changes when merged to main
2026-04-09 18:40:22 -05:00
Kevin Turcios
d97f372f43 ci: narrow paths, extract validate-pr, remove continue-on-error
- Remove codeflash-java-runtime/ from unit_tests change detection
- Narrow e2e flag from codeflash/ to explicit Python subdirs (excludes java/, javascript/)
- Narrow tests/ in e2e_java/e2e_js to specific test scripts
- Extract duplicated Validate PR step into composite action
- Use fetch-depth: 1 for unit-tests and type-check (no git history needed)
- Remove continue-on-error: true from unit-tests (was masking real failures)
- Change git add -A to git add -u in prek auto-fix (won't stage untracked files)
2026-04-09 12:00:17 -05:00
Kevin Turcios
82249efb4f ci: remove pyproject.toml/uv.lock from Java/JS E2E triggers 2026-04-09 11:52:33 -05:00
Kevin Turcios
8bcfbb3d81 ci: scope Java/JS E2Es to language-specific paths
Expand e2e_java and e2e_js change detection to include shared pipeline
code (optimization/, verification/, languages/base.py) but decouple
from the broad e2e flag. A change to codeflash/version.py now only
triggers Python E2Es, not Java/JS E2Es.
2026-04-09 11:52:16 -05:00
Kevin Turcios
3d50ac5aae ci: auto-fix formatting in prek job
Run ruff check --fix and ruff format before prek validation.
If files were modified, commit and push the fixes automatically.
2026-04-09 11:48:19 -05:00
Kevin Turcios
39eef53657 ci: remove unnecessary JDK/Maven setup from unit-tests
Only 5 of 3,943 unit tests need Java, and they already have
skip_if_maven_not_available() guards. Java execution is validated
by the e2e-java job. Saves ~30-60s per matrix entry (7 entries).
2026-04-09 11:41:20 -05:00
Kevin Turcios
4863ec3617 ci: remove matrix name override to fix skipped check display
When matrix jobs are skipped, `${{ matrix.name }}` is never expanded,
showing literal "matrix.name" in the checks UI. Removing the `name:`
field lets GitHub use the job ID when skipped and auto-expand matrix
values when running.
2026-04-09 11:34:19 -05:00
Kevin Turcios
19927fad07 ci: refactor 14 E2E jobs into 3 matrix jobs (1094 → 521 lines)
Consolidate individual E2E workflow jobs into matrix strategy:
- 9 Python E2Es → 1 `e2e-python` matrix job
- 3 JS E2Es → 1 `e2e-js` matrix job
- 2 Java E2Es + new void-optimization → 1 `e2e-java` matrix job

Also absorbs standalone `e2e-java-void-optimization.yaml` into ci.yaml,
fixing its mutable `@v6` tag to `@v8.0.0` in the process.

Gate job now references 6 needs instead of 17.
2026-04-09 11:31:47 -05:00
Kevin Turcios
6f63ce0d60
Merge pull request #2044 from codeflash-ai/ci/skip-irrelevant-checks
ci: consolidate required checks into single gate workflow
2026-04-09 11:07:54 -05:00
Hesham Mohamed
602cb68239
Merge pull request #1980 from codeflash-ai/cf-java-void-optimization
feat: support void method optimization in Java pipeline
2026-04-09 16:24:29 +02:00
Kevin Turcios
d941f3645f ci: consolidate remaining 10 workflows into ci.yaml
Add all non-required-check E2E workflows and prek lint to the
consolidated ci.yaml:

- 4 standard Python E2Es (async, benchmark, coverage, init)
- 3 JS E2Es (cjs-function, esm-async, ts-class)
- 2 Java E2Es (fibonacci-nogit, tracer)
- prek lint

New change detection outputs:
- e2e_js: triggers JS E2Es when packages/ changes
- e2e_java: triggers Java E2Es when java runtime/fixtures change

Total: 17 jobs + determine-changes + gate = 19 jobs in one file.
Down from 22 workflow files to 7 (remaining are non-test: claude,
codeflash self-optimize, label-workflow-changes, publish, java-e2e).

Additional savings per irrelevant PR: ~$0.80 (10 jobs x ~$0.08).
Total per skipped PR: ~$1.85.
2026-04-09 06:35:55 -05:00
Kevin Turcios
7e40e944b1 ci: remove self-reference from change detection paths
ci.yaml was in all three check_paths calls, so creating/modifying
the workflow itself triggered all test jobs. Workflow-only PRs
should skip tests — the gate job still validates the pattern.
2026-04-09 05:47:02 -05:00
Kevin Turcios
5877864fc8 ci: consolidate required checks into single ci.yaml with gate job
Replace 7 individual required-check workflows (unit-tests, mypy,
5 E2E tests) with a single ci.yaml following the astral-sh/ruff
gate pattern:

- determine-changes job uses native git diff (no third-party deps)
- Each test job skipped at job level when paths don't match
- Single required-checks-passed gate job accepts success + skipped
- E2E security preserved: environment gating, author allowlists

This fixes the long-standing issue where workflow-level path filters
leave required checks "Pending" on PRs that don't touch code paths,
blocking merge without admin override.

Estimated savings: ~$1.05/skipped PR ($0.64 unit-tests + $0.01
type-check + $0.40 E2E), ~$50-100/yr in compute, plus eliminating
all admin-merge workarounds.
2026-04-09 05:43:16 -05:00
Kevin Turcios
46e4035b05 ci: bump astral-sh/setup-uv from v6 to v8.0.0
v8 uses immutable releases (no major/minor tags) for supply chain
security. Pinning to exact version tag per upstream recommendation.
2026-04-09 05:16:10 -05:00
Kevin Turcios
07e4566271 ci: remove self-references from workflow path filters
Editing a workflow YAML file should not trigger that same workflow
to run. Removes .github/workflows/<file> from its own paths filter
in mypy.yml, prek.yaml, and unit-tests.yaml.
2026-04-09 05:08:19 -05:00
Kevin Turcios
e2e8557958 ci: remove self-reference from codeflash-optimize paths
Editing the workflow config shouldn't trigger a full optimization run.
2026-04-09 05:04:32 -05:00
Kevin Turcios
b38cfd2186 ci: scope workflow triggers to relevant paths
- codeflash-optimize.yaml: replace paths: ['**'] wildcard with targeted filters
- mypy.yml: add path filters (was firing on every PR/push including docs)
- prek.yaml: add path filters (was firing on every PR)
- unit-tests.yaml: add path filters (was firing on every PR/push)

Docs-only, README, experiment, and LICENSE changes no longer trigger
these workflows. Saves ~20 workflow runs per docs-only PR.
2026-04-09 04:59:24 -05:00
Kevin Turcios
507319066a ci: temporarily disable automatic PR review job
Adds `false &&` guard to the pr-review job condition. The job will
be skipped on all triggers until this is reverted. The @claude mention
job is unaffected.
2026-04-09 04:33:11 -05:00
HeshamHM28
f5777947c6 Merge remote-tracking branch 'origin/main' into cf-java-void-optimization 2026-04-09 08:15:53 +00:00
Kevin Turcios
3dc21bdec3 ci: pin claude-code-action to v1.0.89 to fix Bedrock auth
v1.0.90 broke Bedrock OIDC auth — all Claude Code runs have been
failing with 403 since Apr 8.

Root cause: anthropics/claude-code-action#1196
Pinning to v1.0.89 (last working version) until upstream fix lands.
2026-04-09 02:12:14 -05:00
Kevin Turcios
d344324325 ci: replace wildcard path triggers with targeted filters on E2E tests
All 12 E2E workflows used `paths: ['**']` which triggered on every file
change — docs, configs, experiments, etc. This caused ~140-200 min of
compute per push event (18+ parallel workflows).

Now E2E tests only trigger when relevant source code changes:
- Python E2E: codeflash/**, tests/**, pyproject.toml, uv.lock, workflow files
- JS E2E: same + packages/**
- Java E2E: already had proper path filters (no change needed)

Estimated savings: ~$150-200/mo in CI compute.
2026-04-09 02:06:28 -05:00
HeshamHM28
f42b58bb98 feat: implement bubble sort optimization and corresponding tests in Java 2026-04-03 14:55:09 +02: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
Saurabh Misra
59031a145e
Merge pull request #1874 from codeflash-ai/java-tracer
feat: Java tracing agent with end-to-end optimization pipeline
2026-03-19 15:12:11 -07:00
misrasaurabh1
c699093a26 Initial e2e tracer implementation 2026-03-18 23:03:35 -07:00
Kevin Turcios
f4319aac67 fix: scale review depth to PR size, add scope boundaries
- Triage now classifies PRs as TRIVIAL/SMALL/LARGE based on lines changed
- SMALL PRs: focused correctness check, quick duplicate scan, skip coverage
- LARGE PRs: full review with design checks, deep duplicate detection, coverage
- Optimization PRs: concise correctness verdict instead of long essays
- Added explicit scope rules: only read files in the diff, don't explore broadly
2026-03-18 19:06:40 -06:00
Kevin Turcios
f1cf46ce6b fix: improve Claude GHA review behavior
- Stop closing PRs on unrelated CI failures (check base branch first)
- Remove age-only auto-close rule; require individual evaluation
- Prevent mass-closing without per-PR analysis
- Merge conflicts only close after 3 days (not immediately)
- Resolve stale threads silently (no " Fixed" reply noise)
- Add design review checks (module placement, root cause, config files)
- Flag accidental file inclusions (binaries, auto-generated versions)
- Request tests for untested new public functions
2026-03-18 19:01:18 -06:00
Mohamed Ashraf
fa9d32f1c4 Merge branch 'main' into omni-java
Resolve 7 merge conflicts from main's modular refactoring + JS improvements:

- aiservice.py: combine multi-language metadata (omni-java) with main's structure
- cmd_init.py: adopt main's modular split (init_config, init_auth, github_workflow) + add Java import
- code_replacer.py: main's clean early-return style + omni-java's non-Python single-block fallback
- version.py, test_support_dispatch.py, test_javascript_test_runner.py: take main's versions
- uv.lock: regenerated

Port Java into main's modular structure:
- Fix init_java.py lazy imports to point to new modules (init_config, init_auth, github_workflow)
- Add Java workflow support to github_workflow.py (detection, template, customization)
- Fix broken Java imports (function_optimizer, line_profiler) after main's module moves

Add safety tests for merge-critical functions:
- test_add_language_metadata.py: 10 tests covering per-language payload correctness
- test_code_replacer_matching.py: 8 tests covering fallback chain

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:15:19 +00:00
Kevin Turcios
3ba68c0288 fix: attempt to fix failing CI on codeflash optimization PRs before closing
Instead of immediately closing optimization PRs when CI fails, Claude
now checks out the branch, inspects failures, and attempts to fix them.
Only closes if unfixable, with a specific explanation of the failures.
2026-03-10 16:34:55 -06:00
Kevin Turcios
89faf1e2fd chore: use default testgen-review-turns in GHA 2026-03-06 17:05:01 -05:00
Kevin Turcios
70a410a656 feat: add --testgen-review-turns CLI flag to control repair cycles 2026-03-06 01:12:39 -05:00
Kevin Turcios
5c34cb994b chore: enable --testgen-review flag in CI optimization workflow 2026-03-06 00:45:23 -05: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
bccc02aade merge: incorporate omni-main-java sync work
Merges the omni-main-java branch which synced main into omni-java,
including JavaFunctionOptimizer, removal of is_java()/is_python() guards,
protocol dispatch for parse_test_xml, and deletion of concolic_testing.py.
2026-03-03 23:42:39 -05:00
Kevin Turcios
c7854fb605 chore: remove simplify step from Claude PR review and add prek rule
Drop the /simplify step that caused unprompted refactors and scope
creep in PR reviews. Also add prek pre-commit rule to project config
so the PR bot and all contributors see it.
2026-03-03 22:21:55 -05:00
Kevin Turcios
8f50f31251 fix: add gh pr close permission to pr-review workflow
The merge_optimization_prs step needs to close stale PRs but
gh pr close was missing from the allowed tools list.
2026-03-03 21:04:14 -05:00
Kevin Turcios
dee1175acd chore: remove simplify step from Claude PR review and add prek rule
Drop the /simplify step that caused unprompted refactors and scope
creep in PR reviews. Also add prek pre-commit rule to project config
so the PR bot and all contributors see it.
2026-03-03 20:02:22 -05:00
Mohamed Ashraf
50ba89c6be ci: build codeflash-runtime JAR in unit-tests workflow
The unit-tests workflow relied on a pre-committed JAR binary in
resources/ which could become stale when Comparator.java changes.
Now the workflow builds the JAR from source and installs it to the
local Maven repo, matching what java-e2e and fibonacci-nogit already do.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 20:01:40 +00:00
Kevin Turcios
08dad4e6a4 chore: sync docs, rules, and workflows from main 2026-03-02 22:48:28 -05:00
Kevin Turcios
12b18de2d1 chore: limit claude workflow triggers to reduce spam
- Add paths-ignore to skip reviews for docs, config, CI, and non-production files
- Use github.event.sender.login instead of github.actor for reliable bot detection
- Add triage step to early-exit on trivial PRs
2026-03-02 22:01:11 -05:00
aseembits93
7ee1e7bd2f chore: switch claude workflow model from opus to sonnet 4.6
Use claude-sonnet-4-6 instead of claude-opus-4-6 for CI cost/speed savings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 08:08:28 +05:30