feat: introduce codeflash_core engine with Rich console UI#1886
Conversation
Bring the language-agnostic optimization engine from codeflash-next-gen. Includes protocols, strategy, config, models, AI client, telemetry, ranking, verification, and diff modules. TUI artifacts stripped.
Add attrs and requests to dependencies. Include src/codeflash_core in the sdist build target.
Spinner progress bars, paneled text, syntax-highlighted code display, and RichHandler logging. Matches original codeflash patterns without LSP/subagent concerns.
Spinners on discovery, indexing, context extraction, test/candidate generation, baseline runs, and benchmarking. Per-function rule headers, per-candidate progress logging, diff display on success, and a paneled summary at the end.
|
Claude finished @KRRT7's task in 32s —— View job PR Review Summary
Prek ChecksAuto-fixed (committed): Remaining mypy errors (121 across 5 files — require logic changes, not auto-fixable):
Code ReviewBug:
|
| Finding | Confidence | Location | Duplicates |
|---|---|---|---|
FunctionToOptimize, HelperFunction, CodeContext |
HIGH | src/codeflash_core/models.py |
codeflash/models/function_types.py:26, codeflash/languages/base.py:54,79 |
unified_diff |
HIGH | src/codeflash_core/diff.py |
codeflash/code_utils/code_utils.py:70 (unified_diff_strings) — same logic, different signature |
Result/Ok/Err monad |
MEDIUM | src/codeflash_core/danom/result.py |
codeflash/either.py — different design but same functional purpose |
init_sentry, PostHogClient |
MEDIUM | src/codeflash_core/telemetry/ |
codeflash/telemetry/sentry.py, codeflash/telemetry/posthog.py |
These duplicates are likely intentional — codeflash_core is a new standalone engine that will eventually replace the codeflash package internals. This is fine architecturally, but worth noting that until the migration is complete there are two parallel implementations to keep in sync.
Test Coverage
The src/codeflash_core/ module (~2000 lines of new production logic across 25 files) has zero test coverage. There are no tests at all for:
optimizer.py— full orchestration loopstrategy.py/strategy_evaluation.py— candidate evaluation and multi-round repairverification.py— correctness checking (especially theoutcomes_matchedge case above)ranking.py,config.py,diff.pydanom/— the Result monad and functional utilities
At minimum, verification.py and ranking.py are pure functions that should have unit tests, and the outcomes_match edge case flagged above would have been caught by a test.
Last updated: 2026-03-24T09:40Z
| Branch: codeflash-core
…eachable code - Remove k8bot strategy (nonexistent module) - Guard PythonPlugin import with try/except ImportError - Move logging.basicConfig into setup_logging() to avoid import-time side effects - Rename underscore-prefixed names (_spinners, _DummyTask, etc.) to public - Fix _pending_code_markdown → pending_code_markdown attribute access - Simplify unreachable isinstance branch in review_and_repair_tests - Export setup_logging from ui package
- Remove dead __post_init__ from FunctionToOptimize (file_path is typed as Path; str coercion was unreachable per mypy) - Move TaskID import to runtime so DummyTask.id can be properly typed - Remove stale type: ignore[union-attr] from strategy_evaluation Co-authored-by: Kevin Turcios <undefined@users.noreply.github.com>
…command passthrough - Wrap Future.result() in try/except in generate_tests_and_candidates to prevent plugin errors from aborting the entire optimization session - Rename danom/_*.py files to remove leading underscores per project conventions - Pass pytest_cmd through to TestConfig.test_command in resolve_test_config
Fixes TC003 ruff lint error. Co-authored-by: Kevin Turcios <undefined@users.noreply.github.com>
Summary
src/codeflash_core/— the language-agnostic optimization engine from codeflash-next-gencodeflash_core.ui) with spinners, progress bars, panels, and syntax-highlighted code displaycodeflash_coreinpyproject.tomlwithattrsandrequestsas new dependenciesTest plan
import codeflash_coreworksfrom codeflash_core.ui import console, progress_barworkscodeflashpackage