perf(checkpoint): keep the doctor scan fast on clones with many legacy checkpoints

main

Commit

Muskan Paliwal10h ago

Skip the walk when there is only one v1 copy, compare copies before looking up a ref, and compute each merge base once. On 5,000 checkpoints with 3,600 packed refs the scan drops from about 2.6s to 0.05s (one copy) or 0.2s (two copies).

Entire-Checkpoint: 01M6P0HN795D8XCHB06942QAM5