fix: register AppError handler, PDF validation, duplicate field crash, Pydantic V2, tests init, Dockerfile PYTHONPATH#318
Open
vidhip222 wants to merge 3 commits intofireform-core:mainfrom
Open
Conversation
…t, Ollama timeout
…, Pydantic V2, tests init, Dockerfile PYTHONPATH
Fix/ollama timeout extension union
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.
Closes #311, #295, #293, #251, #235, #182, #137, #129, #116, #118
Description:
This PR fixes several bugs that were causing incorrect behavior across the API, data layer, and Docker environment. The fixes address unhandled exceptions returning 500 errors, silent data corruption in the database, a crash in the LLM response handler, Pydantic V2 deprecation warnings, missing test infrastructure, and a broken Docker PYTHONPATH.
Why is this needed?
Multiple routes were returning generic 500 errors instead of meaningful JSON error responses. The database was silently storing corrupt records when PDF generation failed. The LLM field handler would crash on duplicate fields. The Docker container's PYTHONPATH excluded the api package entirely, breaking all imports in a deployed environment.
Key Changes:
Type of Change
Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Stale template / missing PDF: Send a POST to /forms/fill with a valid template_id pointing to a deleted PDF file. Expect 404 JSON response and no new FormSubmission record in the database.
Duplicate field crash: Process a transcript where the LLM returns a value for the same field more than once. No crash, values are collected into a list.
Pydantic warnings: Start the API server and confirm no PydanticDeprecatedSince20 warnings appear in the logs.
Tests: Run pytest tests/ from the project root. Tests are discovered and run without import errors.
Docker: Build and run the Docker container. Api.* imports resolve and the server starts correctly.
Checklist