mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
1.8 KiB
1.8 KiB
Scenario 3: Fix a Bug in the Optimizer Router and Commit
Context
A bug has been reported on Linear issue CF-847: the optimizer router in core/shared/optimizer_router.py fails to handle the case where data.language is "ts" (a shorthand some clients send instead of "typescript"). This causes a 500 error because the request falls through to the Python handler, which cannot parse TypeScript code.
The fix needs to normalize language aliases before dispatching. The developer should fix the bug, create tests, and commit the changes following the project's git conventions.
Task
-
Fix the bug in
core/shared/optimizer_router.py:- Add normalization of language aliases (
"ts"->"typescript","js"->"javascript","py"->"python") - Preserve the existing lazy import pattern for dispatch
- Keep the fix minimal and focused
- Add normalization of language aliases (
-
Add a test in
tests/optimizer/test_language_normalization.py:- Test that language aliases are correctly normalized
- Use
@pytest.mark.asynciofor async tests - Follow the feature-based test organization
-
Commit the changes following git conventions:
- Create a new branch from
mainnamedcf-847-fix-language-alias-normalization - Run pre-commit checks:
uv run prek run --all-files - Make an atomic commit with a conventional commit message (this is a bug fix, so
fix:) - Include
CF-847reference in the commit body or branch name
- Create a new branch from
Expected Outputs
- Updated
core/shared/optimizer_router.pywith alias normalization - New
tests/optimizer/test_language_normalization.py - Git branch:
cf-847-fix-language-alias-normalization(created frommain) - Commit message:
fix: normalize language aliases in optimizer router(or similar conventional format) - Pre-commit checks passed before commit