chore: dev to main merge#848
Open
Ragini-Microsoft wants to merge 6 commits into
Open
Conversation
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens /api/chat request validation so empty request bodies and missing/blank messages are rejected unless an explicit action is provided, and updates backend tests to reflect the new validation behavior.
Changes:
- Added early 400 responses in
handle_chatfor empty request data and blank message content. - Updated chat endpoint tests to expect validation failures for missing/empty messages.
- Added coverage for whitespace-only messages and action-based empty-message requests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/backend/app.py |
Adds request-body and message-content validation to /api/chat. |
src/tests/test_app.py |
Updates and adds tests for the new chat validation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Purpose
This pull request improves input validation for the
/api/chatendpoint, ensuring that requests with missing or empty message content are properly rejected with a 400 error unless an action is specified. It also updates and expands the test suite to verify these new validation rules.API validation improvements:
handle_chat(inapp.py) to return a 400 error if the request body is empty or if themessagefield is missing or contains only whitespace (unless anactionis specified).Testing updates:
test_app.pyto assert that the chat endpoint rejects empty or whitespace-only messages, as well as empty request bodies, with the appropriate 400 error response.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation