Don't mutate the caller's managed map in BuildPlans

main

Commit

Soph3mo ago

BuildPlans passed the caller's managed map straight to addPruneCandidates, which inserts prune candidates — so a --prune plan mutated a map the caller still owns. BuildReplicationPlans already copied defensively. Copy inside the prune branch in both (the only mutation happens there), so neither touches the caller's map and the two functions stay symmetric.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: f3b681dacd36