Repository navigation
Description
Summary
"coverage" is an unconditional entry in graphify/detect.py::_SKIP_DIRS, and _is_noise_dir matches directory names at any depth. In a Python repo where coverage is a legitimate package name, this silently drops real source from the graph — no warning, no entry in skipped_sensitive, nothing in the report.
In our repo (~2,700 tracked code files) it removed an entire 5-module production package (auditor_toolkit/assurance/coverage/, ~51 KB) that the rest of the codebase imports from. The graph looked complete: the package's dependents are present, so queries return plausible neighbours while the package itself simply doesn't exist as nodes. We only found it by diffing git ls-files against the distinct source_file values in graph.json.
Repro
from pathlib import Path
from graphify.extract import collect_files
collect_files(Path("auditor_toolkit/assurance/coverage")) # -> []The directory holds __init__.py, impact.py, inventory.py, mapping.py, summary.py. Nothing is gitignored (git check-ignore reports none of them), and .graphifyignore doesn't mention them.
Why this is the same bug class you've already fixed twice
The comment on the entry is # Vitest/Istanbul/nyc HTML reports (#870) — a JS-ecosystem artefact directory. But the pruning is unconditional and language-agnostic, so it also removes Python/Go/Rust packages that happen to be called coverage.
This is exactly the shape of two fixes already in detect.py:
- Ruby: stable subset of files yields zero nodes in full-repo runs (0.9.6) — each extracts fine in isolation #1666 — a bare
snapshotsdir is a Jest artefact only when it actually holds snapshot files or sits under a JS test root; elsewhere it's a real code namespace, so pruning by name "silently dropped legitimate source from the graph". - Silent data loss: env/*_env directories pruned as false-positive venvs, with zero trace in any report bucket #2058 —
env/.env/*_envis pruned only on real virtualenv evidence (pyvenv.cfg,bin/activate,lib/python*,conda-meta/), because otherwise it "silently drops legitimate source with no trace".
coverage hasn't been given the same treatment. The existing _has_venv_markers / _JS_SNAPSHOT_TEST_ROOTS gating helpers are the precedent.
Suggested fix
Gate coverage (and probably lcov-report) on actual coverage-artefact evidence rather than the name alone. A generated coverage-report dir is easy to positively identify — e.g. any of index.html + base.css/prettify.js (Istanbul), lcov.info, coverage-final.json, clover.xml, coverage.xml — whereas a source package contains __init__.py / *.py / *.go / mod.rs and no report artefacts.
A cheaper variant that would also have caught this: treat a directory containing an __init__.py (or any recognised source-manifest file) as source regardless of name.
Workaround note for other users
There is currently no include-override: .graphifyignore can only ever exclude more, and .graphifyinclude was removed in #2112. So a repo hitting this has to rename the package or patch _SKIP_DIRS — neither is great when the name is part of a public API.
Lower-priority observation from the same audit
While diffing coverage we also hit a divergence worth flagging separately: _parse_gitignore_line strips inline # comments, but git does not — git only treats # as a comment at line start, so *_backup_*.py # temp scripts is a literal pattern matching nothing for git, while graphify parses it as *_backup_*.py and excludes real files. Not necessarily wrong (the stricter reading is arguably more useful), but it means graphify's corpus can be a strict subset of what git tracks in a way that's invisible unless you go looking. Happy to open that as its own issue if useful.
Environment: graphifyy via pipx, Python 3.12, Linux. Repo is ~2,700 code files + ~2,100 docs, graph ~60k nodes / 125k edges.
Activity
Rishet11 commentedon Jul 31, 2026
Reproduced, and the root cause is the unconditional skip-list rather than the walk.
"coverage"and"lcov-report"sit in_SKIP_DIRS(graphify/detect.py:798), and_is_noise_dir(detect.py:851-853) returnsTrueon a bare name match at any depth with no evidence check. So a real Python package namedcoverage/is pruned before anything looks inside it:Same class as #1666/#2058, which is also where the fix pattern already lives:
env/.env/*_envandsnapshotswere moved out of the unconditional set and are pruned only on real evidence (_has_venv_markersatdetect.py:828, the*.snap/_JS_SNAPSHOT_TEST_ROOTSgate atdetect.py:861-873).coverage/lcov-reportnever got that treatment.Two things I want to flag beyond the report:
visual-tests/visual-test(detect.py:799) anddist-protected(detect.py:802) are pruned the same unconditional way and are plausible real directory names. I will look at whether they belong in the same gate rather than fixing onlycoverage.tests/test_detect.py:675(test_detect_skips_coverage_dir) plantsindex.htmlundercoverage/lcov-report/, so evidence-based gating keeps that test green — it is not locking the current behavior.Planning to gate on real coverage-report markers (
lcov.info,coverage-final.json,clover.xml,coverage.xml,index.html+base.css/prettify.js) and keep the directory when none are present. Claiming this one; will open a PR againstv8.fix(detect): gate coverage/ pruning on report artefacts (#2339)
chore: bump to 0.9.32; changelog for #2333/#2334/#2336/#2342/#2326/#2323
safishamsi commentedon Aug 1, 2026
Fixed in v0.9.32. The
coverage/prune is now gated on coverage-report artefacts, so a real Python package namedcoverage/is kept. Thanks for flagging it.fix(detect): gate coverage/ pruning on report artefacts (Graphify-Lab…
chore: bump to 0.9.32; changelog for Graphify-Labs#2333/Graphify-Labs…