Handle grobid connection failures#43
Merged
lfoppiano merged 9 commits intoJun 7, 2026
Merged
Conversation
d8131bf to
7f65f7c
Compare
Finalizes PR #35 (issue #11). Resolves the outstanding Copilot and reviewer remarks and adds handling for Grobid responses that are empty or truncated (HTTP 200 with no usable body), which were previously undetected. grobid_processors.process_structure (single validation chokepoint): - Catch only requests.exceptions.RequestException instead of bare Exception, so local/usage errors (bad path, parser bugs) keep their real traceback instead of being mislabelled "Grobid did not respond". - Raise GrobidServiceError for empty body, malformed/truncated XML, and well-formed XML with no extractable text. document_qa_engine: - ping_grobid_server now defaults to True (fail-fast for library users); Streamlit passes ping_grobid_server=False to degrade gracefully. - Remove the now-dead "if not structure" guard. - Fix return-type hints (query_document now consistently returns a 3-tuple; query_storage -> tuple[List[str], list]; _run_query -> tuple[Any, list]); drop unused Tuple import; fix verbose hash print. streamlit_app: - Drop the `hash` alias that shadowed the builtin. - Clean the error message (no duplicated status, correct punctuation). tests: - Use requests exceptions; assert local errors are not masked; add empty / malformed / no-extractable-text cases. 19 passed.
7f65f7c to
abcd1f4
Compare
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.
Revised #35 from @Sanakhamassi