ir.coverage¶
Corpus-coverage diagnostic — what’s on disk vs. what’s actually indexed.
Retrieval can only return what was indexed, and an ingestion gap is silent:
a whole folder of reports can be missing from the index with no error (a
non-recursive glob once dropped every doc in a research/ / decisions/
subtree — 29% of the corpus — invisibly). Back-translation evals cannot catch
this: their gold is drawn from what is already indexed, so an un-indexed doc
can never lower a metric. Coverage therefore needs its own check.
reports_coverage() independently walks the reports doc-trees on disk
(the raw */*/docs and */*/misc/docs files, plus pocket repos and root-level
_name companions, before any filtering),
classifies each file with the same inclusion SSOT the ingestion walk uses
(ir.sources.report_exclude_reason()), and diffs the should-be-indexed
set against the built corpus’s ledger — surfacing exactly the on-disk-but-absent
reports that a search would silently miss. packages_coverage() does the same
for the packages corpus (repo directories on disk vs. repos in the index), so
“the registry has no such package” can be told apart from “the registry is stale”.
Functions
|
Diff the repo directories on disk against the built |
|
Diff the reports docs tree on disk against the built |
Classes
|
Disk-vs-index coverage for a filesystem-backed corpus. |
- class ir.coverage.CoverageReport(name, on_disk, indexed, excluded, missing=list(), ledgered_no_records=list())[source]¶
Bases:
objectDisk-vs-index coverage for a filesystem-backed corpus.
- ir.coverage.packages_coverage(name='packages', *, repo_dirs=None, indexed_paths=None, exclude=None)[source]¶
Diff the repo directories on disk against the built
namepackages corpus.repo_dirsdefaults to what a build would scan (ir.sources.package_repo_dirs(): the manifest, then every fleet repo), minus the excluded patterns (default: the localirexclude file).indexed_paths(each indexed repo’s directory) is read from the registered corpus by default. A repo listed inmissingis on disk but not searchable: adiscoverthat misses it is then a stale index (ir build <name>), not a ranking miss.- Return type:
- ir.coverage.reports_coverage(name='reports', *, projects_root=None, indexed_ids=None, exclude_dirs=frozenset({'.git', '.hg', '.ipynb_checkpoints', '.obsidian', '.svn', '.tox', '.venv', '__pycache__', 'build', 'dist', 'node_modules', 'site-packages', 'venv'}))[source]¶
Diff the reports docs tree on disk against the built
namecorpus.Walks every
*/*/docsand*/*/misc/docsfolder recursively (raw, no filtering), classifies each*.mdwith the shared inclusion SSOT, and reports how many includable reports are indexed vs. silently missing. Acoverage_ratiobelow 1.0 means on-disk reports are absent from the index — rebuild withir build <name>.indexed_ids(the built corpus’s artifact ids) is read from the registerednamecorpus by default; pass it explicitly (withprojects_root) to diff an arbitrary tree against an arbitrary index without opening a corpus.- Return type: