feat: implement legal castling (#1)
Build & Test (NowChessSystems) TeamCity build finished

## Summary

  - Introduces `GameContext` wrapper (board + castling rights) threading through the entire engine pipeline
  - Extends `MoveValidator` with `castlingTargets`, context-aware `legalTargets`/`isLegal` overloads, and helpers (`isCastle`, `castleSide`)
  - Updates `GameRules.legalMoves` and `gameStatus` to use `GameContext`, preventing false stalemate when castling is the only legal move
  - Adds castle detection and atomic execution (`withCastle`) to `GameController.processMove`, plus full rights revocation via source- and
  destination-square tables

  ## Test Plan

  - [ ] 142 tests passing, 100% statement and branch coverage on `modules/core`
  - [ ] White/Black kingside (e1g1/e8g8) and queenside (e1c1/e8c8) castling moves execute correctly
  - [ ] All six legality conditions enforced (rights flags, home squares, empty transit, king not in check, transit/landing squares not attacked)
  - [ ] Rights revoked on king moves, own rook moves, castle moves, and enemy rook captures
  - [ ] False stalemate correctly prevented when castling is the only escape

Co-authored-by: LQ63 <lkhermann@web.de>
Co-authored-by: Janis <janis.e.20@gmx.de>
Reviewed-on: #1
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: Leon Hermann <lq@blackhole.local>
Co-committed-by: Leon Hermann <lq@blackhole.local>
This commit was merged in pull request #1.
This commit is contained in:
2026-03-24 17:55:00 +01:00
committed by Janis
parent d0289e16f4
commit 00d326c1ba
12 changed files with 2054 additions and 87 deletions
+23
View File
@@ -0,0 +1,23 @@
# Unresolved Issues
## [2026-03-24] JUnitSuiteLike mixin not available for ScalaTest 3.2.19 with Scala 3
**Requirement / Bug:**
CLAUDE.md prescribes that all unit tests should extend `AnyFunSuite with Matchers with JUnitSuiteLike`. However, the `JUnitSuiteLike` trait cannot be resolved in the current build configuration.
**Root Cause (if known):**
- ScalaTest 3.2.19 for Scala 3 does not provide `JUnitSuiteLike` in any public package.
- The `co.helmethair:scalatest-junit-runner:0.1.11` dependency does not expose this trait.
- There is no `org.scalatest:scalatest-junit_3` artifact available for version 3.2.19.
- The trait may have been removed or changed in the ScalaTest 3.x → Scala 3 migration.
**Attempted Fixes:**
1. Tried importing from `org.scalatest.junit.JUnitSuiteLike` — not found
2. Tried importing from `org.scalatestplus.junit.JUnitSuiteLike` — not found
3. Tried importing from `co.helmethair.scalatest.junit.JUnitSuiteLike` — not found
4. Attempted to add `org.scalatest:scalatest-junit_3:3.2.19` dependency — artifact does not exist in Maven Central
**Suggested Next Step:**
1. Either find the correct ScalaTest artifact/import for Scala 3 JUnit integration, or
2. Update CLAUDE.md to reflect the actual constraint that unit tests should extend `AnyFunSuite with Matchers` (without `JUnitSuiteLike`), or
3. Investigate whether a different test runner or configuration is needed to achieve JUnit integration with ScalaTest 3 in Scala 3