Skip to content

test(knowledge/backends): ChromaDB contract coverage is stubbed out — decide how to restore it (follow-up to #13239) #13242

Description

@mrveiss

Context

#13239 / PR #13241 established that the BaseClient / BaseCollection and AsyncBaseClient / AsyncBaseCollection contract suites have not exercised ChromaDB since 2026-05-26.

autobot-backend/conftest.py (lines 119-131) unconditionally installs a MagicMock package stub for chromadb into sys.modules, added by 436607992 "fix(startup): chromadb hang + missing imports regression (MVA-1119)" because the real import hangs on hosts without a local Chroma server (gRPC keep-alive probes via opentelemetry) and because an opentelemetry version in some venvs raises ImportError.

Because the stub lands in sys.modules before collection, pytest.importorskip("chromadb") never skipped — so every chromadb-parametrized contract assertion ran against a MagicMock and failed (38 failures). PR #13241 makes those cases skip honestly. The in-memory parametrization still enforces the full contract on every run.

What is now uncovered

knowledge/backends/chromadb_adapter.py and knowledge/backends/async_chromadb_adapter.py are thin pass-through wrappers, so their contract behaviour is ChromaDB's behaviour and cannot be meaningfully verified without the real package. Currently unverified in CI:

Decision needed (owner)

Options, roughly in increasing blast radius:

  1. Leave as-is — accept in-memory-only contract coverage, keep the skips.
  2. Add narrow unit tests for the adapters' own logic (kwarg marshalling + exception translation) against an explicit hand-written fake, keeping the stub untouched. No hang risk, recovers most of the lost signal, does not verify real ChromaDB semantics.
  3. Make the global chromadb stub conditional (try the real import first, as _SIMPLE_STUBS already does) so contract tests run against real ChromaDB where importable. Recovers full signal but risks reintroducing the MVA-1119 import hang across the whole backend suite.
  4. Dedicated opt-in job — a separate CI lane with the stub disabled that runs only knowledge/backends/test_base.py and test_async_base.py against real ChromaDB, with a timeout. Isolates the hang risk from the main suite at the cost of a new lane.

Option 3 in particular is a suite-wide change and should not be made without an owner call.

References

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions