coverage-investigation
Skill120 starsChanged 16 days agoMITView on GitHub
Investigate and improve code coverage for the wado-compiler crate. Use for any question about what the tests do and do not reach, dead code included.
- Installs packages
In this repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmark/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- package-gale/AGENTS.mdAGENTS.md
- package-grog/AGENTS.mdAGENTS.md
- package-jade/AGENTS.mdAGENTS.md
- package-loam/AGENTS.mdAGENTS.md
- package-re/AGENTS.mdAGENTS.md
- package-wadopoet/AGENTS.mdAGENTS.md
- wado-cli/AGENTS.mdAGENTS.md
- wado-compiler/AGENTS.mdAGENTS.md
- wado-from-idl/AGENTS.mdAGENTS.md
- wado-host/AGENTS.mdAGENTS.md
- wado-lsp/AGENTS.mdAGENTS.md
- wado-manifest/AGENTS.mdAGENTS.md
- wado-run-pjrt/AGENTS.mdAGENTS.md
- wado-run-webgpu/AGENTS.mdAGENTS.md
- wado-vscode/AGENTS.mdAGENTS.md
- benchmarkSkill
- ci-timingSkill
- code-review-responseSkill
- crSkill
- debuggerSkill
- distillSkill
- git-upstream-syncSkill
- jcoSkill
- markdownSkill
- on-task-doneSkill
- optimizer-debugSkill
- profiling-wado-compilerSkill
- pull-requestSkill
- rust-renameSkill
- rustSkill
- vendor-submodulesSkill
- wado-cliSkill
- wado-performanceSkill
- wasm-optSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use cargo-llvm-cov to generate line-level coverage.
- Distinctive: line 75
Prefer adding test cases to existing fixture files when the feature group matches
- Very specific: line 77
After adding new files: touch wado-compiler/tests/e2e.rs to trigger rediscovery
- Very specific: line 88
After changes, run Step 1 again and compare jq '.data[0].totals.lines.percent' scratchpad/cov.json with the earlier total.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Coverage Investigation Methodology
Step 1: Collect Coverage Data
Use cargo-llvm-cov to generate line-level coverage. The tool must be installed via cargo install cargo-llvm-cov.
Each cargo llvm-cov that is not report runs the whole test suite again, so
run the tests once and read every report from that run:
cargo llvm-cov clean --workspace # a stale profile would merge into this run
cargo llvm-cov --no-report -p wado-compiler -p wado-compiler-tests
cargo llvm-cov report --html # target/llvm-cov/html/
cargo llvm-cov report --json --output-path scratchpad/cov.json
jq '.data[0].totals.lines' scratchpad/cov.json # overallStep 2: Identify Low-Coverage Files
Sort files by uncovered line count to find the biggest improvement opportunities:
jq -r '.data[0].files[] | "\(.summary.lines.count - .summary.lines.covered)\t\(.summary.lines.percent | round)%\t\(.filename)"' \
scratchpad/cov.json | sort -rn | head -30Focus on files with:
- High absolute uncovered lines (biggest bang for buck)
- Low percentage but meaningful code (not just error paths)
Step 3: Classify Coverage Gaps
For each low-coverage file, classify gaps into categories:
| Category | Action | Coverage Impact |
| Dead code | Delete it | Immediate improvement, no test needed |
| Untested language features | Add e2e test fixtures | Medium effort, high impact |
| Error handling paths | Add compile_error test fixtures | Low effort |
| Optimizer-specific paths | Add wir_expect/wir_not_expect tests | Medium effort |
| Edge cases in codegen | Add targeted e2e tests | Varies |
Step 4: Analyze a Specific File
To see exactly which lines are uncovered in a file:
# lcov from the same run
cargo llvm-cov report --lcov --output-path scratchpad/lcov.info
# Or read the HTML report from Step 1:
# target/llvm-cov/html/src/synthesis/inspect.rs.html etc.To find dead code (functions never called):
# Check if a function has any callers
rg 'function_name' wado-compiler/src/ --type rustStep 5: Add E2E Tests
E2E tests are .wado files in wado-compiler/tests/fixtures/. Each file has a __DATA__ section with JSON expectations.
Guidelines for test files:
- Name files based on language features, not compiler components (e.g.,
closure_nested.wadonotcodegen_closure.wado) - Prefer adding test cases to existing fixture files when the feature group matches
- Each fixture group shares a filename prefix (e.g.,
closure_*,global_*,match_*) - After adding new files:
touch wado-compiler/tests/e2e.rsto trigger rediscovery
Test patterns that maximize coverage:
test "..." { ... }with{"test": {}}— exercises codegen without needing stdoutcompile_errortests — exercise error reporting pathswir_expect:O2/wir_not_expect:O2— exercise optimizer paths- Template strings with
{expr:?}— exercise inspect/display synthesis
Step 6: Verify Improvement
After changes, run Step 1 again and compare
jq '.data[0].totals.lines.percent' scratchpad/cov.json with the earlier total.
Key Insights from Past Investigations
synthesis/inspect.rs(~1400 lines) has dead code for type variants that never appear in practice (e.g.,Nevertype inspect). Deleting dead code directly improves coverage.codegen.rsandemit.rsare the largest files but have relatively high coverage. Incremental improvements here require many targeted tests.- The compiler's test suite is driven by
datatest_miniwhich discovers.wadofixtures at compile time — new files needtouch wado-compiler/tests/e2e.rs. wado testruns test-world fixtures;wado runruns CLI-world fixtures. Choose the right world for your test.- Coverage runs all optimization levels by default in CI; locally only O0 and O2 run unless
WADO_FULL_TEST=1.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

