Skip to content

fix(context): honor retrieval.backend config instead of hardcoding embeddings#102

Merged
plind-junior merged 1 commit into
vouchdev:testfrom
dripsmvcp:fix/92-retrieval-backend-config
May 27, 2026
Merged

fix(context): honor retrieval.backend config instead of hardcoding embeddings#102
plind-junior merged 1 commit into
vouchdev:testfrom
dripsmvcp:fix/92-retrieval-backend-config

Conversation

@dripsmvcp

@dripsmvcp dripsmvcp commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Root Cause

src/vouch/context.py:32 called index_db.search_semantic (embedding) unconditionally before FTS5/substring, ignoring config entirely. Meanwhile vouch init wrote retrieval.backends: ["fts5", "substring"] — a list that didn't even contain "embedding" and was never read. So the config knob was decorative and the README/ROADMAP claim ("Default stays FTS5; embeddings opt-in") was wrong.

Fix

  • New _configured_backend(store) reads retrieval.backend (auto|embedding|fts5|substring, default auto), with back-compat for a legacy retrieval.backends list (first recognized entry wins).
  • _retrieve dispatches: auto = embedding → FTS5 → substring (degrades to FTS5 when embeddings extras aren't installed); embedding/fts5/substring pin a single path. Mirrors kb_search backend semantics; preserves the existing sqlite3.Error fallback.
  • _starter_config now writes retrieval.backend: auto.
  • Docs: ROADMAP marks embeddings shipped + describes the knob; README Retrieval row rewritten and the stale "vector embeddings (BM25/FTS5 only)" line removed.

Test Plan

  • Regression test added: tests/test_retrieval_backend.py (5 tests, env-independent — monkeypatches search_semantic so no numpy/sentence-transformers needed)
  • test_backend_fts5_skips_embedding and test_backend_substring_only fail on the parent commit, pass with the fix
  • ruff + mypy clean; full suite green except one pre-existing failure (test_crystallize_cli_partial_failures_shows_warning) that also fails on clean upstream/test (environment-sensitive _whoami())
$ python -m pytest tests/test_retrieval_backend.py -q
.....                                                  [100%]
$ python -m ruff check src tests
All checks passed!
$ python -m mypy src
Success: no issues found in 31 source files

Closes #92

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9f92d2e-8591-4b1b-821f-0d3102832cbd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@plind-junior plind-junior merged commit e8dd575 into vouchdev:test May 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants