Skip to content

Fix opening explorer labels after recentering - #823

Merged
IongIer merged 1 commit into
hiveboardgame:mainfrom
Moltenfire:fix/opening-explorer-recentered-notation
Sep 10, 2026
Merged

IongIer merged 1 commit into
hiveboardgame:mainfrom
Moltenfire:fix/opening-explorer-recentered-notation

Conversation

@Moltenfire

@Moltenfire Moltenfire commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The opening explorer recomputed notation after hypothetical moves, but those moves can recenter the cloned board and leave the original target coordinate stale.

That stale coordinate could produce invalid or self-referential move labels, or panic the client. Reuse the notation recorded before re-centering and cover the boundary with a regression test.

Found during an additional AI-assisted review of the PR.

Example

Concrete example (from the added regression test):

  • Board has White queen/ant near one edge (q=30/31) and Black queen/ant near the other (q=0/1) on the same row.
  • Playing wG1 to Position(30, 15) is legal, but triggers the board's internal re-centering.
  • After the move, state.board.position_of_piece(wG1) is no longer (30, 15) — it's been shifted.
  • Old code: recomputed the label using the stale (30, 15) coordinate against the re-centered board → wrong/garbage label.
  • New code: instead reuses the notation that was already recorded correctly in state.history.moves at the time the move was actually played (before any subsequent re-centering could invalidate it) → always correct.

The opening explorer recomputed notation after hypothetical moves, but those moves can recenter the cloned board and leave the original target coordinate stale.

That stale coordinate could produce invalid or self-referential move labels, or panic the client. Reuse the notation recorded before recentering and cover the boundary with a regression test.
@IongIer
IongIer merged commit 131f8b3 into hiveboardgame:main Sep 10, 2026
1 check passed
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.

2 participants