mobile icon indicating copy to clipboard operation
mobile copied to clipboard

Compute tree node IDs from UCI instead of relying on server's 'id' field

Open Copilot opened this issue 1 month ago • 1 comments

The server wants to remove the backward compatibility layer that includes pre-computed 'id' fields in analysis tree nodes.

Changes

  • Compute node IDs from UCI: Changed mergeOngoingAnalysis() to derive node IDs using UciCharPair.fromUci(uci) instead of reading node['id']
  • Fix incomplete merge: Added recursive merge for newly created branches to process their evaluation data and nested children

Before/After

// Before: relied on server-provided ID
final id = n2child['id'] as String;
final n1child = n1.childById(UciCharPair.fromStringId(id));

// After: compute ID from UCI
final uci = n2child['uci'] as String;
final n1child = n1.childById(UciCharPair.fromUci(uci));

The second fix addresses a pre-existing issue where new variations with nested children would only add the first level - evaluation data and deeper moves were dropped. Now properly recursive.

Original prompt

This section details on the original issue you should resolve

<issue_title>stop relying on tree node['id']</issue_title> <issue_description>as I would like to remove the BC layer from the server.

The node ID can be computed from the node UCI, it's already happening in the app, somewhere.

I found a use of node['id'] here but there might be others?</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes lichess-org/mobile#2539

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Jan 18 '26 09:01 Copilot