Skip to content

bug: vouch search CLI applies a single backend label to all results and has stale docstring #52

Description

@Tet-9

Description

The search command in cli.py assigns a single backend variable
after deciding which code path ran, then prints that same label for
every result in the output:

try:
    hits = index_db.search(store.kb_dir, query, limit=limit)
    if not hits:
        hits = store.search_substring(query, limit=limit)
        backend = "substring"
    else:
        backend = "fts5"
except Exception:
    hits = store.search_substring(query, limit=limit)
    backend = "substring"
for kind, hid, snippet, score in hits:
    click.echo(f"[{kind}] {hid}  score={score:.3f}  ({backend})")

This is the same structural problem that was fixed in server.py via
the embedding refactor (PRs #38#44), but the CLI was never updated.
The backend label reflects control flow, not which backend produced
each individual hit.

Additionally, the command docstring still reads:

"""FTS5 search over claims, pages, and entities."""

This is stale — the search layer now supports embedding, FTS5,
substring, and hybrid backends. The docstring misleads users about
what the command actually does.

Steps to Reproduce

  1. Ensure state.db exists but is empty so FTS5 returns no hits
  2. Run vouch search <query> with a term that matches via substring
  3. Observe: all results are labelled (fts5) instead of (substring)

Actual Behavior

All results share one backend label regardless of which backend
produced them. The command docstring advertises FTS5-only behaviour.

Expected Behavior

Each result line should carry the backend tag of the backend that
actually produced it. The docstring should reflect the current
multi-backend search surface.

Environment

  • Python 3.11+
  • vouch pre-1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions