Skip to content

tests: build a real unit-test net for the deterministic cores (CODE_HEALTH #1) #38

Description

@duanyiqun

CODE_HEALTH #1 (see docs/CODE_HEALTH.md in #37 for full context).

tests/ contains only test_smoke.py — 3 assertions against ~40K lines of source. Every package (query/, agent/, service/, graph/, executor/, retrieval/, scoring/, …) has zero tests. pytest + pytest-asyncio + CI wiring already exist; only the tests are missing.

Why now: every other refactor in CODE_HEALTH is unsafe without a regression net, and regressions currently surface only in expensive benchmark runs.

Scope — unit tests for the LLM-free deterministic cores first:

  • graph/store.py (add/get/edges/persistence round-trip)
  • executor/runner.py (plan validation, atomic execute, rollback, orphan reconnection)
  • scoring/ranker.py (PageRank + recency weighting)
  • retrieval/bm25.py (indexing, scoring, determinism)
  • query/text_utils.py (tokenize/stopwords)
  • config.py (env parsing, YAML load)

Rule going forward (now in CLAUDE.md): refactors land with tests for the code they touch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions