-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!maintainabilityrefactoringtask-miningtesting
Description
Description
Several test files exceed 1500 lines, making them difficult to navigate and maintain. These should be refactored into smaller, focused test files.
Current State
Test files exceeding 1500 lines:
pkg/workflow/permissions_test.go(1551 lines)pkg/workflow/expressions_test.go(1523 lines)pkg/workflow/compiler_safe_outputs_test.go(1515 lines)pkg/workflow/safe_outputs_import_test.go(1481 lines)pkg/cli/logs_test.go(1803 lines)pkg/cli/mcp_server_test.go(1572 lines)
Problem
- Hard to navigate: Finding specific tests in 1500+ line files is time-consuming
- Merge conflicts: Large files increase the likelihood of merge conflicts
- Context switching: Developers lose context when scrolling through massive files
- Testing complexity: Difficult to understand test coverage at a glance
Suggested Changes
Phase 1: High Priority (>1500 lines)
-
Split
pkg/cli/logs_test.go(1803 lines):logs_parsing_test.go- Log parsing and analysis testslogs_download_test.go- Download and file handling testslogs_json_test.go- JSON output testslogs_mcp_test.go- MCP-specific tests
-
Split
pkg/cli/mcp_server_test.go(1572 lines):mcp_server_config_test.go- Configuration testsmcp_server_validation_test.go- Validation testsmcp_server_integration_test.go- Integration tests
-
Split
pkg/workflow/permissions_test.go(1551 lines):permissions_validation_test.go- Permission validation testspermissions_shorthand_test.go- Shorthand syntax testspermissions_detailed_test.go- Detailed permission tests
Phase 2: Medium Priority (1400-1500 lines)
- Split remaining files following similar patterns
Naming Convention
For split test files:
- Use descriptive suffixes that indicate the test focus area
- Example:
{original_name}_{focus_area}_test.go - Keep related tests together in the same file
Success Criteria
- ✅ No test file exceeds 1000 lines
- ✅ Test files are logically grouped by functionality
- ✅ All tests pass (
make test-unit) - ✅ Test coverage remains the same or improves
- ✅ Clear naming conventions followed
Benefits
- Improved maintainability: Easier to find and update specific tests
- Better organization: Tests grouped by functionality
- Reduced merge conflicts: Smaller files = fewer conflicts
- Faster navigation: Developers can quickly locate relevant tests
- Better test documentation: File names indicate test focus areas
Implementation Notes
- Split tests in phases to avoid massive PRs
- Ensure no tests are lost during refactoring
- Run
make agent-finishafter each split to verify - Keep test helper functions in appropriate files
Source
Extracted from codebase analysis - Multiple test files exceed recommended 1000-line limit
Priority
Medium - Improves long-term maintainability but not blocking
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 10, 2026, 5:12 AM UTC
Copilot
Metadata
Metadata
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!maintainabilityrefactoringtask-miningtesting