Skip to content

Comments

fix: don't try to account for alternative castling notation in annotations#2255

Merged
veloce merged 2 commits intolichess-org:mainfrom
tom-anders:fix/2231
Oct 14, 2025
Merged

fix: don't try to account for alternative castling notation in annotations#2255
veloce merged 2 commits intolichess-org:mainfrom
tom-anders:fix/2231

Conversation

@tom-anders
Copy link
Collaborator

@tom-anders tom-anders commented Oct 7, 2025

This leads annotations being displayed on the wrong square e.g. when moving the rook from e1 to h1 (as its incorrectly interpreted as a castling move).

Luckily, we already convert alternative castling notation when constructing the node tree here, so instead of extending the logic in the AnalysisBoard, we can just get rid of this logic entirely.

Fixes #2231

…tions

This leads annotations being displayed on the wrong square e.g. when
moving the rook from e1 to h1 (as its incorecctly interpreted as a
castling move).

Luckily, we already convert alternative castling notation when constructing the
node tree, so instead of extending the logic in the AnalysisBoard, we
can just get rid of this logic entirely.

Fixes lichess-org#2231
@veloce
Copy link
Contributor

veloce commented Oct 8, 2025

Thanks for this! A test would be nice here, to avoid any future regression.

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@veloce veloce merged commit c65101e into lichess-org:main Oct 14, 2025
1 check passed
tom-anders added a commit to tom-anders/lichess-mobile that referenced this pull request Oct 17, 2025
I wrongly assumed that addMoveAt() already converts castling notation
for us, but that function is only called when new nodes are added to the
move tree in an active game, but not when parsing a study chapter.

This is why lichess-org#2255 fixed the bug of a mve being incorrectly interpreted
as alt-castling, but it now broke the annotations if the move actually
WAS a castling move.

Luckily, while in addMoveAt() there are some heuristics because we only
have the UCI move, not the SAN move, in the AnalysisBoard we *do* have
the SAN move, so we can just check for O-O/O-O-O to avoid false
positives.

Resolves lichess-org#2231
veloce pushed a commit that referenced this pull request Oct 17, 2025
I wrongly assumed that addMoveAt() already converts castling notation
for us, but that function is only called when new nodes are added to the
move tree in an active game, but not when parsing a study chapter.

This is why #2255 fixed the bug of a mve being incorrectly interpreted
as alt-castling, but it now broke the annotations if the move actually
WAS a castling move.

Luckily, while in addMoveAt() there are some heuristics because we only
have the UCI move, not the SAN move, in the AnalysisBoard we *do* have
the SAN move, so we can just check for O-O/O-O-O to avoid false
positives.

Resolves #2231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blunder symbol in the analysis board is incorrectly displayed

2 participants