# Masterful Testing & Quality Plan

**Date**: 2026-02-28
**Goal**: Zero warnings, zero failures, comprehensive test coverage, GitHub SSOT

## Phase 1: Fix Existing Issues (Pre-requisite)
1. Fix failing test: `test_prompt_guard.py::TestPerformance::test_detection_under_10ms_long_prompt`
2. Fix 25 mypy errors in `hive/` module
3. Get PR #382 (CLI E2E) CI green and merged

## Phase 2: Backend Coverage Push (53% → 80%+)
Priority modules by impact (0% or very low coverage):
- `llmhosts/router/fallback.py` — 0%
- `llmhosts/router/latency.py` — 0%
- `llmhosts/tier.py` — 0%
- `llmhosts/version.py` — 0%
- `llmhosts/router/knn.py` — 33%
- `llmhosts/router/gpu_less.py` — 20%
- `llmhosts/router/modernbert.py` — 25%
- `llmhosts/tunnel/` — 17-29%
- `llmhosts/router/engine.py` — 60%
- `llmhosts/up.py` — 60%
- `llmhosts/server.py` — 65%
- `llmhosts/training/trainer.py` — 45%
- `llmhosts/topology/mapper.py` — 61%

## Phase 3: Frontend Coverage Gaps
- `lib/onboarding-sequences.ts` — 5%
- `lib/email/send.ts` — 50%
- `lib/email/templates.ts` — 55%
- `lib/token/openrouter.ts` — 23%
- `lib/utils.ts` — 33%
- `lib/rate-limit.ts` — 70%
- `lib/marketplace-reputation.ts` — 61%

## Phase 4: E2E Test Completion
- Audit existing 12 E2E specs for completeness
- Add missing flows (token assistant, marketplace, device management)
- Ensure all non-human-dependent flows covered

## Phase 5: GitHub Sync
- All work on feature branches with PRs
- Issues closed via PR body
- CI green on main at all times

## Resource Management
- Max 1 Claude session active during heavy work
- Monitor memory every 15 operations
- Docker: voice-agent stopped, limits on uncapped containers
