Skip to content
This repository was archived by the owner on Jul 31, 2026. It is now read-only.

fix: practice mode hp stacking glitch - #68

Merged
weebao merged 3 commits into
mainfrom
practice-fix
Apr 30, 2025
Merged

fix: practice mode hp stacking glitch#68
weebao merged 3 commits into
mainfrom
practice-fix

Conversation

@weebao

@weebao weebao commented Apr 30, 2025

Copy link
Copy Markdown
Member

fixes #67

Refactor notes:

  • Previous structure:
    Untitled
  • New structure:
    Untitled-1

Copilot AI review requested due to automatic review settings April 30, 2025 04:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}})

Comment thread app/tests/integration/functions.py Outdated
@weebao
weebao merged commit ef77e3a into main Apr 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spam submitting deal damage continuously to bot

2 participants