review: guard the cluster picker's selection against the offered hosts · Entire

review: guard the cluster picker's selection against the offered hosts

cbffb79→main·

toothbrush·1w ago·1 file·+9 added/-1 removed

Match repo clone's picker: an off-list or zero-value selection now exits as a clean cancel instead of surfacing a misleading "invalid [cluster-host]" error.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Sessions

0a9d965f7a2aView transcript

Changes

1

262 unmodified lines

263
264
265
266
266
267
268
269
270
271
272
273
274
275
276
277

262 unmodified lines

}
    return "", NewSilentError(errors.New("mirror create cancelled"))
    }
    return selected, nil
    // Guard the selection against the offered hosts (like repo clone's
    // picker) so a zero-value fall-through can't reach the caller as a
    // misleading "invalid [cluster-host]" error.
    for _, r := range regions {
        if r.host == selected {
            return selected, nil
        }
    }
    return "", NewSilentError(errors.New("mirror create cancelled"))
}

// mirrorTarget is one unit of work: a selected repo to be mirrored into a