Leon Hermann lq64
  • Joined on 2025-10-09
lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

String prefix "bot-" as an ID convention is fragile — nothing enforces it in the domain model. This will silently fail (not notify the bot) if the prefix ever changes or if a regular user's ID happens to start with "bot-". Introduce a typed BotId/PlayerId sum type or a boolean flag on PlayerInfo instead.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

A @PermitAll endpoint that creates a game and triggers bot activity has no rate-limiting or identity attached to the player. Any unauthenticated caller can drive unlimited bot load. Either require authentication (@RolesAllowed("**")) or add explicit rate-limiting before exposing this in production.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

Swallowing a rejected RejectedExecutionException silently drops moves. At minimum log the rejection so it shows up in monitoring.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

newSingleThreadExecutor() uses an unbounded queue. Under a slow game handler, tasks will queue indefinitely. Use new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(1000), r -> ..., new DiscardOldestPolicy()) to bound memory.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

shutdownNow() interrupts running tasks but doesn't wait for them to finish. Tasks already submitted to the executor may still be mid-handleC2sMessage when the game is considered gone. Consider awaitTermination(200, MILLISECONDS) after shutdownNow() to give in-flight tasks a chance to complete cleanly.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

Building JSON by string interpolation is fragile — any gameId or botId containing " or \ will produce invalid JSON and silently break the downstream OfficialBotService. Use objectMapper.writeValueAsString(Map(...)) or a structured DTO.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

Missing nullable = false. A just-constructed OfficialBotAccount starts with token = uninitialized, and AccountService does two separate persist() calls to work around this. Add nullable = false and generate the token before the first persist to collapse it to one round-trip and make the constraint explicit at the DB level.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:47 +02:00
feat: NCS-82 add Swiss-system tournament module

bot.token can be null if the Hibernate entity was just persisted (the token is not nullable = false on OfficialBotAccount). Wrap with

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

Is it okay to leave it like that?

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

This is a heap dump filename with a specific PID, meaning a heap dump was taken during development. Confirm the dump file itself is not tracked in the repository (git ls-files

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

The entire file operates on a daemon thread with Thread.sleep(5000) reconnect. This bypasses Quarkus CDI lifecycle: it won't receive the shutdown signal, won't drain in-flight work on @PreDestroy, and the flat 5-second backoff will hammer the server if the tournament endpoint is persistently unavailable. Use @Scheduled or a Vert.x timer with exponential backoff, and track the thread reference so it can be interrupted on graceful shutdown.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

Non-expiring tokens are a security liability. If a bot token is leaked there is no recovery short of deleting the account. At minimum use a multi-year expiry, and surface a token-rotation endpoint so operators have a recovery path.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

Same two-persist pattern. The root cause is that bot.id is not available before the first persist(). Either use a pre-assigned UUID (@Id with UUID.randomUUID() before persist) or derive the token from a field that doesn't require a DB round-trip. Two flushes per creation is a correctness risk under failure: if the second persist fails, the entity exists without a valid token.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

The token is set to a random UUID, persisted, then immediately overwritten with the real JWT and persisted again. This is two DB writes and leaves a window where the entity carries a meaningless token. Generate the ID first, build the JWT, set it once, then persist.

lq64 commented on pull request NowChess/NowChessSystems#55 2026-06-07 15:08:46 +02:00
feat: NCS-82 add Swiss-system tournament module

The PR description acknowledges a null white player for bye rounds. Per project convention, this must be Option[PlayerId] (or a Bye case in a sum type), not a nullable field. A null propagating through the SwissPairingService and TournamentResource will eventually reach a serializer or comparison that throws rather than producing a well-formed API response.

lq64 pushed to feat/NCS-82 at NowChess/NowChessSystems 2026-06-01 00:06:53 +02:00
8255731d50 feat(tournament): wire official bots into tournaments via JWT and Redis
acd8a26685 fix(ws): revert incompatible handshake.query usage
Compare 2 commits »
lq64 created pull request NowChess/NowChessSystems#55 2026-05-29 01:09:45 +02:00
feat: NCS-82 add Swiss-system tournament module
lq64 pushed to feat/NCS-82 at NowChess/NowChessSystems 2026-05-29 00:48:07 +02:00
5c586b9003 feat(tournament): add Swiss-system tournament module
lq64 created branch feat/NCS-82 in NowChess/NowChessSystems 2026-05-29 00:48:06 +02:00
lq64 created pull request NowChess/NowChessSystems#50 2026-05-13 13:33:37 +02:00
docs(tournament): spec