Repository navigation
Description
Problem
Item 2 of the Fit note of #1329. The tests of src/devops_cli/ai/rag/ still double devops-cli code instead of edges. The count in the tree at a0f9557 (measured with an AST pass over tests/ai/rag/, tests/ai/test_rag_chunker.py and tests/ai/agents/test_embedding_config_retention.py):
- 128 patch sites. Most patch a devops-cli name (
SemanticRetriever,QdrantClient,EmbeddingsEngine,get_qdrant_api_key,kube_configuration,load_settings,_embed_search_query) or the tracer. - 21 imports of a private name from devops_cli, 9 of them in
test_rag_embeddings.py. - 10 hand-rolled doubles:
FakeQdrantClient,RecordingQdrant,StubFailingSecondBatchEmbedder,FakeEmbedder,StubEmbedder,StubQdrant,DummyQdrant,RecordingQdrant,_MockValkey. The shared fakes intests/support/fakes/(Qdrant, embedder, Valkey, web, clock, OTLP, keyring, Kubernetes) now exist. - Files named after a source module or after the work that produced them, and one catch-all (
test_rag_error_branches). - No Hypothesis test for the chunkers in
ai/rag/chunker.py.
Already done by earlier items (RAG wiring in #3850, the seams): resolve_rag_components, test_rag_qdrant.py contract suite, test_rag_components.py.
Expected
The ai/rag tests double only edges, through the shared fakes. Each behavior has one file in tests/ai/rag/, named after the behavior. The hand-rolled doubles are gone. The chunkers have Hypothesis property tests.
Acceptance criteria
- No migrated test patches a devops_cli name or imports a private one.
- The hand-rolled Qdrant, Valkey and embedder doubles in these files are deleted. The tests use
qdrant,embedder,valkey,web,clock,otlp,keyring_storeandcluster. - One file for each behavior. The catch-all
test_rag_error_branchesis split.test_rag_cli.pykeeps only CLI cases. - Hypothesis tests for
chunker.pycheck: chunks cover the input, no chunk is over the size limit, the overlap is respected. They use a smallmax_examplesand no timing. - The Qdrant contract suite (
test_rag_qdrant.py) stays intact. - A scratch mutation of the product code makes the migrated tests fail (recorded in the change folder).
- Every document and spec that the change makes wrong is fixed.
-
uv run devops cipasses.
Not in this item: the ai/library and command tests (item 3 of #1329) and the docs ingester (item 4).
Existing tool considered
Hypothesis (a dev dependency already) for the chunker properties. The shared fakes of #1317, #1314, #1318, #1319 and #1320 for the edges. No new tool.
Activity
dan-petty commentedon Nov 6, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
testprefix of the title gives the type.(ai)scope of the title gives the scope.It is a planned test refactor within a larger effort, not a defect or security fix.It removes brittle test doubles and adds property tests, improving long-term maintainability of the ai/rag suite.Migrating 128 patch sites, deleting ten hand-rolled doubles, splitting files, and adding Hypothesis tests is bounded but multi-file work.Both share the goal of making tests double only process edges through shared fakes, but #1307 is the umbrella for all packages while the candidate is one child scoped to ai/rag.test(ai): wire rag once in ai/rag, test with edge fakes (#4245)