Phase 1 Track A - Legacy Removal (COMPLETE): - Delete 17 legacy handler files (10,433 lines removed) - Remove legacy tool definitions from tools.ts (100→84 tools) - Clean up TOOL_NAMES constant - Update index.ts exports for all affected modules - Fix server.ts imports Handlers Deleted: - src/mcp/handlers/test-generate.ts - src/mcp/handlers/quality-analyze.ts - src/mcp/handlers/predict-defects.ts - src/mcp/handlers/optimize-tests.ts - src/mcp/handlers/quality/* (5 files) - src/mcp/handlers/prediction/regression-risk-analyze.ts - src/mcp/handlers/analysis/performanceBenchmarkRun.ts - src/mcp/handlers/analysis/performance-benchmark-run-handler.ts - src/mcp/handlers/advanced/requirements-validate.ts - src/mcp/handlers/advanced/requirements-generate-bdd.ts - src/mcp/handlers/security/validate-auth.ts - src/mcp/handlers/security/check-authz.ts - src/mcp/handlers/security/scan-dependencies.ts Phase 4 - Documentation (COMPLETE): - Add deprecation warnings to kept legacy handlers - Create migration guide at docs/migration/issue-115-tool-optimization.md - Update docs/reference/agents.md with tool discovery system - Update docs/reference/usage.md with lazy loading examples Metrics: - Tool count: 100+ → 84 (16% reduction) - Context reduction: 87% via lazy loading - Lines removed: 10,433 Closes #115 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Test Suite Migration Documentation
Migration Status: 🟡 Planning Phase Start Date: TBD Target Completion: 6-7 weeks from start
📚 Documentation Index
Executive Documents
-
MIGRATION-SUMMARY.md - Executive summary for stakeholders
- Overview of current problems
- Goals and success criteria
- ROI and timeline
- Quick reference guide
-
test-suite-restructuring-plan.md - Complete migration plan
- Detailed 5-phase plan with 29 tasks
- Verification steps for each task
- Risks and mitigations
- Mermaid dependency diagram
Progress Tracking
-
progress-tracking.md - Live progress dashboard
- Real-time metrics and phase completion
- Daily progress log
- Blockers and issues
- Lessons learned
-
ANALYSIS-RESULTS.md - Test suite analysis findings
- Current state metrics (actual data)
- Top 17 large files to split
- Top 10 duplicate groups
- Revised targets based on analysis
Technical Resources
- duplicate-analysis.json - Raw analysis data
- Generated by
scripts/analyze-test-duplicates.ts - 402 test files analyzed
- Duplicate patterns identified
- Category breakdown
- Generated by
🎯 Quick Start Guide
For Stakeholders
Read: MIGRATION-SUMMARY.md (5 min)
- Understand the problem
- Review success criteria
- See expected ROI
For Developers
Read: test-suite-restructuring-plan.md (15 min)
- Review 5-phase plan
- Understand new test structure
- See verification steps
For Migration Lead
Read all documents in order:
- MIGRATION-SUMMARY.md - Context
- ANALYSIS-RESULTS.md - Current state
- test-suite-restructuring-plan.md - Execution plan
- progress-tracking.md - Daily tracking
🔧 Tools & Scripts
Analysis Script
Run weekly to track progress:
npx tsx scripts/analyze-test-duplicates.ts
Output: docs/migration/duplicate-analysis.json
What it does:
- Counts test files and lines
- Identifies large files (>1,000 lines)
- Finds duplicate test patterns
- Categorizes tests (user-value, contract, implementation-detail)
- Generates recommendations
Migration CI Pipeline
GitHub Actions workflow: .github/workflows/migration-validation.yml
Runs on:
- Push to
migration/**branches - Pull requests to
mainaffectingtests/
What it checks:
- Journey tests pass (if exist)
- Contract tests pass (if exist)
- Infrastructure tests pass (if exist)
- No files > 600 lines
- No skipped tests
- New directory structure compliance
📊 Key Metrics (Baseline)
Current State (2025-12-02)
- Test Files: 402
- Lines of Code: 195,929
- Execution Time: ~5 minutes
- Files > 1,000 Lines: 17
- Skipped Tests: 7 blocks
Target State
- Test Files: 100 (75% reduction)
- Lines of Code: 60,000 (69% reduction)
- Execution Time: < 2 minutes (60% reduction)
- Files > 600 Lines: 0
- Skipped Tests: 0
Test Focus
- User Value: 61.7% (maintain)
- Contracts: 22.3% (maintain)
- Implementation: 2.5% → 0% (delete)
- Unknown: 13.5% → categorize
🏗️ New Test Structure
tests/
├── journeys/ # 70% of effort - User journeys
│ ├── init-and-bootstrap.test.ts
│ ├── generate-tests.test.ts
│ ├── execute-tests.test.ts
│ ├── coverage-analysis.test.ts
│ ├── quality-gate.test.ts
│ ├── flaky-detection.test.ts
│ └── learning-improvement.test.ts
│
├── contracts/ # 20% of effort - API boundaries
│ ├── mcp-tools.test.ts
│ ├── cli-commands.test.ts
│ └── agent-interfaces.test.ts
│
├── infrastructure/ # 10% of effort - Core systems
│ ├── database.test.ts
│ ├── memory-coordination.test.ts
│ ├── event-bus.test.ts
│ ├── base-agent.test.ts
│ ├── learning-engine.test.ts
│ └── flaky-test-detector.test.ts
│
└── regression/ # Bug prevention
└── fixed-bugs/
├── issue-123.test.ts
└── issue-456.test.ts
📋 Migration Phases
Phase 1: Setup & Analysis (4-6 hours) ⬜ Not Started
Create infrastructure, analyze codebase, establish baselines
Key Deliverable: Migration CI pipeline + baseline metrics
Phase 2: Create Journey Tests (8-12 hours) ⬜ Not Started
Implement 7 core user journeys with real database
Key Deliverable: 7 journey tests passing with 100% reliability
Phase 3: Consolidate Unit Tests (12-16 hours) ⬜ Not Started
Merge duplicate files, focus on business logic
Key Deliverable: All unit tests < 600 lines, no duplicates
Phase 4: Delete Redundant Tests (4-6 hours) ⬜ Not Started
Remove implementation detail tests, clean up old structure
Key Deliverable: ~60K lines deleted, old directories removed
Phase 5: CI/CD Integration (4-6 hours) ⬜ Not Started
Optimize execution, add coverage gates, generate dashboard
Key Deliverable: CI/CD < 2 minutes with automated gates
🚀 Getting Started
Step 1: Review Documents (1 hour)
- Read MIGRATION-SUMMARY.md
- Read ANALYSIS-RESULTS.md
- Review test-suite-restructuring-plan.md
Step 2: Team Alignment (30 min)
- Schedule kick-off meeting
- Assign migration lead
- Review success criteria with team
- Get buy-in from stakeholders
Step 3: Create Tracking Issue (15 min)
- Copy
.github/ISSUE_TEMPLATE/test-suite-migration.mdto new issue - Fill in migration lead, start date, target completion
- Assign reviewers
- Pin issue to project board
Step 4: Run Analysis (5 min)
- Run
npx tsx scripts/analyze-test-duplicates.ts - Review
docs/migration/duplicate-analysis.json - Verify baseline metrics match documentation
Step 5: Start Phase 1 (4-6 hours)
- Create directory structure
- Setup migration CI job
- Document baseline coverage
- Create test mapping document
📞 Questions & Support
Documentation Issues
If you find errors or have suggestions:
- Open a GitHub issue with label
documentation - Tag the migration lead
- Reference specific document and section
Migration Blockers
If you encounter blockers:
- Update progress-tracking.md "Blockers" section
- Add comment to tracking GitHub issue
- Escalate to migration lead
Technical Questions
For questions about implementation:
- Check test-suite-restructuring-plan.md Phase details
- Review verification steps for specific task
- Ask in team Slack channel
📈 Success Criteria
Migration is complete when ALL of these are true:
- All 7 journey tests pass with 100% reliability
- Test execution time < 2 minutes
- 70% of tests focus on user-facing behavior
- Zero skipped tests in CI/CD pipeline
- No test file > 600 lines
- Test coverage maintained ≥85% for critical paths
- Documentation updated (README, testing guide)
- Team trained on new structure
- CI/CD pipeline includes migration validation
🎓 Learning Resources
Testing Best Practices
- Testing Trophy - Kent C. Dodds
- Test Pyramid - Martin Fowler
- Test Sizes - Google Testing Blog
Project Policies
- Test Execution Policy - How to run tests safely
- Git Operations Policy - Git workflow rules
📝 Document Maintenance
When to Update
- Daily: progress-tracking.md - Add daily log entry
- Weekly: Run analysis script, update metrics in progress tracking
- Phase completion: Update phase checkboxes in all documents
- Blocker: Add to progress tracking immediately
- Lesson learned: Add to progress tracking
Who Updates What
- Migration Lead: All documents
- Team Members: progress-tracking.md (daily logs, blockers)
- GOAP Specialist: Initial creation only (human updates after)
Version History
- v1.0.0 (2025-12-02): Initial migration plan created by GOAP Specialist
- 5 phases, 29 tasks
- Baseline analysis: 402 files, 195,929 lines
- Revised targets based on actual data
- Migration CI pipeline created
Migration Lead: TBD Created: 2025-12-02 by GOAP Specialist Last Updated: 2025-12-02 Next Review: TBD (after Phase 1 completion)
This directory contains the complete Test Suite Migration plan and tracking. All documents are living documents that should be updated throughout the migration.