Repository navigation
Conversation
store_data_in_vector_db always returns a dict, with an "error" key on failure. embed_local_file used `if result:` and embed_file_upload used `if not result:`, which are always truthy / never-falsy for a dict — so both returned status:True / HTTP 200 even when embedding or insertion failed and nothing was persisted. The client marks the file as indexed while later queries return nothing: silent data loss. Inspect the result for an "error" key (or a falsy value) in both endpoints and raise HTTP 500 with the error detail. /embed already performs this check and is left unchanged. The success path is unchanged.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Make
POST /local/embedandPOST /embed-uploadsurface a storage failure (HTTP 500) instead of reporting success.Why
Fixes #305.
store_data_in_vector_dbalways returns a dict (with an"error"key on failure), butembed_local_fileusedif result:andembed_file_uploadusedif not result:— a failure dict is truthy / not-falsy, so both reportedstatus:True/ 200 while nothing was persisted.Change
Both endpoints now treat
not result or "error" in resultas a failure and raise HTTP 500 with the error detail:POST /embedalready performs this check and is unchanged. The success path is unchanged.Testing
tests/test_main.py:test_embed_local_file_storage_error_returns_500andtest_embed_file_upload_storage_error_returns_500(store returns an{"error": ...}dict → endpoint returns 500).tests/test_main.py: 12 passed.