accuracy(CUE): measure import graph accuracy and close gaps below 90%
Part of #237.
Starting estimate: 75-90% recall. This is an unmeasured guess.
Measure
Run codemap on real CUE repositories at pinned commits and compare it to ground truth.
- Suggested ground truth: cue tooling or a manual sample.
- Report: recall, precision, and whether the coverage status was honest for each file.
Likely gaps to check
cue.mod module paths, package selectors, same-package files.
Done when
- Repositories, commits, method and numbers are recorded here.
- Each miss has a root cause.
- Recall is at or above 90%, or the remaining gap is one codemap cannot close and its coverage status says so.
CUE import graph accuracy (#250)
Repo: hofstadter-io/hof @ 52feda8ce076ec6a3501811c72dde0ca599b798d (342 .cue, 13 cue.mod modules). First candidate cue-lang/cue was dropped: 283 .cue files, nearly all testdata, and 0 had imports. Only one repo measured.
Method: git clone --depth 1, static reading only (no scripts, builds or tests executed). Sample: 30 files per repo via shuf -n 30 with a fixed seed (a sample, not the whole repo). For each sampled file F, codemap --json --importers F (codemap 4.6.3) was compared to a ground-truth importer set. Because 9 s per call ruled out querying every file, the unit is incoming edges to the sampled file. Truth was built by a regex resolver I wrote (tools/truth.py in the local scratch dir) and the disagreements were reviewed by hand. Intra-project edges only. Recall = TP/(TP+FN), precision = TP/(TP+FP) over edges. Honesty = whether coverage_status for a sampled file with a miss was something other than complete. Auto-written .codemap/config.json only lists were checked and include the target language. CUE truth = import strings (blocks and single) resolved against in-repo cue.mod/module.cue paths, edge to every .cue file in the target package directory (matches how codemap reports package imports).
| repo | sampled | TP | FP | FN | recall | precision | files with a miss | miss under complete |
|---|---|---|---|---|---|---|---|---|
| hof | 30 | 99 | 0 | 37 | 0.73 | 1.00 | 11 | 11 |
Honesty: all 11 files with misses reported complete; the coverage note only says package evaluation and external modules are not edges.
Root cause (one, large effect): a file-level attribute before the package clause hides the whole preamble. 19 of 342 .cue files start with @experiment(aliasv2); for them codemap emits imports=[] (e.g. .veg/ci.cue, examples/env/hack/hack.cue) and the package is unseen, so edges into schemas/env/host.cue (15 lost), catalogs/env/bases/* (3 each), catalogs/env/packs/index.cue (4) disappear, and veg.cue -> .veg ("github.com/hofstadter-io/hof/.veg:veg") loses its dist/ci/commands targets. Code: scanner/cue.go cueHeader (~line 72), which breaks on the first non-identifier token, i.e. the @. Fix: small (skip leading attributes in the header scanner). 5.5 percent of files but about 27 percent of sampled-target edges because they are heavy importers.
Not measured: external-module imports (not edges by design), CUE tests with cue.mod/pkg vendoring.
Measured with codemap 4.6.3. Sampled numbers are samples, not a census.