# Step 01: Fix Existing Test Failures

## Status Reference
- **Current Status**: In Progress (86% complete)
- **Tests Passing**: 61/71
- **Tests Failing**: 10
- **File**: `tests/unit/test_message_formatter_coverage.py`

## Objectives
1. Fix all 10 failing tests in the message formatter coverage test suite
2. Ensure no regression in passing tests
3. Improve coverage for `message_formatter.py` from 9.15% to ~40%
4. Set foundation for achieving 100% coverage

## Current Failures Analysis

### 1. test_format_success_message_detected
- **Issue**: Expected success indicators (✅, ✨, 🎯, ⭐) not found
- **Root Cause**: Success formatting doesn't always include these emojis
- **Fix**: Update assertion to check for success-related content

### 2. test_format_security_message
- **Issue**: Expected "Security" or "access control" not found
- **Root Cause**: Security message formatting may use different terms
- **Fix**: Update assertions to match actual output

### 3. test_format_business_critical_message
- **Issue**: Expected "Business-critical" or "revenue" not found
- **Root Cause**: Business critical formatting uses different terminology
- **Fix**: Adjust expectations based on actual formatter output

### 4. test_format_integration_message
- **Issue**: Expected "Service integration" or "API connectivity" not found
- **Root Cause**: Integration messages formatted differently
- **Fix**: Update test to match actual formatting

### 5. test_format_with_stakeholder
- **Issue**: Expected stakeholder-specific formatting not found
- **Root Cause**: Stakeholder formatting may be more subtle
- **Fix**: Verify actual stakeholder formatting logic

### 6. test_format_applies_technology_transformations
- **Issue**: Technology transformations not applied as expected
- **Root Cause**: Case sensitivity or pattern matching issues
- **Fix**: Debug transformation logic and update test

### 7. test_extract_business_context
- **Issue**: "User Authenticationentication" (duplication)
- **Root Cause**: Double replacement of "Auth" term
- **Fix**: Fix business term replacement logic

### 8. test_is_metric_message
- **Issue**: "Processed 1000 requests" not detected as metric
- **Root Cause**: Regex pattern doesn't match this format
- **Fix**: Update metric detection regex

### 9. test_add_pattern_with_simple_replacement
- **Issue**: Pattern not added to error_patterns
- **Root Cause**: add_pattern logic for simple replacement
- **Fix**: Fix add_pattern method implementation

### 10. test_format_success_message_unknown_action
- **Issue**: TypeError: str.format() multiple values for 'item'
- **Root Cause**: Template string formatting conflict
- **Fix**: Fix format string template

## Implementation Progress

### Fixed Tests (0/10)
- [ ] test_format_success_message_detected
- [ ] test_format_security_message  
- [ ] test_format_business_critical_message
- [ ] test_format_integration_message
- [ ] test_format_with_stakeholder
- [ ] test_format_applies_technology_transformations
- [ ] test_extract_business_context
- [ ] test_is_metric_message
- [ ] test_add_pattern_with_simple_replacement
- [ ] test_format_success_message_unknown_action

## Next Steps
1. Fix each failing test systematically
2. Run tests after each fix to ensure no regression
3. Update status.json after all tests pass
4. Move to Step 02: Complete Message Formatter Coverage

## Notes for Automation
- Each test fix should be isolated and tested independently
- Avoid changing multiple tests at once
- Document the exact fix applied for each test
- Verify coverage improvement after all fixes