codeflash-internal/tiles/codeflash-internal-skills/evals/scenario-3/task.md
2026-02-14 22:25:30 -05:00

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 testgen
  • core/languages/java/ -- optimizer and testgen

Task

Outline the complete implementation plan for adding Go language support. Provide:

  1. The exact directory structure to create.
  2. The handler class implementation with correct decorator and flags.
  3. The router changes needed in core/shared/optimizer_router.py.
  4. The module registration approach so @register_handler fires on startup.
  5. 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__.py using @register_handler("go") with supports_optimizer = True and all other supports_* flags set to False.
  • Router change: a new if data.language == "go": branch in core/shared/optimizer_router.py with a lazy import of optimize_go from core.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.