Review from comments, not code.
It is possible code takes some of these issues into account.
What if rook has not moved but is not there
With "it only means that neither the king nor the rook corresponding to the castling side have moved throughout the game", a rook is should be considered moved if it is taken, even if from its original square. Else one could castle with the ghost rook since it never moved.
50 move rule
State lacks info indicating the last time a piece taken or pawn advanced.
3 repetitions
State lacks info needed for check of the possible outcomes repeating 3 times.
Castling
Needs 2 more:
The king is not in check before castling.
The king will not move across check.
Stalemate
What if the side lacks a legal move?