Address code review feedback for model get/list commands.#20
Address code review feedback for model get/list commands.#20github-actions[bot] merged 1 commit intomainfrom
Conversation
- Extract shared UUID handling and model lookup utilities to src/domain/models/model_lookup.ts - Fix model_get_output.tsx to use ink's render instead of ink-testing-library - Memoize fzf instances in model_list_output.tsx and type_search_output.tsx to avoid recreation on every render - Fix missing space in KeyValue display (now shows ID: value instead of ID:value) - Add unit tests for isUuid() and filterModels() functions - Export filterModels from model_list.ts to enable direct testing ### Changes ┌────────────────────────────────────────────────┬────────────────────────────────────────────────────────────┐ │ File │ Change │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/domain/models/model_lookup.ts │ New shared utility with isUuid() and findInputByIdGlobal() │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/domain/models/model_lookup_test.ts │ Tests for UUID validation │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/cli/commands/model_get.ts │ Import from shared utility │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/cli/commands/model_validate.ts │ Import from shared utility │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/cli/commands/model_list.ts │ Export filterModels for testing │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/cli/commands/model_list_test.ts │ Add tests for filterModels() │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/presentation/output/model_get_output.tsx │ Use ink render, fix KeyValue spacing │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/presentation/output/model_list_output.tsx │ Memoize fzf instance │ ├────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┤ │ src/presentation/output/type_search_output.tsx │ Memoize fzf instance │ └────────────────────────────────────────────────┴────────────────────────────────────────────────────────────┘ ###Test plan - Run deno run test - all 317 tests pass - Run deno lint - no issues - Run deno fmt --check - properly formatted
PR Review: Address code review feedback for model get/list commandsOverall this is a solid refactoring PR that improves code quality through DRY principles, performance optimizations, and better test coverage. Here's my detailed feedback: ✅ Strengths1. Good DRY Refactoring
2. Proper Domain Placement
3. Performance Improvements
4. Correct Ink Usage
5. Good Test Coverage
6. Code Style Compliance
🔍 Minor Observations1. Missing test for The 2. Infrastructure dependency in domain layer
import type { YamlInputRepository } from "../../infrastructure/persistence/yaml_input_repository.ts";While this is only a type import (not a runtime dependency), in strict DDD the domain layer typically shouldn't depend on infrastructure. Consider defining an 3. The These exist in 🧪 VerificationThe PR description states:
✅ VerdictApprove - This is a well-structured refactoring PR that:
The minor observations above are suggestions for future improvements, not blockers for this PR. |
The _swampClub module-level singleton was keyed on nothing — once created for issue #N, every subsequent getSwampClub() call returned the same client regardless of the new issueNumber in globalArgs. Since user models are loaded via dynamic import() in the same process, the module stays cached across method calls, so running start for issue #10 and then issue #20 in the same session silently sent #20's lifecycle entries, type updates, and status transitions to #10. Drop the cache entirely and call createSwampClubClient directly at each use. The reachability check is a single 5s-timeout HTTP GET and runs once per method invocation — negligible next to the lifecycle POST already happening on the same code path. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Changes
src/domain/models/model_lookup.tsisUuid()andfindInputByIdGlobal()src/domain/models/model_lookup_test.tssrc/cli/commands/model_get.tssrc/cli/commands/model_validate.tssrc/cli/commands/model_list.tsfilterModelsfor testingsrc/cli/commands/model_list_test.tsfilterModels()src/presentation/output/model_get_output.tsxsrc/presentation/output/model_list_output.tsxsrc/presentation/output/type_search_output.tsx###Test plan