ln-370-test-auditor Workflow

L2 Coordinator v3.0.0 | Domain-Aware Coverage Gaps

Overview

Purpose: Coordinates 5 specialized test audit workers with domain-aware coverage gap analysis.

Type: Orchestrator-Worker Pattern (L2 Coordinator + 5 L3 Workers)

Domain Support: Auto-detects project domains; runs Coverage Gaps (ln-634) per domain.

Invocation: Manual - user runs when needed for test suite optimization.

Main Workflow (7 Phases)

graph TD Start([START]) --> Phase1[Phase 1: Discovery
Find all test files
*.test.*, *.spec.*] Phase1 --> Phase2[Phase 2: Research
MCP Ref + Context7
Best practices ONCE
Build contextStore] Phase2 --> Phase3[Phase 3: Domain Discovery
Detect project structure
Build domain_map
Set domain_mode] Phase3 --> Decision{Domains
found?} Decision -->|Yes domain-aware| Phase4a Decision -->|No global| Phase4aGlobal[Phase 4a: Global Workers
4 workers PARALLEL] Phase4a[Phase 4a: Global Workers
4 workers PARALLEL] --> Phase4b[Phase 4b: Domain-Aware
ln-634 per domain
PARALLEL] Phase4aGlobal --> Phase4bGlobal[Phase 4b: ln-634
global mode] Phase4b --> Phase5[Phase 5: Aggregate
Group by domain
Domain Coverage Summary
Calculate scores] Phase4bGlobal --> Phase5 Phase5 --> Phase6[Phase 6: Report
Compliance Scores
Domain-grouped findings
Recommendations] Phase6 --> Phase7[Phase 7: Create Task
Linear Epic 0
Full report] Phase7 --> End([END:
Audit task created]) classDef phase fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef newphase fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px classDef decision fill:#FFF3E0,stroke:#FF9800,stroke-width:2px classDef endpoint fill:#C8E6C9,stroke:#388E3C,stroke-width:2px class Phase1,Phase2,Phase4a,Phase4aGlobal,Phase5,Phase6,Phase7 phase class Phase3,Phase4b,Phase4bGlobal newphase class Decision decision class Start,End endpoint

Worker Distribution

graph TB subgraph Coordinator["ln-370-test-auditor (L2)"] direction TB Coord[Orchestrator
Domain Discovery
Context Building
Aggregation] end subgraph GlobalWorkers["Global Workers (4) - Entire Test Suite"] direction LR W1[ln-371
Business Logic
MEDIUM] W2[ln-372
E2E Priority
HIGH] W3[ln-373
Value
CRITICAL] W5[ln-375
Isolation
MEDIUM] end subgraph DomainWorkers["Domain-Aware Worker (1 x N) - Per Domain"] direction TB subgraph DomainUsers["Domain: users"] W4u[ln-634
Coverage Gaps] end subgraph DomainOrders["Domain: orders"] W4o[ln-634
Coverage Gaps] end subgraph DomainPayments["Domain: payments"] W4p[ln-634
Coverage Gaps] end end Coord --> GlobalWorkers Coord --> DomainWorkers classDef coordinator fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef critical fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px classDef high fill:#FFE0B2,stroke:#F57C00,stroke-width:2px classDef medium fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px classDef domain fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px class Coord coordinator class W3 critical class W2 high class W1,W5 medium class W4u,W4o,W4p domain

Domain Discovery Algorithm

graph TD Start2([Check Structure]) --> P1{Priority 1:
Explicit domains?} P1 -->|Found| UseExplicit[Use domains/features/modules] P1 -->|Not found| P2{Priority 2:
src/* folders?} P2 -->|Found >1| FilterInfra[Filter infrastructure
utils/shared/config/types] P2 -->|Not found| P3[Priority 3:
Fallback to global] FilterInfra --> HasDomains{Remaining
>1 folders?} HasDomains -->|Yes| UseSrc[Use src/* as domains] HasDomains -->|No| P3 UseExplicit --> DomainAware([domain_mode = domain-aware]) UseSrc --> DomainAware P3 --> GlobalMode([domain_mode = global]) classDef decision fill:#FFF3E0,stroke:#FF9800,stroke-width:2px classDef process fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef result fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px class P1,P2,HasDomains decision class UseExplicit,FilterInfra,UseSrc,P3 process class DomainAware,GlobalMode,Start2 result

Usefulness Score Decision Flow

graph TD Test[Each Test] --> CalcScore[Calculate Score
Impact 1-5 x Probability 1-5] CalcScore --> Check{Score?} Check -->|15-25| Keep[KEEP
High value test] Check -->|10-14| Review[REVIEW
Check if E2E covers] Check -->|1-9| Remove[REMOVE
Delete test] Review --> ReviewQ{Already covered
by E2E?} ReviewQ -->|Yes| Remove ReviewQ -->|No| Keep Keep --> Done[Include in suite] Remove --> Delete[Add to removal list] classDef keep fill:#C8E6C9,stroke:#388E3C,stroke-width:2px classDef review fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px classDef remove fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px classDef neutral fill:#E3F2FD,stroke:#1976D2,stroke-width:2px class Keep,Done keep class Review,ReviewQ review class Remove,Delete remove class Test,CalcScore,Check neutral

Audit Categories

graph LR subgraph Core C1[1. Business Logic Focus
OUR code vs Framework] C2[2. E2E Priority
E2E primary, rest secondary] end subgraph Value V1[3. Risk-Based Value
Priority >= 15 required] V2[4. Coverage Gaps
Per-domain analysis] end subgraph Quality Q1[5. Test Isolation
Mocking, determinism] Q2[6. Anti-Patterns
Liars, Giants, etc.] end C1 --> C2 --> V1 --> V2 --> Q1 --> Q2 classDef core fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef value fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px classDef domain fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px classDef quality fill:#E1BEE7,stroke:#7B1FA2,stroke-width:2px class C1,C2 core class V1 value class V2 domain class Q1,Q2 quality

Output: Report with Domain Coverage Summary

## Test Suite Audit Report - 2025-12-22

### Compliance Score
| Category | Score |
|----------|-------|
| Business Logic Focus | 8/10 |
| E2E Priority | 7/10 |
| Risk-Based Value | 7/10 |
| Coverage Gaps | 6.5/10 |
| Test Isolation | 8/10 |
| Anti-Patterns | 7/10 |
| **Overall** | **7.3/10** |

### Domain Coverage Summary (NEW)
| Domain | Critical Paths | Tested | Coverage % | Gaps |
|--------|---------------|--------|------------|------|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| shared | 4 | 4 | 100% | 0 |
| **Total** | **24** | **18** | **75%** | **6** |

### Coverage Gaps by Domain
#### Domain: users (src/users/)
| Severity | Category | Missing Test | Location |
| CRITICAL | Money | E2E: processRefund() | services/user.ts:120 |

#### Domain: orders (src/orders/)
| Severity | Category | Missing Test | Location |
| CRITICAL | Money | E2E: applyDiscount() | services/order.ts:45 |
| HIGH | Data | Integration: orderTransaction() | repositories/order.ts:78 |
    

Key Characteristics