md-first memory extraction framework for AI agents. Markdown is the single source of truth; SQLite holds state and LanceDB provides the rebuildable vector + BM25 + scalar index. The codebase follows a single-direction DDD layering (entrypoints -> service -> memory -> infra, with component / core / config cross-cutting) enforced by import-linter. Engineering surface: - Coding conventions in .claude/rules/ (path-scoped) and workflows in .claude/skills/ (/commit, /new-branch, /pr). - GitHub Actions CI runs make lint + test + integration; pre-commit mirrors the gates locally (ruff, hygiene hooks, gitlint commit-msg). - Commit messages follow Conventional Commits, enforced by gitlint. - make lint also enforces datetime two-zone discipline and OpenAPI drift.
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
"""Unit tests for ``memory.search.adapter.resolve_pipeline``."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from everos.memory.search.adapter import resolve_pipeline
|
|
from everos.memory.search.dto import SearchMethod
|
|
|
|
|
|
def test_keyword_skips_everalgo() -> None:
|
|
fm, cfg = resolve_pipeline(SearchMethod.KEYWORD, "episode")
|
|
assert fm is None
|
|
assert cfg is None
|
|
|
|
|
|
def test_vector_skips_everalgo() -> None:
|
|
fm, cfg = resolve_pipeline(SearchMethod.VECTOR, "episode")
|
|
assert fm is None
|
|
assert cfg is None
|
|
|
|
|
|
def test_hybrid_episode_picks_hierarchy() -> None:
|
|
fm, cfg = resolve_pipeline(SearchMethod.HYBRID, "episode")
|
|
assert fm == "hierarchy"
|
|
assert cfg is None
|
|
|
|
|
|
def test_hybrid_atomic_fact_picks_hierarchy() -> None:
|
|
fm, _cfg = resolve_pipeline(SearchMethod.HYBRID, "atomic_fact")
|
|
assert fm == "hierarchy"
|
|
|
|
|
|
def test_hybrid_case_picks_vector_anchored() -> None:
|
|
fm, cfg = resolve_pipeline(SearchMethod.HYBRID, "agent_case")
|
|
assert fm == "vector_anchored"
|
|
assert cfg is None
|
|
|
|
|
|
def test_hybrid_skill_picks_skill_hybrid() -> None:
|
|
fm, _cfg = resolve_pipeline(SearchMethod.HYBRID, "agent_skill")
|
|
assert fm == "skill_hybrid"
|
|
|
|
|
|
def test_agentic_method_raises_value_error() -> None:
|
|
"""AGENTIC (a valid enum member) raises ValueError from resolve_pipeline.
|
|
|
|
Distinct from ``test_unsupported_method_raises`` which passes an arbitrary
|
|
non-enum string. This test verifies the manager's contract: AGENTIC must be
|
|
intercepted before resolve_pipeline is called, and resolve_pipeline defends
|
|
against it with a ValueError even for the known enum member.
|
|
"""
|
|
with pytest.raises(ValueError, match="unsupported method"):
|
|
resolve_pipeline(SearchMethod.AGENTIC, "episode")
|
|
|
|
|
|
def test_unsupported_method_raises() -> None:
|
|
with pytest.raises(ValueError, match="unsupported method"):
|
|
resolve_pipeline("not-a-method", "episode") # type: ignore[arg-type]
|