Skip to content

Implement backend cheat validation#155

Merged
Zheaver merged 11 commits into
developmentfrom
feature/cheat-validation
Jun 17, 2026
Merged

Implement backend cheat validation#155
Zheaver merged 11 commits into
developmentfrom
feature/cheat-validation

Conversation

@Zheaver

@Zheaver Zheaver commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Overview

Implemented the backend logic for the cheat functionality.

Features

  • Added cheat validation in GameManager
  • Added CheatCardMessage and CheatResult
  • Added useCheat() to GameService
  • Added /cheat websocket endpoint in GameSocketController
  • Added SYSTEM chat messages
  • Added persistence of cheat usage state
  • Added recovery support for cheat flags

Validation Rules

  • Only operatives can use the cheat
  • Cheat only works during the operative phase
  • Each team can use the cheat only once per match
  • At least one card must be selected
  • Invalid or already guessed cards are ignored
  • If at least one selected card belongs to the team, one correct card is returned
  • Otherwise a message indicating that none of the selected cards are correct is returned
  • The cheat result is sent only to the requesting player

Closes #123

@the-only-queen-anna the-only-queen-anna left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Grundsätzlich würde ich sagen, das passt so, ich hab dir ein paar Vorschläge noch kommentiert, eventuell findest du ja was davon sinnvoll. Besonders das Logik in den Service verschieben wäre glaub ich besser.

Comment thread src/main/java/com/codenames/codenames/backend/game/api/GameSocketController.java Outdated
Comment thread src/main/java/com/codenames/codenames/backend/game/domain/CheatResult.java Outdated

@the-only-queen-anna the-only-queen-anna left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Bitte die Sonar issues noch beheben + siehe Kommentare, aber meiner Meinung nach schon fast fertig, danke :)

@Zheaver Zheaver linked an issue Jun 15, 2026 that may be closed by this pull request
@the-only-queen-anna

Copy link
Copy Markdown
Collaborator

Ich glaube du musst noch die Migration adden für die beiden neuen Spalten, ich bekomme diesen Fehler beim Starten: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [blue_team_cheat_used] in table [game_state]

@the-only-queen-anna

Copy link
Copy Markdown
Collaborator

Bekomme jetzt noch diesen Fehler, keine Ahnung ob das noch ein lokales Problem ist oder ob du das auch bekommst: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Validate failed: Migrations have failed validation
Migration checksum mismatch for migration version 2
-> Applied to database : -1402517561
-> Resolved locally : 1146956092
Either revert the changes to the migration, or run repair to update the schema history.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE

@Zheaver Zheaver linked an issue Jun 16, 2026 that may be closed by this pull request
@sonarqubecloud

Copy link
Copy Markdown

@the-only-queen-anna the-only-queen-anna left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, funktioniert jetzt in Kombination mit der App alles. Am besten beides gleichzeitig mergen, damit dev wieder ingesamt miteinander funktioniert

@tasaje1 tasaje1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok

@Zheaver Zheaver merged commit 8a389ad into development Jun 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket Endpunkt: Schummelfunktion Schummelfunktion validieren

3 participants