feat: NCS-82 add Swiss-system tournament module #55

Merged
lq64 merged 11 commits from feat/NCS-82 into main 2026-06-09 15:09:53 +02:00

11 Commits

Author SHA1 Message Date
LQ63 2d9ceca097 revert(account): restore original two-persist pattern for OfficialBotAccount token
Build & Test (NowChessSystems) TeamCity build finished
Reverts the Hibernate-related changes introduced during PR review:
- Remove nullable = false from OfficialBotAccount.token (caused PropertyValueException
  at first persist() since token is assigned after id is generated)
- Restore double persist() pattern: first persist() gets generated UUID, then token
  is generated using that id and entity is persisted again with dirty tracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 14:44:20 +02:00
LQ63 4d54122d24 fix(account): fix EntityExistsException in syncOfficialBots/createOfficialBotAccount
Build & Test (NowChessSystems) TeamCity build failed
Pre-assigning bot.id on a @GeneratedValue entity causes Hibernate 6 to treat
it as detached, throwing PersistentObjectException on persist(). Fix: persist
with null id (Hibernate assigns UUID immediately in-memory), then set token on
the now-managed entity — dirty tracking commits the token at transaction flush.
No second persist() call needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 14:21:27 +02:00
LQ63 4021a39912 fix(review): address PR review findings
Build & Test (NowChessSystems) TeamCity build failed
- Restore @RolesAllowed("Admin") on official bot creation (security regression)
- Pre-assign UUID before first persist in createOfficialBotAccount/syncOfficialBots
  to eliminate two-persist fragility (token-less entity on second-write failure)
- Add nullable = false to OfficialBotAccount.token column
- Replace JSON string interpolation in publishBotGameStart with objectMapper
- Replace specific hprof PID filename in .gitignore with *.hprof wildcard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 13:55:36 +02:00
LQ63 c9cf92266c fix(tournament): fix scalafix violations and apply scalafmt formatting
Build & Test (NowChessSystems) TeamCity build finished
- Replace null with Option in GameResultStreamListener, PairingRepository,
  ParticipantRepository, TournamentService
- Replace isInstanceOf checks with pattern matching in GameResultStreamListener
- Wrap var in SwissPairingService resolveConflicts with scalafix:off
- Apply spotlessScalaApply formatting across tournament and official-bots modules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 13:03:34 +02:00
LQ63 9a69335dab fix(official-bots): replace null with Option to pass scalafix DisableSyntax.null
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 12:55:22 +02:00
Lala, Shahd eba0457b15 feat: bot vs. player 2026-06-09 12:55:06 +02:00
Lala, Shahd 311da8efba feat: local tour WORKS bots play 2026-06-09 12:55:06 +02:00
LQ63 bb57cc93ae feat(tournament): wire official bots into tournaments via JWT and Redis
- Add token field to OfficialBotAccount and generate a non-expiring bot
  JWT on creation so official bots can authenticate
- Expose token in POST /api/account/official-bots response and open the
  endpoint to any authenticated user
- Bridge TournamentService to Redis: publish gameStart events to
  nowchess:bot:<name>:events after each pairing so OfficialBotService
  picks up games automatically

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 12:53:22 +02:00
LQ63 c76a7247ba fix(ws): revert incompatible handshake.query usage
handshake.query(String) does not exist in the current Quarkus WebSocket API version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 12:53:22 +02:00
Lala, Shahd 587e34babc fix: bot name and id return, websocket 2026-06-09 12:53:22 +02:00
LQ63 35d7e0dc85 feat(tournament): add Swiss-system tournament module
Implements the full tournament lifecycle: create, join, withdraw, start,
round progression, and finish with Buchholz tiebreak standings.

- REST resource covering all 11 endpoints from the OpenAPI spec
- Swiss pairing algorithm with bye support
- Per-bot NDJSON stream with targeted gameStart events (color field)
- Game result ingestion via Redis writeback stream
- H2-backed integration tests for resource and pairing service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 12:52:55 +02:00