You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes a latent bug where a whitespace-only or whitespace-padded OPENAI_API_KEY would be passed to the OpenAI client instead of being rejected early, and improves error surfacing when the embedding call inside _rank() fails. It also aligns SERVER_VERSION in constants.py (which was one patch behind at 0.8.4) with the bumped package version 0.8.6.
_default_embedder() now strips all whitespace from the key via "".join(api_key.split()) and then re-checks for an empty string, correctly handling keys that are purely whitespace.
DocsSearch.search() wraps self._rank() in a try/except, records telemetry with outcome="error", and re-raises as a descriptive RuntimeError chained to the original exception so the full traceback is preserved.
Version is bumped to 0.8.6 across pyproject.toml, server.json, constants.py, and uv.lock.
Confidence Score: 5/5
Safe to merge — the changes are small, targeted, and correct.
Both code changes in docs_search.py are well-guarded: the double-check pattern for api_key correctly handles None, "", and whitespace-only strings, and the try/except in search() preserves the original exception via chaining while adding useful diagnostics. All four version fields are now consistent at 0.8.6.
No files require special attention.
Important Files Changed
Filename
Overview
src/mcp_server_appwrite/docs_search.py
Adds whitespace sanitization for OPENAI_API_KEY and wraps _rank() in a try/except to surface embedding failures with clearer diagnostics and error telemetry.
src/mcp_server_appwrite/constants.py
SERVER_VERSION bumped from 0.8.4 to 0.8.6 to match the package version (it was already one patch behind).
pyproject.toml
Version bumped from 0.8.5 to 0.8.6.
server.json
Version bumped from 0.8.5 to 0.8.6 in both the top-level field and the packages entry.
uv.lock
Lockfile updated to reflect the 0.8.6 version bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OPENAI_API_KEYbefore creating the OpenAI docs-search embedder0.8.6Testing
uv run python -m unittest tests.unit.test_docs_search -vuv run python -m unittest tests.unit.test_operator -vuv run --group dev ruff check src testsuv run --group dev black --check src testsuv run --group dev pyright