Skip to content

Fix variant handling in explorer and tablebase#3173

Merged
veloce merged 6 commits into
lichess-org:mainfrom
Matrix9494:analysisboard
May 21, 2026
Merged

Fix variant handling in explorer and tablebase#3173
veloce merged 6 commits into
lichess-org:mainfrom
Matrix9494:analysisboard

Conversation

@Matrix9494

@Matrix9494 Matrix9494 commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix variant handling for opening explorer and tablebase requests. #3168

This PR makes explorer requests variant-aware so non-standard positions no longer fall back to standard data by accident. It also prevents the Masters database from being shown for variants where the endpoint does not support variant selection.

Changes

  • Pass the current position variant through OpeningExplorerView and openingExplorerProvider.
  • Add the variant query parameter for Lichess and player opening explorer requests.
  • Keep fromPosition mapped to standard, since it is an imported/custom standard chess position rather than a real variant.
  • Block Masters DB for non-standard variants because the /masters endpoint has no variant parameter.
  • Route tablebase requests to variant-specific endpoints:
    • /standard for standard, from-position, and Chess960
    • /atomic for Atomic
    • /antichess for Antichess

Screenshot

Combined screenshot:

  1. Standard opening explorer
  2. Antichess opening explorer
  3. Antichess with Masters DB unavailable message
  4. Antichess tablebase
image

@HaonRekcef

Copy link
Copy Markdown
Collaborator

I think it would be preferable to display the lichess database all the time for variants instead of showing that the master db is not available.

@veloce

veloce commented May 13, 2026

Copy link
Copy Markdown
Contributor

I think it would be preferable to display the lichess database all the time for variants instead of showing that the master db is not available.

Agreed. We don't want to be forced to go to settings to change the DB.

@Matrix9494

Copy link
Copy Markdown
Contributor Author

Agreed, thanks. I updated the PR so variant positions no longer show the “Masters database is not available” message.

Since mobile currently stores a single selected explorer database, the current behavior is now:

  • Standard / from-position + Masters selected: use Masters
  • Variant position + Masters selected: temporarily fall back to the Lichess database
  • Lichess selected: use Lichess

This fallback does not change the saved preference; it only affects the database used for the current variant position.

Longer term, I agree the better UI would be closer to the LichessWeb, where multiple databases can be shown as separate tabs and unsupported databases can simply be hidden/disabled per variant. That is a larger UI/settings change, so I’d prefer to keep it as a follow-up PR.

final Map<OpeningExplorerCacheKey, OpeningExplorerEntry> cache = {};
// Variant is part of the key because the same FEN string can be queried
// against different explorer datasets.
final Map<({String fen, Variant variant, OpeningExplorerPrefs prefs}), OpeningExplorerEntry>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are now using a record instead of the freezed class, which is fine. But I don't see the deletion of that OpeningExplorerCacheKey class in the PR. I suppose it is now dead code (it should be) so it needs to be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. The unused code has been removed.

@veloce veloce left a comment

Copy link
Copy Markdown
Contributor

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 dd90448 into lichess-org:main May 21, 2026
1 check passed
@Matrix9494 Matrix9494 deleted the analysisboard branch May 23, 2026 19:08
@tom-anders tom-anders mentioned this pull request Jun 4, 2026
24 tasks
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.

3 participants