Skip to content

Reorganize code_gen and command tests by concern#68

Merged
alexkroman merged 1 commit into
mainfrom
claude/beautiful-cori-0qk053
Jun 11, 2026
Merged

Reorganize code_gen and command tests by concern#68
alexkroman merged 1 commit into
mainfrom
claude/beautiful-cori-0qk053

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Split test files to improve organization and maintainability by grouping tests by their primary concern rather than by command.

Summary

This refactoring reorganizes the test suite to separate concerns more clearly:

  • Code generation tests are now split between test_code_gen.py (serializers, snippets, transcribe rendering) and test_code_gen_stream_agent.py (stream/agent scaffolds)
  • Command behavior tests are split between test_transcribe.py (output rendering, LLM transforms, sources) and test_transcribe_show_code.py (transcribe --show-code print-only behavior)
  • Stream command tests are split between test_stream_command.py (source/streaming behavior) and test_stream_show_code.py (stream --show-code print-only behavior)

Key Changes

New test files:

  • tests/test_code_gen_stream_agent.py — 131 lines of stream/agent scaffold code generation tests (moved from test_code_gen.py)
  • tests/test_transcribe_show_code.py — 113 lines of transcribe --show-code print-only behavior tests (moved from test_transcribe.py)
  • tests/test_stream_show_code.py — 109 lines of stream --show-code print-only behavior tests (moved from test_stream_command.py)

Modified source files:

  • aai_cli/transcribe_exec.py — Extracted result delivery logic into new deliver_result() function and TransformOptions NamedTuple, consolidating the post-transcription routing (file output, field selection, LLM transforms, or default render) that was previously inline in the command handler
  • aai_cli/commands/transcribe.py — Simplified by delegating result delivery to transcribe_exec.deliver_result() and validation to transcribe_exec.validate_out_with_llm()

Updated docstrings:

  • tests/test_code_gen.py — Clarified scope (serializers, snippets, transcribe rendering only)
  • tests/test_transcribe.py — Clarified scope (output rendering, LLM transforms, sources only)
  • tests/test_stream_command.py — Clarified scope (source/streaming behavior only)
  • aai_cli/transcribe_exec.py — Updated module docstring to reflect new focus on execution and result delivery

Implementation Details

The refactoring maintains 100% test coverage and passes all mutation gates by:

  • Moving tests without modification (no behavioral changes)
  • Extracting deliver_result() to consolidate post-transcription logic that was previously scattered across the command handler
  • Introducing TransformOptions NamedTuple to cleanly pass LLM configuration through the delivery pipeline
  • Preserving all assertions and validation logic in their new locations

https://claude.ai/code/session_014u8p2QCByGfApna8x969yV

aai_cli/commands/transcribe.py (489 lines) was nearing the 500-line gate:
move the post-transcription result delivery and the --out/--llm conflict
check into transcribe_exec.py, which already owns out_payload and
render_transform_steps for that dispatch. The --llm chain options travel
as a TransformOptions NamedTuple.

Split the three near-limit test files along the same seams already used
by their siblings:
- test_transcribe.py: --show-code tests -> test_transcribe_show_code.py
- test_stream_command.py: --show-code tests -> test_stream_show_code.py
- test_code_gen.py: stream/agent scaffold tests -> test_code_gen_stream_agent.py

https://claude.ai/code/session_014u8p2QCByGfApna8x969yV
@alexkroman alexkroman enabled auto-merge (squash) June 11, 2026 21:32
@alexkroman alexkroman merged commit cefa5ab into main Jun 11, 2026
11 checks passed
@alexkroman alexkroman deleted the claude/beautiful-cori-0qk053 branch June 11, 2026 21:34
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.

2 participants