ε.κ.0 α2 — query_library.py --verify-coverage — CLOSED outcome-VALIDATED

Why: ν.β E1 spike (2026-05-04) found 102 library books had 0 pgvector chunks — a silent coverage gap that existed for the entire ν.α suite. Adding --verify-coverage prevents future spike suites from running retrieval queries against an empty index.

How to apply: Before dispatching any retrieval-dependent spike suite, run ~/tools/inherit-spike-env/bin/python ~/off-github/library/projects/inherit/tier-2-pgvector-library-index/query_library.py --verify-coverage. Exit code 1 means bulk-ingest is incomplete; exit code 0 means coverage is within 5% threshold.

Key findings

  • TDD: RED 3/3 fail → GREEN 3/3 pass → REFACTOR 5/5 pass
  • Structural discovery: library/indexed/ uses subdirectory-per-book (slug dirs), not top-level files. Implementation counts os.path.isdir() entries, not file extensions.
  • pgvector book identification: source_paths for library books contain / (e.g. allemang-semantic-web-3e/allemang-semantic-web-3e-text.txt). T-files do not. Query: SELECT COUNT(DISTINCT split_part(source_path, '/', 1)) FROM library_chunks WHERE source_path LIKE '%/%'
  • Live result: 102 books / 10 indexed / 90.2% gap (exit 1). Wave-1 ingest partially complete; wave-2/3 pending.
  • Kill condition: NOT-MET. source_path column present; book slugs reliably distinguishable.

Commits

  • 4cdf8c0 — patched query_library.py (off-github)
  • f155da5 — T-file (off-github)

T-file path

~/off-github/library/projects/inherit/T-spike-eps-kappa-0-α2-query-library-verify-coverage-2026-05-04.md

Usage

# Pre-flight check before running spike suites with retrieval queries
~/tools/inherit-spike-env/bin/python \
  ~/off-github/library/projects/inherit/tier-2-pgvector-library-index/query_library.py \
  --verify-coverage
 
# Custom threshold
~/tools/inherit-spike-env/bin/python \
  ~/off-github/library/projects/inherit/tier-2-pgvector-library-index/query_library.py \
  --verify-coverage --threshold 10.0