Reorganize code_gen and command tests by concern#68
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
test_code_gen.py(serializers, snippets, transcribe rendering) andtest_code_gen_stream_agent.py(stream/agent scaffolds)test_transcribe.py(output rendering, LLM transforms, sources) andtest_transcribe_show_code.py(transcribe--show-codeprint-only behavior)test_stream_command.py(source/streaming behavior) andtest_stream_show_code.py(stream--show-codeprint-only behavior)Key Changes
New test files:
tests/test_code_gen_stream_agent.py— 131 lines of stream/agent scaffold code generation tests (moved fromtest_code_gen.py)tests/test_transcribe_show_code.py— 113 lines of transcribe--show-codeprint-only behavior tests (moved fromtest_transcribe.py)tests/test_stream_show_code.py— 109 lines of stream--show-codeprint-only behavior tests (moved fromtest_stream_command.py)Modified source files:
aai_cli/transcribe_exec.py— Extracted result delivery logic into newdeliver_result()function andTransformOptionsNamedTuple, consolidating the post-transcription routing (file output, field selection, LLM transforms, or default render) that was previously inline in the command handleraai_cli/commands/transcribe.py— Simplified by delegating result delivery totranscribe_exec.deliver_result()and validation totranscribe_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 deliveryImplementation Details
The refactoring maintains 100% test coverage and passes all mutation gates by:
deliver_result()to consolidate post-transcription logic that was previously scattered across the command handlerTransformOptionsNamedTuple to cleanly pass LLM configuration through the delivery pipelinehttps://claude.ai/code/session_014u8p2QCByGfApna8x969yV