Skip to content

[task] Add retriever deterministic tests #16

@AlexanderGardiner

Description

@AlexanderGardiner

Checks

  • I searched open and closed issues and pull requests and did not find a duplicate.

Area

Tests

Goal

Add deterministic contract tests for Retriever.retrieve() in src/anchor/retriever.py.

The retriever is a small adapter between the embedding function and the memory store, but it defines an important contract:

  • embed the incoming query string
  • pass the resulting embedding to the memory store
  • return the memory store results unchanged

Suggested starting points

  • src/anchor/retriever.py
  • src/anchor/memory.py
  • docs/roadmap.md
  • tests/unit/test_anchor_config.py

Suggested file locations

  • tests/unit/test_retriever.py

Out of scope

  • Do not add Chroma-specific tests in this issue.
  • Do not add end-to-end ingest/retrieve coverage here.
  • Do not introduce live embedding dependencies.

Definition of done

  • Add tests for the normal retrieval path using a fake embed_fn and fake memory_store.
  • Verify the raw query string is passed to embed_fn.
  • Verify the resulting embedding is passed to memory_store.query(..., top_k=...).
  • Verify returned chunks are surfaced unchanged.
  • Verify missing embed_fn raises RuntimeError.
  • Keep the tests deterministic and offline.

Metadata

Metadata

Labels

area: testsAutomated tests and test infrastructure.kind: maintenanceRepository maintenance or infrastructure work.status: in-progressClaimed by a contributor and actively being worked.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions