The recursive search in loop-runner.js wasn't entering package
directories inside scoped namespaces (e.g. @jest/core), so it couldn't
find jest-runner nested at @jest/core/node_modules/jest-runner.
- Fix get_suggestions() param type: str -> CommonSections (prevents silent no-match bugs)
- Fix generate_dynamic_workflow_content()/customize_codeflash_yaml_content() config param: tuple -> dict (runtime crash: dict-key access on a tuple)
- Fix get_dependency_installation_commands() return type: tuple[str,str] -> str (runtime crash: tuple passed to str.replace())
- Fix configure_pyproject_toml() else->elif isinstance(CLISetupInfo) for proper type narrowing
- Mark apologize_and_exit() as NoReturn to enable post-call type narrowing
- Remove unreachable return None statements in collect_setup_info()
- Refactor while-loop sentinels in collect_setup_info() to typed local vars
- Add missing type params to list/dict/tuple in LanguageSupport
- Add _get_theme() return type with TYPE_CHECKING import
Co-authored-by: Kevin Turcios <undefined@users.noreply.github.com>
The hot function `get_valid_subdirs` replaced `os.walk(...)[1]` (which builds full directory trees) with `os.scandir`, iterating only immediate children and checking `entry.is_dir()` directly. The profiler shows 82% of runtime was in the cached `get_valid_subdirs` call; within that function, `os.walk` was materializing nested structures unnecessarily. Switching `ignore_subdirs` from a list to a set reduced membership tests from O(n) to O(1), and consolidating two `startswith` checks into a single tuple-argument call eliminated redundant method dispatch. Across 34 hits in `get_suggestions`, per-call latency dropped from ~23 µs to ~21.6 µs, yielding a 17% speedup with no correctness regressions.
The optimization hoisted `Panel` and `Text` imports (from `rich.panel` and `rich.text`) to module scope and created a singleton `_THEME_SINGLETON = CodeflashTheme()` instead of instantiating it on each `inquirer.prompt` call. Line profiler shows that `prompt_api_key` spent ~22% of its runtime on these two imports plus ~11% on `CodeflashTheme().__init__` calls (which invokes `super().__init__()` to configure inquirer theme attributes). By importing once and reusing the theme instance, the optimized code eliminates repeated import overhead (from ~1.9ms down to ~0.0ms for imports) and theme construction overhead (from ~5ms to a one-time ~0.4ms initialization). This reduces the overall runtime from 21.4ms to 17.5ms (22% speedup) when `prompt_api_key` is invoked multiple times by the CLI, with no regressions in correctness or functionality.
The optimization wraps parser construction in `@lru_cache(maxsize=1)` so that the 35+ `add_argument` calls (each costing ~7 µs per profiler data) execute once per process instead of on every invocation of `parse_args`. This cuts parse_args time from 581 ms to 32 ms because ArgumentParser construction dominates the original runtime. The cache is safe because the parser definition is static; parsing different sys.argv values reuses the cached parser object without rebuilding its internal action registry.
Upgrade Python deps via uv sync --upgrade (werkzeug, filelock for py>=3.10,
and others). Run npm audit fix across JS test fixtures to patch minimatch
and rollup vulnerabilities.
Remaining unfixable:
- filelock <3.20.3 for py<3.10 (patched version requires py>=3.10)
- serialize-javascript in mocha ^10 (fix requires mocha 11 breaking change)
_expr_name now recurses into ast.Attribute to produce the full dotted
path (e.g. "dataclasses.dataclass", "typing.NamedTuple"). Callers use
.endswith() so both bare and module-qualified forms are matched. Adds
test for typing.NamedTuple base class.
testcase.result[0].message can be None when a JUnit XML failure/error
element has no message attribute. This caused an AttributeError crash
in parse_java_test_xml during benchmarking.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix mypy error: assert coverage_xml_path is not None before
generate_jacoco_report call (control flow guarantees it but mypy
can't infer it)
- Remove unused _JAVA_RESOURCES_DIR constant from build_tools.py
- Make AgentDispatcher routing robust: check startsWith("config=") or
contains(",config=") instead of bare substring match, preventing
false positive on paths containing "config="
- Drop redundant exception arg from logger.exception call
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
add_codeflash_dependency_to_pom() already handles errors internally —
it builds content in memory and only writes on success. The backup
mechanism was redundant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge JaCoCo agent and CLI into the runtime JAR instead of shipping 3
separate JARs. JaCoCo already self-shades its internals with a version
hash, so no relocation is needed.
- Add AgentDispatcher premain that routes to profiler (config=) or
JaCoCo (destfile=) based on agent args
- Update shade plugin: Premain-Class → AgentDispatcher, add
ServicesResourceTransformer and DontIncludeResourceTransformer
- Rewrite build_jacoco_agent_arg() and generate_jacoco_report() to use
the runtime JAR instead of separate JaCoCo JARs
- Delete org.jacoco.agent-0.8.13-runtime.jar and
org.jacoco.cli-0.8.13-nodeps.jar from resources/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of reverting the entire test file when any function fails
after repair, remove only the failing test functions and keep passing
ones. Full revert is preserved when all functions in a file fail.
The subagent action instructions now tell Claude Code to read the
original source, compare it against the optimized code, and check for
correctness and quality issues before presenting the result to the user.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The optimization precomputes AST nodes for the synthetic `__init__` (arguments and super-call body) once in `__init__` instead of rebuilding them for every class lacking an `__init__`, and extracts a `_expr_name` helper to replace duplicated isinstance chains when checking decorator/base names. Line profiler shows the `ast.arguments(...)` and `ast.Expr(...)` construction blocks dropped from ~80 µs total per synthetic-init case to near-zero by reusing prebuilt fragments, and the helper consolidates three 4–6 line isinstance sequences into single-call lookups. Runtime improved 18% (237 µs → 199 µs) with negligible per-test variance, and no correctness regressions across all edge cases (dataclasses, NamedTuples, existing decorators).
Replace the always-extract-function-only approach with progressive
fallback matching optimization/testgen: send the full module source
unless it exceeds OPTIMIZATION_CONTEXT_TOKEN_LIMIT (64k tokens), then
fall back to function-only extraction. Pass full module separately as
module_source_code for repair validation.
The repair endpoint passes function_source_code as
source_code_being_tested to validate_request_data(), which requires
a parseable module. Only the review endpoint should use the extracted
function-only source.
- Revert repaired test files on disk before returning Failure when
post-repair re-validation fails entirely
- Break out of repair cycle loop when all repair API calls fail
instead of wasting cycles retrying
- Fix --testgen-review-turns help text to say default: 2 (matches
MAX_TEST_REPAIR_CYCLES)