Fix Repo Mirror List Filtering and Sorting · Entire

Review: PR #1665 — repo mirror list: add --repo filter and --sort

Overview

Adds two client-side presentation controls to entire repo mirror list:

Backed by shared helpers (sortMirrors, sortAvailable, filterByRepo, parseSortColumn). +431/-19, two files, tests only + command file.

Correctness — solid

Test coverage is thorough — dup-repo cluster tiebreak, non-repo column fallback, whitespace-spec parsing, unknown-column errors, --json, --show-available, direct helper unit tests. Strong.

Issues

Low — invalid --sort fetches all pages before erroring. sortMirrors/sortAvailable run inside the runCoreList fetch closure, after fetchAllPages walks every page and after the stderr banner prints. A typo'd --sort nope does a full network round-trip only to fail on a value knowable up front. Validate the spec in PreRunE (or before fetchAllPages) to fail fast.

// repo_mirror.go — parseSortColumn is pure; call it before the fetch

Nit — misleading mirrorColumns doc comment. New wording: "where --repo and a bare cluster/provider substring still match". filterByRepo matches m.Repo only — a cluster/provider substring does not match via --repo. Reads like --repo searches the clone URL. Reword or drop.

Nit — stale execMirrorList comment. Says "exercise --json and the client-side --filter/--sort" — flag is --repo, not --filter.

Nit — --repo help discoverability. "Filter by repo name" doesn't say substring or case-insensitive, unlike the good --sort help. Consider "Filter by repo-name substring (case-insensitive)".

Conventions / security / perf

Verdict

Approve after the nits. Only substantive item is the fast-fail on bad --sort (low). Nothing blocking correctness.