Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the card-play flow to prevent invalid “play card” requests from breaking gameplay, by adding frontend drag/drop validation and backend request validation with clearer error responses.
Changes:
- Frontend: restrict drag/drop to valid hand cards and block requests missing required identifiers.
- Frontend: attempt UI recovery when the API call fails.
- Backend: return explicit
400JSON errors for missing/invalidplay_cardparams, plus add test coverage for missingdealt_card_id.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| copi.owasp.org/assets/js/app.js | Tightens Dragula drag/drop validation and adds client-side blocking/recovery around the play-card API call. |
| copi.owasp.org/lib/copi_web/controllers/api_controller.ex | Adds 400 Bad Request handling for missing/invalid play_card parameters. |
| copi.owasp.org/test/copi_web/controllers/api_controller_test.exs | Adds a controller test to ensure missing dealt_card_id returns 400 with an explicit error message. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
cw-owasp
previously approved these changes
Jun 26, 2026
Collaborator
Author
|
The dragging got broken. I needed to change the hook to resolve to the nearest draggable card container that has data-* attributes before validating the drag and sending the card request. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
cw-owasp
approved these changes
Jun 26, 2026
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.
Description
These changes fix the “players get kicked out / stuck after game start” issue by preventing bad card-play requests and handling them safely when they still happen.
Net effect: fewer broken turns, clearer errors, and players are much less likely to feel like their session vanished.
AI Tool Disclosure
Github CoPilorGPT-5.5The call: PUT /api/games/undefined/players/undefined/card
seems to indicate that something has gone wrong for the player, but what?
Affirmation