mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
1.7 KiB
1.7 KiB
Scenario: Add Go language support to the optimization system
Context
The team wants to add Go as a supported language for the code optimization pipeline. Go support should include optimization but not test generation. The handler should follow the same patterns as the existing Python and JavaScript/TypeScript implementations.
The existing language modules are:
core/languages/python/-- full support (optimizer, testgen, code repair)core/languages/js_ts/-- optimizer and testgencore/languages/java/-- optimizer and testgen
Task
Outline the complete implementation plan for adding Go language support. Provide:
- The exact directory structure to create.
- The handler class implementation with correct decorator and flags.
- The router changes needed in
core/shared/optimizer_router.py. - The module registration approach so
@register_handlerfires on startup. - The test plan for verifying the new language works.
Write the implementation code for the handler class and the router dispatch change. Do NOT implement the actual optimization logic -- just the skeleton.
Expected Outputs
- Directory structure:
core/languages/go/with__init__.py,optimizer/__init__.py,optimizer/optimizer.py. - Handler class in
core/languages/go/__init__.pyusing@register_handler("go")withsupports_optimizer = Trueand all othersupports_*flags set toFalse. - Router change: a new
if data.language == "go":branch incore/shared/optimizer_router.pywith a lazy import ofoptimize_gofromcore.languages.go.optimizer. - Registration: import added to
core/languages/__init__.py. - Tests: handler registration test, feature dispatch test, mocked optimization flow test, all using
@pytest.mark.asyncio.