--- description: "Generate coverage reports for both backend and frontend, and verify against thresholds." handoffs: - label: "Improve Coverage" agent: "qa-tester" prompt: "Coverage is below threshold. Identify uncovered critical paths and propose additional tests. Current uncovered areas: $ARGUMENTS" condition: "Coverage below threshold" tools: "bash, read, grep" --- ## User Input $ARGUMENTS ## Goal Generate test coverage reports for backend (pytest-cov) and frontend (vitest v8), and verify that coverage meets project thresholds. ## Required Skills MANDATORY USE `skill({name="semantics-testing"})` — coverage conventions. ## Execution Steps ### 1. Generate coverage reports ```bash make coverage ``` ### 2. Review backend coverage ```bash # Detailed terminal output with uncovered lines cd backend && source .venv/bin/activate && python -m pytest tests/ --ignore=tests/integration/ --cov=src --cov-report=term-missing 2>&1 | tail -50 ``` Key metrics to extract: - Overall statement coverage (%) - Files with <80% coverage (list top 5 offenders) - Files with 0% coverage (untested) ### 3. Review frontend coverage ```bash # Frontend coverage (also available via make coverage-frontend) cd frontend && npx vitest run --coverage 2>&1 | tail -50 ``` Frontend thresholds in vitest.config.js: - Statements: 98% - Lines: 98% - Functions: 95% - Branches: 80% ### 4. Check against thresholds If any threshold is not met, identify the specific files/modules dragging coverage down. ### 5. (Optional) Open HTML reports ```bash ls backend/htmlcov/index.html && echo "Backend report: backend/htmlcov/index.html" ls frontend/coverage/index.html && echo "Frontend report: frontend/coverage/index.html" ``` ## Output Format ``` ## Coverage Report ### Backend (pytest-cov) - Statement Coverage: XX% - Files below 80%: N (list top 3-5) - Untested files: N (list top 3-5) ### Frontend (vitest v8) - Statement Coverage: XX% (threshold: 98%) [PASS/FAIL] - Line Coverage: XX% (threshold: 98%) [PASS/FAIL] - Function Coverage: XX% (threshold: 95%) [PASS/FAIL] - Branch Coverage: XX% (threshold: 80%) [PASS/FAIL] ### HTML Reports - Backend: backend/htmlcov/index.html - Frontend: frontend/coverage/index.html ### Overall: [ALL_THRESHOLDS_MET / BELOW_THRESHOLD] ``` ## Constraints - Coverage is generated from unit tests ONLY (no Docker integration tests). - If vitest coverage fails with "threshold not met", report which files are below threshold. - Do NOT modify source code to artificially increase coverage.