Disable puzzles with too few alternative moves so they're no longer served#786
Disable puzzles with too few alternative moves so they're no longer served#786Copilot wants to merge 17 commits into
Conversation
|
@copilot resolve the merge conflicts in this pull request |
Merged |
| import org.jooq.kotlin.coroutines.transactionCoroutine | ||
|
|
||
| private val appConfig = loadAppConfig(ArgConfig("prod", null)) | ||
| private val dslContext = getScriptDslContext(appConfig, maximumPoolSize = 2) |
There was a problem hiding this comment.
@copilot Instead of doing this, script can extend KoinScriptInit():
private val appConfig = loadAppConfig(ArgConfig("prod", null))
private val dslContext = getScriptDslContext(appConfig, maximumPoolSize = 2)There was a problem hiding this comment.
Done — the script now extends KoinScriptInit() and injects DSLContext via Koin, dropping the manual loadAppConfig/getScriptDslContext setup.
benckx
left a comment
There was a problem hiding this comment.
@copilot doens't work at all as if moves where not ordered?
13:08:25.990 [main] WARN i.e.s.p.DisablePuzzlesWithoutEnoughMoves - could not validate puzzle ZlPoVoVO due to IllegalArgumentException: No piece at h3
13:08:25.990 [main] WARN i.e.s.p.DisablePuzzlesWithoutEnoughMoves - could not validate puzzle KndOKq7V due to IllegalArgumentException: No piece at c4
13:08:25.990 [main] WARN i.e.s.p.DisablePuzzlesWithoutEnoughMoves - could not validate puzzle Vlpw873V due to IllegalArgumentException: No piece at c4
13:08:26.004 [main] INFO i.e.s.p.DisablePuzzlesWithoutEnoughMoves - disabling 17792 puzzles: [ZI1teRCP, lwuv23CJ, pEWLQPJu, gs93bwmf, MJs3OZXP, vItjRHol, LWEY4XjW, dwEqh3vV, qNyCc6eK, 0pVhol4e, sq0iPs0q, 4OH6tg1Z, IUVXc6kA, qCPWd35Z, 8yExpPQK, 3sNPT9rM, 5Pbm2VAN, VW1q0sE2, FI1bcUgA, Ac7xMj5p, Ba1mw3eL, O5DEsR08, hLcVX34U, qKZg54BV, 8CvRDEvm, SJ8KaVID, F9unSyyS, MBiit9N7, lBYYO6ag, oPdkMDut, yZC2skZa, LQWe3svH, Mtab09E5, k2lYjbYV, nBmxyGD3, DJhln71M, Xfxkuwuq, pgDxqzxd, 9MFDI5S5, P3XPWP7m, OBooLuzJ, W6ZYRjlO, JujKoeKf, a5i8CAwg, j1ljyKYk, 8AOLxyjG, wRb6wBFa, orz0TI6F, VwP3mkBL, s4wTuu4j, 3z9h46bt, ZycsROeM, HSdtZGTr, Bs4YHq77, Awqe4ytK, cZ9DmAQG, tATscvPf, 234RZxoA, 3RXdu1r2, qvy4uW3O, 6aBDq9IK, rSVBlrPE, i73oT1L5, J444Qkft, 2kKLOxUQ, fX6ttfKB, 5Jb64bFi, CUvrzjAj, VCt4OQiW, ZJI1ysx2, d7wsvF6h, CWQfP3ep, zCJFpopw, hmvNFUuW, GMl919Zz, WdQF0Hep, xqnEHICj,
|
@copilot We need to show on the puzzles.html page if the puzzle is disabled. Add a warning icon. |
|
@copilot also if we play a disabled puzzle, there shouldn't be any ELO transfer |
Added a warning icon next to the puzzle id on the puzzles page that shows when the loaded puzzle is disabled. |
|
@copilot instead of storing as a boolean, let's store it as a date "disabled_at" but keep it as a boolean in the PuzzleCache |
…lidation' into copilot/add-puzzle-check-loop-validation
Done in a510bfd —
Done in a510bfd — changeset |
Some puzzles start in check with only forced replies, letting players get stuck in a perpetual-check loop when they deviate from the recorded solution (e.g.
3oY3UwhN,ohT0nTBS). This adds a way to detect such puzzles, flag them, and exclude them from assignment.Schema
0108adds a nullabledisabled_attimestamp topuzzle(a puzzle is disabled whendisabled_atis set); regenerated the codegen changelog.Detection
PuzzleSolvabilityValidator.hasEnoughMovesAtEachPlayerStep(...)(located in thescripts/puzzlespackage, not the service layer): replays setup + solution moves and requires ≥MIN_LEGAL_MOVES_PER_STEP(3) legal moves at every player turn. The player is the side to move after setup; opponent turns are skipped.DisablePuzzlesWithoutEnoughMovesscript (in thescripts/puzzlespackage) iterates all puzzles and setsdisabled_at = now()for those that fail the check.Serving
PuzzleCachekeeps a booleanenabledper entry, derived fromdisabledAt == null.PuzzleCache.randomIdnow selects only from enabled entries. The cache still loads disabled puzzles, since they're needed for by-id lookups and played-puzzle history.UI
enabledflag is now surfaced throughPuzzleResponseand the client-sidePuzzleDto. The puzzles page shows a warning icon next to the puzzle id when a disabled puzzle is loaded (e.g. via a by-id link), with a tooltip explaining it is no longer served.Rating
processOutcomechecks the puzzle'senabledflag from the cache and applies a no-op transfer (ratings left unchanged) when the puzzle is disabled.Notes
randomIdthrowsNoSuchElementException, already handled upstream as "Puzzle cache not ready yet".