Skip to content

[task] Add ingestor persistence contract tests #17

@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 Ingestor.ingest() in src/anchor/ingestor.py.

This method is the write path into memory. It is responsible for:

  • optionally generating retrieval questions
  • constructing the embedding input
  • generating a chunk id
  • writing the record into the configured memory store with metadata

Suggested starting points

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

Suggested file locations

  • tests/unit/test_ingestor.py

Out of scope

  • Do not add tests against a real Chroma backend.
  • Do not expand ingest functionality in this issue.
  • Do not add end-to-end retrieval assertions here.

Definition of done

  • Add tests for ingest with and without question_fn.
  • Verify missing embed_fn raises RuntimeError.
  • Verify embedding input is just the raw text when no questions are generated.
  • Verify embedding input includes generated questions when question_fn is present.
  • Verify memory_store.add() receives:
    • id
    • text
    • embedding
    • metadata
  • Verify metadata includes:
    • source
    • questions
    • a UTC timestamp
  • Keep the tests deterministic and offline.

Metadata

Metadata

Assignees

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