repo mirror list: regression-test --sort repo cluster tiebreak · Entire
repo mirror list: regression-test --sort repo cluster tiebreak
82c22d5→main·
gtrrz-victor·1w ago·1 file·+28 added/-0 removed
The autofix routed explicit --sort repo/-repo through sortMirrorsDefault so
they share the default's owner/repo + cluster tiebreak, but added no test.
Cover it: a repo mirrored on two clusters must order aws before eu under
--sort repo, and reverse under -repo.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
01KWY7B5RAY1GM3SJ3FY0KAH31View transcript
[?
Add Repo Filter and Sort to Mirror ListCodex·GPT-5.5·3 steps](/content/gh/entireio/cli/session/019f3bf7-423c-77b1-873d-9a333dc5f8f9#timeline-01KWY7B5RAY1GM3SJ3FY0KAH31/index.html) [?
Repository Mirror List Command EnhancementClaude Code·Opus 4.8[1m]·2 steps](/content/gh/entireio/cli/session/720f6b47-08c0-41d4-9bde-e278935e7c15#timeline-01KWY7B5RAY1GM3SJ3FY0KAH31/index.html)
Changes
1
cmd/entire/cli
Mrepo_mirror_test.go+28
566 unmodified lines
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
ing unmodified lines
)
})
t.Run("explicit --sort repo keeps the cluster tiebreak (matches default)", func(t *testing.T) {
// A repo on two clusters plus a lexically-earlier repo. Explicit
// `--sort repo` must order like the default: owner/repo ascending, and
// within the duplicate tie, cluster ascending (aws before eu). Guards
// against `--sort repo` regressing to a plain single-key sort that would
// drop the tiebreak.
dupes := []coreapi.Mirror{
{Owner: "acme", Repo: "web", ClusterHost: "eu-west-1.entire.io"},
{Owner: "acme", Repo: "web", ClusterHost: "aws-us-east-2.entire.io"},
{Owner: "acme", Repo: "api", ClusterHost: "aws-us-east-2.entire.io"},
}
serveMirrorList(t, dupes, nil)
stdout, _ := runMirrorList(t, "--sort", "repo")
api := strings.Index(stdout, "entire://aws-us-east-2.entire.io/gh/acme/api")
awsWeb := strings.Index(stdout, "entire://aws-us-east-2.entire.io/gh/acme/web")
euWeb := strings.Index(stdout, "entire://eu-west-1.entire.io/gh/acme/web")
require.Less(t, api, awsWeb, "acme/api sorts before acme/web")
require.Less(t, awsWeb, euWeb, "within the acme/web tie, aws cluster sorts before eu")
// -repo reverses the whole ordering, tiebreak included.
serveMirrorList(t, dupes, nil)
stdout, _ = runMirrorList(t, "--sort", "-repo")
require.Less(t,
strings.Index(stdout, "entire://eu-west-1.entire.io/gh/acme/web"),
strings.Index(stdout, "entire://aws-us-east-2.entire.io/gh/acme/web"),
)
})
t.Run("--repo/--sort apply under --show-available", func(t *testing.T) {
serveMirrorList(t, nil, []coreapi.AvailableMirror{
{Owner: "acme", Repo: "web", Access: "write", Status: "available"},