auto-triage: validate genome_fasta content at schema level#1
Draft
jplfaria wants to merge 3 commits into
Draft
Conversation
genome_fasta had no content validation, so workspace paths or header-only strings would pass request parsing and only fail inside the Celery task with a confusing ValueError. Add a field_validator that checks for at least one >header + sequence pair and returns a 422 Unprocessable Entity at request time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary\n\nFixes #8 in ModelSEED/modelseed-api-ops.\n\n- Root cause: genome_fasta in ReconstructionRequest accepted any truthy string, so workspace paths or header-only FASTA passed request validation and failed inside the Celery task with ValueError: No sequences found in genome_fasta.\n- Fix: Added a field_validator that checks for at least one FASTA header + sequence pair. Invalid content now returns HTTP 422 at request time instead of causing a Celery task failure.\n- Tests: Added unit tests (tests/unit/test_reconstruction_schema.py) and route-level tests (tests/routes/test_job_routes.py) confirming 422 responses for invalid inputs.\n\n## Test plan\n- pytest tests/unit/test_reconstruction_schema.py -v\n- pytest tests/routes/test_job_routes.py::TestReconstructJob -v\n- Confirm existing FASTA tests still pass (valid DNA and protein FASTA accepted)\n\nGenerated with Claude Code (https://claude.com/claude-code)