This repository was archived by the owner on Jul 31, 2026. It is now read-only.
fix: practice mode hp stacking glitch - #68
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the practice mode HP stacking glitch and refactors the practice mode flow by updating test assertions, bot simulation behavior, and websocket endpoint logic. Key changes include:
- Adjusting assertion messages and timeouts in integration tests.
- Updating bot simulation logic and chat handling in the practice mode.
- Refactoring the websocket endpoint to improve error handling and game state updates.
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/tests/integration/practice_test.py | Updated test assertions and print statements for clarity. |
| app/tests/integration/functions.py | Adjusted timeout values and added logging for message handling. |
| app/services/practice/operator.py | Refactored game operator methods and bot difficulty actions. |
| app/services/practice/bot.py | Revised bot simulation, chat queue, and healing behavior. |
| app/api/endpoints/practice/websockets.py | Modified practice websocket logic for game state and submission handling. |
| DOCS.md | Updated practice mode documentation with additional endpoints. |
Files not reviewed (1)
- .env.example: Language not supported
Comments suppressed due to low confidence (2)
app/tests/integration/practice_test.py:82
- There is a mismatch between the asserted message type and the error message text. The assertion checks for 'game_state' but the error message expects 'problem'. Please align the expected type and error message for consistency.
assert msg.get("type") == "game_state", (f"Expected type 'problem', got {msg.get('type', 'None')}")
app/api/endpoints/practice/websockets.py:271
- Ensure that 'submission_result' is always defined before merging it with 'result'. If there is a risk that operator.process_submission may not return a valid dictionary, add a fallback or a check to avoid a runtime error.
await player.send_event({"type": "submission_result", "data": {**result, **submission_result}})
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes #67
Refactor notes: