Repository navigation
[FIX] Fail indexing when the existence check fails - #2391
Open
xubenqiang wants to merge 3 commits into
Open
xubenqiang wants to merge 3 commits into
xubenqiang wants to merge 3 commits into
Conversation
is_document_indexed swallowed every error from the "already indexed?" query and returned False, so a failed check indexed a second copy of the document next to the first one and the run reported success. Treat only a 404 as "nothing indexed yet" - llama-index creates the Qdrant collection on the first write - and re-raise anything else. Applies to both copies of the check: the legacy executor and sdk1's Index. Fixes Zipstack#2348
Contributor
|
Thank you for your contribution! Before we can merge it, every committer needs to sign our Contributor License Agreement. To sign, read the CLA and then post a comment on this pull request with exactly this text: Still to sign: Already signed? Comment |
for more information, see https://pre-commit.ci
pre-commit's ruff run enables flake8-annotations for tests too; add the return and argument annotations.
|
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
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.


Problem
is_document_indexed(workers/executor/executors/index.py:125) caught every exception from the "already indexed?" query, logged "proceeding to index" and returnedFalse. A failed check therefore indexed a second full copy of the document next to the first one — and, becausereindex=Falsenever deletes, the run still reported success. sdk1'sIndex.index(unstract/sdk1/src/unstract/sdk1/index.py:313) had the same handler.A query failure is not an answer to "is this indexed?":
query_indexraisesVectorDBErrorfor the same query.Change
is_vector_store_not_found()inunstract/sdk1/src/unstract/sdk1/exceptions.pywalks an exception (and its__cause__/__context__chain) looking for an HTTP 404, checkingstatus_code, thenresponse.status_code.The log line is now
No index yet for <instance>: <error>, proceeding to indexat INFO for the 404 case, since that is the expected first-index path.Known gap, matching the report: a 404 for some other reason (e.g. the bundled-server mismatch in #2014) still proceeds to index. Closing that needs adapter-specific code (
collection_exists), which seemed a separate call.Tests
unstract/sdk1/tests/test_vector_store_not_found.pycovers the classification:status_code=404,response.status_code=404, a 404 wrapped as__cause__, a 500, a timeout, a plainValueError, and a cyclic cause chain (must terminate, must not count as missing).Red check with the helper forced to the previous swallow-everything behaviour:
Honest scope note: these tests exercise the classifier, and the two call sites are one-line guards around it. I did not reproduce the duplicate-write scenario end to end (real Qdrant + injected timeout) in this environment; the worker test suite was not run because its dependency set is not installed here.
ruff checkandruff format --checkpass on the changed files.Fixes #2348