Skip to content

remove dead code#1854

Merged
KRRT7 merged 7 commits intomainfrom
cleanup/remove-dead-code
Mar 17, 2026
Merged

remove dead code#1854
KRRT7 merged 7 commits intomainfrom
cleanup/remove-dead-code

Conversation

@KRRT7
Copy link
Copy Markdown
Collaborator

@KRRT7 KRRT7 commented Mar 17, 2026

No description provided.

KRRT7 and others added 3 commits March 17, 2026 01:01
- Remove orphaned api/schemas.py entirely (unused schema layer)
- Remove aiservice.py: optimize_python_code, get_jit_rewritten_code, optimize_python_code_refinement alias
- Remove CodeNormalizer ABC tombstone from normalizer.py
- Remove TestFiles.get_by_type, TestResults.get_all_ids from models.py
- Remove create_pyproject_toml from config_writer.py
- Remove markdown_pattern_python_only from models.py
- Remove LOGGING_FORMAT from logging_config.py
- Fix self-referential import in treesitter.extract_calling_function_source
- Add # noqa: F401 to side-effect support imports in registry.py

Co-Authored-By: Oz <oz-agent@warp.dev>
inquirer_wrapper, inquirer_wrapper_path, split_string_to_cli_width,
and split_string_to_fit_width were replaced by direct inquirer usage
with CodeflashTheme and rich.prompt.Confirm. Only apologize_and_exit
remains.

Co-Authored-By: Oz <oz-agent@warp.dev>
Function now lives alongside the console/logger it depends on.
Updated all 8 callers to import from cli_cmds.console instead.

Co-Authored-By: Oz <oz-agent@warp.dev>
@KRRT7
Copy link
Copy Markdown
Collaborator Author

KRRT7 commented Mar 17, 2026

tbh it wasn't very good and I did most of this with warp.

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

Claude finished @KRRT7's task in 9m 18s —— View job


PR Review Summary

  • Gather context
  • Triage PR scope
  • Lint and typecheck (7 ruff issues fixed, pushed)
  • Resolve stale threads (none found)
  • Code review
  • Duplicate detection
  • Test coverage
  • Post summary

Prek Checks

7 ruff issues auto-fixed and pushed (style: auto-fix ruff import sorting and remove redundant noqa comments):

  • I001 (unsorted-imports) in 5 files: github_workflow.py, init_auth.py, init_java.py, init_javascript.py, github_utils.py — each had two separate from codeflash.cli_cmds.console import lines (one for apologize_and_exit, one for the existing symbols). These should be merged into a single import line.
  • RUF100 (unused-noqa) in registry.py — the # noqa: F401 added to the python/javascript support imports is redundant because the as _ pattern already suppresses the F401 warning.

No mypy errors were introduced by this PR (all 46 errors across 7 files were pre-existing).


Code Review

Bug fixed: broken test import (pushed as fix: remove test for deleted create_pyproject_toml function)

tests/test_setup/test_config.py imported create_pyproject_toml and had a TestCreatePyprojectToml class testing it — but the function was deleted from codeflash/setup/config_writer.py in this PR. This caused an ImportError at collection time, breaking the entire test module (20 tests affected). The import and test class have been removed.

Other observations (no action required):

  • codeflash/api/aiservice.py: docstring on code_repair was silently removed along with the dead code above it. Not a bug but worth noting.
  • codeflash/languages/registry.py L53–59: mypy reports Name "_" already defined (by an import) for the three import support as _ patterns — pre-existing, not introduced here.
  • The apologize_and_exit move to console.py is clean and correct.

Duplicate Detection

No duplicates detected. The only added code (apologize_and_exit in console.py) has a single definition with no equivalent elsewhere.


Test Coverage

config_writer.py: 62% — acceptable. console.py (18%) and registry.py (16%) are pre-existing low-coverage files, not impacted by this PR's changes.


Bot PR

Merged open codeflash-ai[bot] PR #1853 (⚡️ Speed up re_extract_from_cache by 18,223% — all CI passed, mergeable).

@KRRT7 KRRT7 changed the title Remove dead code identified by Skylos static analysis remove dead code Mar 17, 2026
github-actions bot and others added 2 commits March 17, 2026 07:44
- Merge duplicate `from codeflash.cli_cmds.console import` lines (I001)
- Remove unused `# noqa: F401` from `support as _` imports in registry.py (RUF100)

Co-authored-by: Kevin Turcios <undefined@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The function was removed in the dead code cleanup but the test file still
imported it and had a TestCreatePyprojectToml class, causing ImportError.

Co-authored-by: Kevin Turcios <undefined@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KRRT7
Copy link
Copy Markdown
Collaborator Author

KRRT7 commented Mar 17, 2026

@claude fix the mypy issue

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

Claude finished @KRRT7's task in 2m 37s —— View job


Fixed mypy issue in registry.py

  • Gather context
  • Read registry.py and understand the issue
  • Fix the Name "_" already defined mypy error
  • Run prek to verify — all checks pass
  • Commit and push

Root cause: _ensure_languages_registered() used from X import support as _ three times, causing mypy to report Name "_" already defined (by an import) on lines 56 and 59.

Fix: Replaced the three separate import as _ statements with a loop using importlib.import_module():

for _lang_module in (
    "codeflash.languages.python.support",
    "codeflash.languages.javascript.support",
    "codeflash.languages.java.support",
):
    with contextlib.suppress(ImportError):
        importlib.import_module(_lang_module)

mypy now reports no issues found for registry.py. Pushed as fix: resolve mypy "Name _ already defined" error in registry.py.

Replace three `from X import support as _` patterns with a loop using
`importlib.import_module()`, eliminating the duplicate name binding.

Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
@KRRT7
Copy link
Copy Markdown
Collaborator Author

KRRT7 commented Mar 17, 2026

@claude fix mypy issue

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

Claude finished @KRRT7's task in 4m 5s —— View job


Fixed mypy CI failure

  • Gather context
  • Check current mypy/prek status
  • Remove deleted file from mypy_allowlist.txt
  • Commit and push

Root cause: mypy_allowlist.txt still referenced codeflash/cli_cmds/cli_common.py, which was deleted in this PR. CI was failing immediately with:

mypy: can't read file 'codeflash/cli_cmds/cli_common.py': No such file or directory

Fix: Removed the deleted file from mypy_allowlist.txt (line 36). Pushed as fix: remove deleted cli_common.py from mypy_allowlist.txt.
| Branch

Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
@KRRT7 KRRT7 merged commit d6c8a0a into main Mar 17, 2026
26 of 28 checks passed
@KRRT7 KRRT7 deleted the cleanup/remove-dead-code branch March 17, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant