// Analyze test coverage, identify gaps, detect dead code, and improve test quality. Use when user asks to check coverage, review tests, find untested code, or improve test robustness.
| name | Test Coverage Guardian |
| description | Analyze test coverage, identify gaps, detect dead code, and improve test quality. Use when user asks to check coverage, review tests, find untested code, or improve test robustness. |
Analyze and improve test coverage for the AILANG codebase.
Most common usage:
# Quick coverage check
make test-coverage-badge # Shows: "Coverage: 29.9%"
# Detailed coverage report
make test-coverage # Generates HTML report
# Coverage for specific package
go test -cover ./internal/parser/...
Invoke when user says:
make test-coverage-badge
# Output: Coverage: 29.9%
make test-coverage
# Opens: coverage.html in browser
go test -cover ./internal/parser/...
go test -cover ./internal/types/...
go test -cover ./internal/eval/...
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | grep -E "^total:|0\.0%"
| Module | Target | Priority |
|---|---|---|
| lexer | 80%+ | High |
| parser | 80%+ | High |
| types | 80%+ | High |
| eval | 70%+ | Medium |
| effects | 70%+ | Medium |
| repl | 50%+ | Low |
Critical paths (100% target):
# Overall coverage
make test-coverage-badge
# Per-package breakdown
go test -cover ./internal/... 2>&1 | grep -E "coverage:|ok"
# Find 0% coverage functions
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | grep "0.0%"
# Visual inspection
go tool cover -html=coverage.out
| Category | Action |
|---|---|
| Core logic uncovered | Write tests (high priority) |
| Error paths uncovered | Add error case tests |
| Dead code (never called) | Consider removal |
| Experimental code | Accept lower coverage |
## Coverage Report
### Summary
- Overall: 29.9%
- Core modules: 45%
- Target: 50%+ overall, 80%+ core
### Critical Gaps
1. internal/types/unify.go - row polymorphism (0%)
2. internal/eval/effects.go - effect handlers (15%)
### Dead Code Candidates
- internal/legacy/old_parser.go (0%, no references)
### Recommendations
1. Add unification tests for row types
2. Add effect handler integration tests
3. Remove legacy parser code
# View recent CI runs
gh run list --limit 10
# Check failed run
gh run view <run-id> --log-failed
# Watch run in progress
gh run watch <run-id>
Common CI failures:
User: "Check test coverage"
Response:
Running coverage analysis...
## Coverage Report
### Overall: 29.9%
### Per-Module Breakdown
internal/lexer: 85.2% (good)
internal/parser: 42.1% (needs work)
internal/types: 38.5% (needs work)
internal/eval: 25.3% (low)
internal/effects: 18.7% (low)
### Critical Gaps (0% coverage)
1. internal/types/row.go:UnifyRows() - row polymorphism
2. internal/eval/match.go:matchADT() - ADT pattern matching
3. internal/effects/budget.go - entire file
### Recommendations
1. Priority: Add tests for UnifyRows (critical for type system)
2. Add ADT matching tests
3. Review effects/budget.go - possibly dead code
Would you like me to generate test stubs for any of these?