Skip to content

Make semantic search tests independent of installed extras - #67

Closed
offbyonebit wants to merge 1 commit into
maintenance/rc1-local-follow-upfrom
fix-semantic-search-test
Closed

offbyonebit wants to merge 1 commit into
maintenance/rc1-local-follow-upfrom
fix-semantic-search-test

Conversation

@offbyonebit

Copy link
Copy Markdown
Owner

Summary

test_semantic_search_requires_optional_dependency only passed when fastembed was not installed. With the semantic extra present it tried to download the BAAI/bge-small-en-v1.5 model, so it failed offline (and any environment with the extra but no network) and could not pass in an all-extras run.

Split into two deterministic tests:

  • test_semantic_search_requires_optional_dependency hides fastembed itself (patches find_spec), so the "requires the semantic extra" error is checked in every environment.
  • test_semantic_search_indexes_and_ranks_with_embedder covers the full index and search flow with a fake embedder, like the neighbouring test, and asserts results are ranked by similarity. It skips if numpy is missing.

No product code changed.

Testing

  • Reproduced the original failure first (the model download blocked by the sandbox proxy).
  • Full suite in a fresh core-only environment (fastembed confirmed absent): 1129 passed, 1 skipped.
  • Full suite in an all-extras environment (fastembed present): 1129 passed, 1 skipped.
  • Mutation checks: making the fake embedder stop separating results fails the ranking test; removing the missing-dependency error fails the dependency test. Both changes were reverted afterwards.
  • ruff: clean.

Generated by Claude Code

test_semantic_search_requires_optional_dependency only passed when
fastembed was absent. With the semantic extra installed it tried to
download the BAAI embedding model, so it failed offline and depended on
the network.

Split it in two. The dependency test now hides fastembed itself, so the
missing-extra error is checked in every environment. The full-flow test
uses a deterministic fake embedder, like the neighbouring test, and
checks that results are ranked by similarity.
@offbyonebit

Copy link
Copy Markdown
Owner Author

Closing as superseded by merged PR #68 (48bc7e9), which is an ancestor of current main. Verified the original text patches against that merge and the four UI image blobs by Git blob SHA. The plugin annotation from #64 is present; its surrounding fallback also received a safer getattr check. No outstanding changes from these PRs remain.

@offbyonebit offbyonebit closed this Oct 9, 2026
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.

1 participant