Skip to content

entire repo: visibility verb + fix get/mirror-get resolution#1531

Open
toothbrush wants to merge 4 commits into
mainfrom
repo-visibility-and-getfix
Open

entire repo: visibility verb + fix get/mirror-get resolution#1531
toothbrush wants to merge 4 commits into
mainfrom
repo-visibility-and-getfix

Conversation

@toothbrush

@toothbrush toothbrush commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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

Three entire repo fixes. User impact first:

What you can now do

Make a repo readable by anyone on Entire

entire repo visibility set <repo> public --project <project>
entire repo visibility get <repo> --project <project>

public grants read-only (pull) to any authenticated Entire user; push/manage stay with grantees. private reverts it. (Note: "any authenticated user" — the data plane still requires a token, so this is not anonymous/unauthenticated access.)

entire repo get <name> actually works
Previously entire repo get <name> --project <p> (and repo delete <name>) always failed with no repo named ... for every name — you had to pass a ULID. Now name resolution works.

entire repo mirror get accepts the clone URL
Previously only a mirror ULID worked; passing the entire://... clone URL that mirror list prints failed with decode response: ... unexpected Content-Type: text/plain. Now:

entire repo mirror get entire://<cluster>/gh/<owner>/<repo>

Why each broke

  • get-by-name: a ?name= query returns the match in the response's singular repo field, but the CLI read the (empty) repos page array. The test mocked the wrong field too, so it never caught it.
  • mirror get: the command passed the arg straight to GetMirror(ULID) with no resolution; a clone URL became a path segment whose slashes the router 404'd as text/plain, which the generated client can't decode. Resolution now lists mirrors by (cluster, provider, owner) and matches the repo (no get-by-coords endpoint exists).
  • visibility: the endpoint shipped server-side but the CLI's OpenAPI spec predated it. Refreshed the spec (additive only: the visibility endpoint, Repo.visibility, Cluster.apiUrl) and added the verb.

Tests

Unit coverage for all three: parseVisibility, the corrected resolveRepoRef mock, parseMirrorCloneURL, and resolveMirrorRef (ULID short-circuit, URL→ULID match, no-match + unparseable-ref errors). Build/vet/gofmt/lint clean.

🤖 Generated with Claude Code


Note

Medium Risk
Visibility set changes who can pull a repo (authorization-related), though it delegates to the existing server API; resolver fixes reduce broken CLI paths with limited blast radius.

Overview
Adds entire repo visibility get|set so repos can be toggled public (read-only pull for any authenticated Entire user) or private, calling the refreshed control-plane GET/PUT /repos/{repoId}/visibility client.

Fixes resolveRepoRef for name lookups: a ?name= response exposes the match in the singular repo field, not repos, so entire repo get/delete by name (with --project) work again.

entire repo mirror get now accepts an entire://<cluster>/gh/<owner>/<repo> clone URL (or a ULID) via resolveMirrorRef—list mirrors by cluster/provider/owner and match repo client-side.

Regenerated internal/coreapi for visibility APIs, optional Repo.visibility, and Cluster.apiUrl; unit tests cover visibility parsing and both resolvers.

Reviewed by Cursor Bugbot for commit 8065b2b. Configure here.

toothbrush and others added 3 commits June 26, 2026 15:21
`entire repo get/delete <name>` always failed with "no repo named" for
every name (not just dotted ones). A name-filtered ListProjectRepos
returns the match in the response's singular `repo` field, but
resolveRepoRef read the `repos` page array, which is empty on a name
query. The mock in the test populated `repos` too, so it never caught it.

Read `out.Repo` and fix the mock to mirror the real server.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Refresh the OpenAPI spec from us.console (additive only: the
/repos/{repoId}/visibility endpoint, Repo.visibility, Cluster.apiUrl)
and add `entire repo visibility get|set <repo> [public|private]`.

`public` grants read-only (pull) to any authenticated Entire user via
the SpiceDB public_viewer wildcard; push/manage stay restricted to
grantees. `private` restricts to explicit grantees. set requires manage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`entire repo mirror get` only accepted a mirror ULID; passing the
entire:// clone URL that `mirror list` prints sent the URL as a path
segment, which the router 404'd with text/plain and the ogen client
surfaced as "decode response: ... unexpected Content-Type: text/plain".

Add resolveMirrorRef: a ULID still passes through; an
entire://<cluster>/gh/<owner>/<repo> clone URL is resolved by listing
the caller-visible mirrors for that (cluster, provider, owner) and
matching the repo. The cluster in the URL disambiguates an upstream
mirrored on multiple clusters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@toothbrush toothbrush requested a review from a team as a code owner June 26, 2026 06:05
Copilot AI review requested due to automatic review settings June 26, 2026 06:05

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

Adds new entire repo visibility subcommands and fixes reference resolution for repo/mirror lookups so common user inputs (names and clone URLs) work consistently with the control-plane API.

Changes:

  • Add entire repo visibility get|set commands backed by new GET/PUT /repos/{repoId}/visibility core API operations.
  • Fix resolveRepoRef to correctly read name-filtered repo lookups from the singular repo field rather than the repos page array.
  • Extend entire repo mirror get to accept either a mirror ULID or an entire://<cluster>/gh/<owner>/<repo> clone URL via resolveMirrorRef.

Reviewed changes

Copilot reviewed 7 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/coreapi/spec/core.openapi.json Refresh OpenAPI spec to include repo visibility endpoint and new/updated schemas/fields.
internal/coreapi/spec/core.gen.json Generated OpenAPI-derived JSON updated for visibility and schema tweaks.
internal/coreapi/oas_validators_gen.go Generated validators for new visibility request/response types and enum validation.
internal/coreapi/oas_security_gen.go Register security requirements for the new visibility operations.
internal/coreapi/oas_schemas_gen.go Generated Go schema types updated (Cluster.apiUrl, Repo.visibility, visibility I/O structs).
internal/coreapi/oas_response_decoders_gen.go Generated response decoders for get/set repo visibility endpoints.
internal/coreapi/oas_request_encoders_gen.go Generated request encoder for SetRepoVisibility.
internal/coreapi/oas_parameters_gen.go Generated parameter structs for visibility operations and updated query param docs.
internal/coreapi/oas_operations_gen.go Generated operation name constants extended for visibility ops.
internal/coreapi/oas_json_gen.go Generated JSON encode/decode for new types and Repo.visibility.
internal/coreapi/oas_client_gen.go Generated client methods GetRepoVisibility and SetRepoVisibility.
cmd/entire/cli/resolveref.go Fix repo name→ULID resolution to use ListProjectReposOutputBody.repo.
cmd/entire/cli/resolveref_test.go Update repo resolution test to mock the correct singular repo field.
cmd/entire/cli/repo.go Add repo visibility command group with get and set verbs; add parseVisibility.
cmd/entire/cli/repo_test.go Add unit tests for parseVisibility.
cmd/entire/cli/repo_mirror.go Allow mirror get to resolve clone URLs to mirror ULIDs; add URL parsing/resolution helpers.
cmd/entire/cli/repo_mirror_test.go Add tests for parseMirrorCloneURL and resolveMirrorRef.
Files not reviewed (9)
  • internal/coreapi/oas_client_gen.go: Generated file
  • internal/coreapi/oas_json_gen.go: Generated file
  • internal/coreapi/oas_operations_gen.go: Generated file
  • internal/coreapi/oas_parameters_gen.go: Generated file
  • internal/coreapi/oas_request_encoders_gen.go: Generated file
  • internal/coreapi/oas_response_decoders_gen.go: Generated file
  • internal/coreapi/oas_schemas_gen.go: Generated file
  • internal/coreapi/oas_security_gen.go: Generated file
  • internal/coreapi/oas_validators_gen.go: Generated file

Comment thread cmd/entire/cli/repo_mirror.go Outdated
A URL pasted from `git remote -v` (entire://host/gh/owner/repo.git) now
resolves the same as the bare clone URL, matching gitremote.ParseURL.
Only the .git suffix is trimmed — GitHub repo names can contain dots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants