Skip to content

Commit 9b1474f

Browse files
GeneAIclaude
authored andcommitted
test: Add extended tests for PII scrubber and Claude memory
- test_pii_scrubber_extended.py: 86 new tests for custom patterns, overlapping PII detection, healthcare variants, and edge cases - test_claude_memory_extended.py: 43 new tests for enterprise/user memory loading, error handling, and import processing - TEST_COVERAGE_PLAN.md: Coverage improvement roadmap Total tests: 1,491 → 1,620 (+129) Coverage: 75.90% → 77.88% (+2%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5d37439 commit 9b1474f

File tree

3 files changed

+2122
-0
lines changed

3 files changed

+2122
-0
lines changed

TEST_COVERAGE_PLAN.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Test Coverage Improvement Plan
2+
3+
**Current:** 75.90% (1,491 tests)
4+
**Target:** 90%+
5+
**Estimated New Tests:** ~150-180 test cases
6+
7+
---
8+
9+
## Phase 1: Security Modules (Priority: CRITICAL)
10+
11+
### 1.1 PII Scrubber (60% → 90%)
12+
**Estimated Tests:** 25
13+
14+
| Test Category | Tests | Parallelizable |
15+
|---------------|-------|----------------|
16+
| Custom pattern management | 8 | Yes |
17+
| Overlapping PII detection | 5 | Yes |
18+
| Pattern validation suite | 8 | Yes |
19+
| Healthcare PII variants | 4 | Yes |
20+
21+
### 1.2 Secure MemDocs (75% → 95%)
22+
**Estimated Tests:** 30
23+
24+
| Test Category | Tests | Parallelizable |
25+
|---------------|-------|----------------|
26+
| Encryption/decryption operations | 10 | Yes |
27+
| Pattern classification logic | 8 | Yes |
28+
| Access control enforcement | 8 | Yes |
29+
| Retention policy validation | 4 | Yes |
30+
31+
### 1.3 Audit Logger (73% → 92%)
32+
**Estimated Tests:** 25
33+
34+
| Test Category | Tests | Parallelizable |
35+
|---------------|-------|----------------|
36+
| Directory initialization | 4 | Yes |
37+
| Log rotation and cleanup | 8 | Yes |
38+
| Query operators | 8 | Yes |
39+
| Compliance reporting | 5 | Yes |
40+
41+
---
42+
43+
## Phase 2: Claude Memory Integration (72% → 95%)
44+
45+
**Estimated Tests:** 20
46+
47+
| Test Category | Tests | Parallelizable |
48+
|---------------|-------|----------------|
49+
| Enterprise memory loading | 5 | Yes |
50+
| User memory loading | 4 | Yes |
51+
| Error handling paths | 6 | Yes |
52+
| Import processing edge cases | 5 | Yes |
53+
54+
---
55+
56+
## Phase 3: CLI Modules
57+
58+
### 3.1 empathy_software_plugin/cli.py (34% → 75%)
59+
**Estimated Tests:** 35
60+
61+
| Test Category | Tests | Parallelizable |
62+
|---------------|-------|----------------|
63+
| analyze_project() async | 10 | No (integration) |
64+
| gather_project_context() | 8 | Yes |
65+
| scan_command() | 10 | Yes |
66+
| list_wizards/wizard_info | 7 | Yes |
67+
68+
### 3.2 src/empathy_os/cli.py (45% → 80%)
69+
**Estimated Tests:** 40
70+
71+
| Test Category | Tests | Parallelizable |
72+
|---------------|-------|----------------|
73+
| cmd_run() interactive REPL | 12 | No (sequential) |
74+
| cmd_inspect() branches | 8 | Yes |
75+
| cmd_export/import | 10 | Yes |
76+
| cmd_wizard() flow | 10 | Yes |
77+
78+
---
79+
80+
## Parallel Execution Strategy
81+
82+
### Batch 1 (Security - Can Run Simultaneously)
83+
```
84+
Agent A: PII Scrubber tests (25 tests)
85+
Agent B: Secure MemDocs tests (30 tests)
86+
Agent C: Audit Logger tests (25 tests)
87+
Agent D: Claude Memory tests (20 tests)
88+
```
89+
90+
### Batch 2 (CLI - Sequential Dependencies)
91+
```
92+
Agent E: Software plugin CLI (35 tests)
93+
Agent F: EmpathyOS CLI (40 tests)
94+
```
95+
96+
---
97+
98+
## Test Fixtures Required
99+
100+
### Shared Fixtures (Create First)
101+
```python
102+
# conftest.py additions
103+
104+
@pytest.fixture
105+
def temp_project_with_ai_files(tmp_path):
106+
"""Project with AI library imports"""
107+
108+
@pytest.fixture
109+
def mock_registry():
110+
"""Mock plugin registry"""
111+
112+
@pytest.fixture
113+
def mock_empathy_os():
114+
"""Mock EmpathyOS instance"""
115+
116+
@pytest.fixture
117+
def simulate_user_input(monkeypatch):
118+
"""Interactive input simulation"""
119+
120+
@pytest.fixture
121+
def encryption_key():
122+
"""Valid AES-256 key for testing"""
123+
124+
@pytest.fixture
125+
def mock_audit_directory(tmp_path):
126+
"""Temporary audit log directory"""
127+
```
128+
129+
---
130+
131+
## Execution Order
132+
133+
1. **Create fixtures** (conftest.py) - 30 min
134+
2. **Phase 1 Batch** (Security) - Parallel agents - 2 hours
135+
3. **Phase 2** (Claude Memory) - Single agent - 1 hour
136+
4. **Phase 3 Batch** (CLI) - Parallel agents - 2 hours
137+
5. **Integration tests** - Sequential - 1 hour
138+
6. **Coverage verification** - Final run - 30 min
139+
140+
**Total estimated time: 6-7 hours**
141+
142+
---
143+
144+
## Success Criteria
145+
146+
| Module | Before | After | Delta |
147+
|--------|--------|-------|-------|
148+
| pii_scrubber.py | 60% | 90% | +30% |
149+
| secure_memdocs.py | 75% | 95% | +20% |
150+
| audit_logger.py | 73% | 92% | +19% |
151+
| claude_memory.py | 72% | 95% | +23% |
152+
| software_plugin/cli.py | 34% | 75% | +41% |
153+
| empathy_os/cli.py | 45% | 80% | +35% |
154+
| **OVERALL** | **75.9%** | **90%+** | **+14%** |
155+
156+
---
157+
158+
## Agent Task Assignments
159+
160+
When ready to execute, spawn these agents in parallel:
161+
162+
```
163+
Task 1: "Write tests for PII scrubber custom patterns and overlaps"
164+
Task 2: "Write tests for secure_memdocs encryption and access control"
165+
Task 3: "Write tests for audit_logger rotation and compliance"
166+
Task 4: "Write tests for claude_memory enterprise/user loading"
167+
Task 5: "Write tests for software_plugin CLI commands"
168+
Task 6: "Write tests for empathy_os CLI interactive commands"
169+
```

0 commit comments

Comments
 (0)