fix(ui): accept top-level query requests#265
Open
Gujiassh wants to merge 1 commit into
Open
Conversation
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
Fixes Web UI query handling for clients that send the query text at the top level of the request payload.
UserRequestpreviously accepted only the nested form:{"type": "query", "content": {"query": "..."}}Some clients, including
demo/dummy_client.py, send:{"type": "query", "query": "..."}That shape parsed with
content=None, which later causedAttributeError: 'NoneType' object has no attribute 'query'in the WebSocket query worker. This change normalizes that legacy/top-level query form intocontentduring request validation while keeping the existing nested form unchanged.Fixes #223.
Validation
UV_PYTHON=/usr/bin/python3.12 uv run pytest tests/ui/test_user_request.py -qUV_PYTHON=/usr/bin/python3.12 uv run ruff check utu/ui/common.py tests/ui/test_user_request.pyUV_PYTHON=/usr/bin/python3.12 uv run ruff format --check utu/ui/common.py tests/ui/test_user_request.pygit diff --checkAdditional note:
UV_PYTHON=/usr/bin/python3.12 uv run pytest tests/ui/test_user_request.py tests/utils/test_print_utils.py -qpasses the new UI request tests, but the existingtests/utils/test_print_utils.pycases fail in this non-interactive shell becauseprompt_toolkitraisesEOFErrorwhen stdin is not a TTY.