Skip to content

test: raise coverage gate to 97% and cover remaining branches - #21

Merged
man4ish merged 1 commit into
mainfrom
test/coverage-97
Sep 25, 2026
Merged

man4ish merged 1 commit into
mainfrom
test/coverage-97

Conversation

@man4ish

@man4ish man4ish commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Coverage goes from 93.1% to 99.87%. fail_under in .coveragerc goes from 95 to 97.
  • Adds patch = subprocess to .coveragerc. The index/derive.py tests run in a separate process so they can use real FAISS, because other tests replace faiss with a mock. Coverage wasn't measuring that process, so derive.py showed 0%.
  • New tests:
    • index/lifecycle.py: validation failures for old-format indexes, missing files, an index that won't load, wrong vector size, and sources recorded only as absolute paths.
    • ingestion/trusted.py: title and document-type selection, which directories and files are skipped, unreadable/empty/missing sources, invalid visibility falling back to REVIEW_REQUIRED, and build_manifest.
    • rag/engine.py: the on_attempt retry callback in ollama_embed, on success and on failure.
    • index/derive.py: one test per safety check (existing output, leftover .partial directory, source that won't load, invalid visibility that got past validation, and derived output that fails validation or has altered vectors or metadata). Each failure test also checks that nothing is left on disk.

Test plan

  • pytest --cov: 475 passed, 99.87% coverage, above the 97% minimum.
  • CI passes. patch = subprocess needs coverage 7.10 or newer, which pytest-cov 7.0.0 should pull in.

🤖 Generated with Claude Code

- Measure subprocess coverage (patch = subprocess) so the real-FAISS
  derive tests count toward index/derive.py
- Add tests for lifecycle legacy/validation failures, trusted ingestion
  title/type/skip/failure paths and build_manifest, ollama_embed
  on_attempt reporting, and derive's defensive failure paths
- Raise fail_under from 95 to 97 (now 99.87%)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@man4ish
man4ish merged commit 21cb411 into main Sep 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant