The project uses pytest for unit, regression, API, and integration-style tests.
External systems (Ollama, ChromaDB services, LLM providers, and network calls) are mocked unless a test explicitly creates an isolated local ChromaDB collection in tmp_path.
pip install -r requirements-dev.txt# Full test suite
python -m pytest -q
# Focus a module while iterating
python -m pytest -q tests/test_multivault_api_regression.py
# Statement + branch coverage for the package
python -m pytest -q \
--cov=bdh_graph_harness \
--cov-branch \
--cov-report=term-missing--cov-branch is intentional: a line-only percentage misses error handling, fallback paths, vault selection failures, and concurrent-update guards — exactly the code that tends to hurt later.
The current develop baseline is 214 passing tests and 50% package branch coverage. The mobile/provenance branch is verified with 222 passing tests. These are honest baselines, not badges with lipstick on them.
Modules at 100% branch coverage:
memory/state_store.py— corrupt-state recovery, atomic writes, cleanup, concurrent mergememory/consolidation.py— downscaling, pruning, dry-run and phantom-link pathsmemory/quality.py— dormancy and reactivation branchesretrieval/bm25.py— empty queries, normalization, no-results behaviortests/test_mobile_visualization.py— compact layout and touch-first interaction contractstests/test_neurogenesis.py— provenance placement and sanitized frontmatter fieldstests/test_graph_quality_audit.py— structural/Hebbian invariant audittests/test_visualization_3d_contract.py— 3D renderer contracts
The remaining work is concentrated in infrastructure boundaries: REST/WebSocket routes, CLI/MCP dispatch, graph/cache rebuilds, ChromaDB/embedding failure modes, and provider clients.
Every bug fix gets a regression test that fails for the original behavior and asserts the repaired behavior. In particular, changes to multi-vault code must prove all of the following:
- a request resolves only its selected
vault_id; - embedding operations use that vault's
chroma_pathand collection name; - state writes and neurogenesis use that vault's filesystem path;
- an unknown vault returns a useful error rather than silently falling back;
- legacy single-vault configuration remains compatible.
Do not exclude application modules with omit or # pragma: no cover merely to improve a number. If a path is genuinely impossible to exercise in-process, document why and test the surrounding contract instead.