# 🎛️ AGENT TASK MAPPING - desk-moloni

**Orchestration Date**: 2025-09-12 22:39
**Master Orchestrator**: Agent Distribution Phase
**Context**: COMPLIANCE_TASKS.md (7 tasks) + Validation Gates Complete

## 🚨 EMERGENCY PRIORITY - TIER 1 (CRITICAL SECURITY)

### T017: PHP 8.4 Migration Critical Security Fix
- **Agent**: `php-fullstack-engineer`
- **Secondary**: `security-compliance-specialist`
- **Estimate**: 21 dias
- **Priority**: 🔴 EMERGENCY (PHP 8.0 EOL vulnerability)
- **Dependencies**: None (critical path)
- **Parallel Execution**: T018 (version alignment)
- **Files to Update**:
  - `desk_moloni.php:34` (version check)
  - `composer.json:7` (PHP requirement ^8.4)
  - `phpunit.xml:3` (schema update - blocked until PHP 8.4)
  - `modules/desk_moloni/config/config.php:21,42`

**Agent Task Prompt**:
```php
CRITICAL SECURITY TASK: Execute PHP 8.0→8.4 migration following prepared strategy.
PHP 8.0 is EOL (Nov 2023) with 29+ unpatched vulnerabilities in 2024-2025.
IMMEDIATE ACTION REQUIRED.

Context Files: 
- /COMPLIANCE_TASKS.md (T017 details)
- /.orchestrator/research/compatibility_critical_findings.md
- /.orchestrator/validation/technology_compatibility_validation.md

Requirements:
1. Follow 21-day migration plan with staging environment
2. Test all API integrations (DeskCRM + Moloni)
3. Validate all 86 PHP files for compatibility
4. Update version constraints across codebase
5. Rollback procedures tested and documented
6. Zero critical vulnerabilities post-migration

Success Criteria: PHP 8.4 running in production, all tests passing, security audit clear.
```

### T018: Version Check Synchronization
- **Agent**: `dev-helper`
- **Estimate**: 30min
- **Priority**: 🟡 HIGH (alignment critical)
- **Dependencies**: Can run parallel with T017
- **Files Identified**: Multiple version checks need alignment to PHP 8.4+

**Agent Task Prompt**:
```php
SYNCHRONIZATION TASK: Align all PHP version checks to 8.4+ standard.
Currently inconsistent between composer.json (^8.1) and desk_moloni.php (8.0+).

Requirements:
1. Scan entire codebase for PHP version checks
2. Update all version constraints to ^8.4
3. Ensure consistency across all files
4. Document changes made
5. Validate no conflicts with dependencies

Success Criteria: All version checks consistent, no conflicts detected.
```

## 🔧 TIER 2 - QUALITY ENHANCEMENT (POST-MIGRATION)

### T020: PHPUnit Schema Update  
- **Agent**: `dev-helper`
- **Secondary**: `development-lead`
- **Estimate**: 30min
- **Priority**: 🟡 HIGH
- **Dependencies**: T017 (PHP 8.4 must be complete first)
- **Blocker**: PHPUnit 12.x requires PHP 8.3+ (currently blocked by PHP 8.0)

**Agent Task Prompt**:
```php
TESTING FRAMEWORK UPGRADE: Update PHPUnit 9.6→12.3 with PHP 8.4 dependency.

BLOCKED UNTIL: T017 (PHP 8.4 migration) complete

Context:
- Current: PHPUnit 9.6 (limited by PHP 8.0)
- Target: PHPUnit 12.3 (requires PHP 8.3+)
- Breaking Changes: Annotations→attributes, mock changes, data providers

Requirements:
1. Upgrade PHPUnit to ^12.3 in composer.json
2. Update phpunit.xml schema to 12.3 format
3. Migrate test annotations to attributes
4. Fix deprecated mock methods
5. Update data providers to public/static/non-empty
6. Validate all existing tests pass

Success Criteria: PHPUnit 12.x running, all tests green, coverage maintained.
```

### T019: Test Coverage Enhancement
- **Agent**: `dev-helper` 
- **Secondary**: `performance-optimization-engineer`
- **Estimate**: 4h
- **Priority**: 🟡 HIGH
- **Dependencies**: T020 (PHPUnit upgrade)
- **Current Coverage**: 6 files → Target: 25+ files (80% coverage)

**Agent Task Prompt**:
```php
TEST COVERAGE EXPANSION: Increase coverage from current 6 files to 25+ files (80% target).

Requirements:
1. Analyze current test suite structure
2. Identify critical components without coverage
3. Create unit tests for:
   - API Connectors (DeskCRMConnector, MoloniConnector)
   - Data Mappers (CustomerMapper, InvoiceMapper, PaymentMapper)  
   - Sync Engines (CustomerSyncEngine, InvoiceSyncEngine, PaymentSyncEngine)
   - Utilities (Logger, Validator, ConfigManager)
4. Integration tests for critical sync flows
5. Mock external API dependencies
6. Generate coverage reports

Success Criteria: 80%+ code coverage, all critical paths tested, CI integration.
```

## 🚀 TIER 3 - FEATURE DEVELOPMENT (STRATEGIC)

### T021: Phase 2 Web Interface Kickoff
- **Agent**: `project-manager`
- **Secondary**: `web-designer`
- **Estimate**: 1h planning
- **Priority**: 🟢 NORMAL
- **Dependencies**: T017 (PHP migration must be stable)
- **Context**: Phase 2 implementation (16 tasks T001-T016)

**Agent Task Prompt**:
```php
PROJECT KICKOFF: Initiate Phase 2 Web Interface development planning.

Context Files:
- /.specify/plan.md (Phase 2 details)
- /.specify/tasks.md (T001-T016 task breakdown)
- /.specify/specs.md (technical requirements)

Requirements:
1. Review Phase 2 scope (Web Dashboard, Configuration Interface, Reporting)
2. Prioritize tasks T001-T016 based on business value
3. Create development timeline and resource allocation
4. Identify dependencies between web interface tasks
5. Prepare development environment requirements
6. Schedule stakeholder review meetings

Success Criteria: Phase 2 project plan approved, tasks prioritized, timeline established.
```

## ✨ TIER 4 - PERFECTION POLISH (OPTIMIZATION)

### T022: Documentation Polish
- **Agent**: `content-manager`
- **Secondary**: `knowledge-management-expert`
- **Estimate**: 1h
- **Priority**: 🟢 NORMAL
- **Dependencies**: T017-T020 completion
- **Target**: Zero documentation inconsistencies

**Agent Task Prompt**:
```php
DOCUMENTATION REFINEMENT: Polish all project documentation for consistency and accuracy.

Scope:
- PROJETO.md alignment with new PHP 8.4 requirements
- .specify/* files update with current status
- API documentation review
- Installation guides update
- Troubleshooting sections enhancement

Requirements:
1. Review all .md files for consistency
2. Update version references to PHP 8.4
3. Validate all code examples work with new stack
4. Cross-reference all internal links
5. Ensure technical accuracy across documents
6. Standardize formatting and tone

Success Criteria: Documentation 100% accurate, zero inconsistencies, professional presentation.
```

### T023: Performance Micro-Optimizations
- **Agent**: `performance-optimization-engineer`
- **Estimate**: 2h  
- **Priority**: 🟢 LOW
- **Dependencies**: All other tasks complete
- **Target**: 5%+ performance improvement

**Agent Task Prompt**:
```php
PERFORMANCE FINE-TUNING: Apply micro-optimizations for final performance gains.

Focus Areas:
- Database query optimization
- API request batching improvements  
- Memory usage reduction
- Caching strategy enhancement
- Code path optimization

Requirements:
1. Benchmark current performance metrics
2. Profile bottlenecks in sync operations
3. Implement targeted optimizations
4. Measure performance gains
5. Document optimization techniques used
6. Ensure no functionality regression

Success Criteria: 5%+ measurable performance improvement, benchmarks documented.
```

## 🎯 EXECUTION STRATEGY & COORDINATION

### Phase 1: Emergency Security (Week 1-3)
**PARALLEL EXECUTION**:
```bash
# Launch simultaneously for maximum efficiency
Task(php-fullstack-engineer) → T017 (PHP 8.4 Migration)
Task(dev-helper) → T018 (Version Alignment) 
Task(security-compliance-specialist) → Security monitoring T017
```

### Phase 2: Quality Foundation (Week 4)
**SEQUENTIAL EXECUTION** (dependent on PHP 8.4):
```bash
# BLOCKED until T017 complete
Task(dev-helper) → T020 (PHPUnit 12.3)
# Then immediately:
Task(dev-helper) + Task(performance-optimization-engineer) → T019 (Coverage)
```

### Phase 3: Strategic Development (Week 5+)
**PARALLEL PLANNING**:
```bash
Task(project-manager) → T021 (Phase 2 Kickoff)
# Prepare for T001-T016 execution once infrastructure stable
```

### Phase 4: Final Polish (Final Week)
**PARALLEL COMPLETION**:
```bash
Task(content-manager) → T022 (Documentation)
Task(performance-optimization-engineer) → T023 (Performance)
```

## 📊 ORCHESTRATOR MONITORING DASHBOARD

### Success Metrics by Phase:
- **Phase 1 Complete**: Score 92-95/100 (security resolved)
- **Phase 2 Complete**: Score 96-98/100 (quality enhanced)
- **Phase 3 Complete**: Score 99/100 (features planned)
- **Phase 4 Complete**: Score 100/100 🏆 (Descomplicar® Gold)

### Critical Path Monitoring:
1. **T017 (PHP Migration)** = UNBLOCKS → T020, T019, T021
2. **T018 (Version Sync)** = PARALLEL with T017
3. **All other tasks** = DEPENDENT on PHP 8.4 stability

### Risk Mitigation Assignments:
- **Technical Risk**: `dev-helper` + `php-fullstack-engineer` (dual coverage)
- **Security Risk**: `security-compliance-specialist` (continuous monitoring)
- **Integration Risk**: Staging environment testing (all agents)
- **Timeline Risk**: Parallel execution where possible

## 🚀 EXECUTION AUTHORIZATION

**Status**: ✅ **READY FOR COORDINATED LAUNCH**

**Next Actions**:
1. **IMMEDIATE**: Launch T017 + T018 in parallel (emergency security)
2. **Monitor**: Security specialist continuous monitoring during migration
3. **Queue**: T020, T019 ready for immediate launch post-T017
4. **Plan**: T021 strategic planning can start once T017 stable

---

**🎛️ Master Orchestrator Status**: AGENT MAPPING COMPLETE - READY FOR COORDINATED EXECUTION