Skip to content

fix(repo): resolve mirror get clone URLs via that cluster's login server - #1676

Merged
Soph merged 3 commits into
mainfrom
paul/mirror-get-cluster-routing
Jul 8, 2026
Merged

fix(repo): resolve mirror get clone URLs via that cluster's login server#1676
Soph merged 3 commits into
mainfrom
paul/mirror-get-cluster-routing

Conversation

@toothbrush

@toothbrush toothbrush commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/796

Why

entire repo mirror get entire://<cluster>/gh/<owner>/<repo> resolved the mirror on the active context's login server, so a clone URL for a cluster in another federation failed with no mirror matching until the user switched contexts with entire auth use. Not a regression: the clone-URL form was born with this in #1531, which shipped without the cluster routing that #1475 (mirror create/remove/collaborators) and #1529 (repo clone --cluster) already established.

What

  • mirror get <clone-url> now dials the login server fronting the URL's cluster (via coreapi.NewForCluster — cached well-known discovery + matching local context), so it works regardless of the active context. A ULID ref has no cluster coordinate and stays on the active context; an unparseable ref errors before dialing anything.
  • Adds runCoreObjectForCluster (mirroring runCoreListForCluster) and a clusterCoreClient test seam alongside activeCoreClient, making cluster-routed commands testable at command level for the first time.
  • Help text: documents the routing per ref form and the trailing-.git tolerance; says "login server", not "core".

Verification

  • New TestRepoMirrorGet_Routing pins all three paths: clone URL must dial the cluster's core and must NOT touch the active context; ULID the reverse; bad ref dials nothing.
  • mise run fmt && mise run lint clean; go test ./cmd/entire/cli/ passes.

🤖 Generated with Claude Code


Note

Low Risk
Behavior fix and testable refactors in CLI mirror lookup; no auth or data-model changes beyond dialing the correct control plane for clone URLs.

Overview
entire repo mirror get with an entire://… clone URL now talks to the login server for the URL’s cluster (runCoreObjectForCluster / coreapi.NewForCluster), matching create/remove—so mirrors in another federation no longer fail with “no mirror matching” while the wrong context is active. ULID refs still use the active context; invalid refs fail during parse with no API dial.

Shared CLI plumbing adds renderCoreObject, runCoreObjectForCluster, and a clusterCoreClient test seam (like list commands). Help text documents per-ref routing and trailing .git; badMirrorRefErr unifies parse errors. TestRepoMirrorGet_Routing asserts clone URL vs ULID vs bad-ref dialing behavior.

Reviewed by Cursor Bugbot for commit f8721e8. Configure here.

toothbrush and others added 3 commits July 8, 2026 18:49
`entire repo mirror get entire://<cluster>/gh/<owner>/<repo>` listed
mirrors on the active context's core, so a clone URL for a cluster in a
different federation failed with "no mirror matching" until the user
manually switched contexts with `entire auth use`. The clone URL already
names its cluster; dial the core fronting it — discovered from the
cluster's /.well-known/entire-cluster.json and authenticated with the
matching local context — the same routing `mirror create`/`remove`
(PR #1475) and `repo clone --cluster` (PR #1529) already use. A ULID
ref carries no cluster coordinate and stays on the active context.

Adds runCoreObjectForCluster (mirroring runCoreListForCluster) and a
clusterCoreClient test seam alongside activeCoreClient so the routing
decision is pinned by command-level tests without live discovery.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Entire-Checkpoint: 01KX0ENQ9M4C5P85G431G5YR2E
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Entire-Checkpoint: 01KX0FEMM9PGRDVWZTJ95RGXAJ
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Entire-Checkpoint: 01KX0FGHZAT1G7CBBZ8ECS8G90
Copilot AI review requested due to automatic review settings July 8, 2026 09:41
@toothbrush
toothbrush requested a review from a team as a code owner July 8, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes entire repo mirror get so that when the user passes an entire://<cluster>/gh/<owner>/<repo> clone URL, the command resolves the mirror by dialing the login server (core) that fronts that cluster rather than the active auth context—bringing mirror get in line with the established cluster-routing behavior of other mirror commands.

Changes:

  • Route mirror get clone-URL lookups through runCoreObjectForCluster (discovered/authenticated via coreapi.NewForCluster), while keeping ULID lookups on the active context.
  • Add shared object-rendering plumbing (renderCoreObject) and a clusterCoreClient seam to enable command-level tests without live /.well-known discovery.
  • Add TestRepoMirrorGet_Routing to pin routing behavior for clone URL vs ULID vs invalid ref (no dialing).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cmd/entire/cli/repo_mirror.go Routes mirror get by ref type (ULID vs clone URL), improves help text, and centralizes parse-error messaging.
cmd/entire/cli/repo_mirror_test.go Adds routing-focused command test ensuring correct core selection and no-dial on parse failure.
cmd/entire/cli/corecmd.go Introduces runCoreObjectForCluster/renderCoreObject and adds clusterCoreClient test seam used by cluster-routed object commands.

@Soph
Soph merged commit e980d1b into main Jul 8, 2026
12 checks passed
@Soph
Soph deleted the paul/mirror-get-cluster-routing branch July 8, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants