Skip to content

api/tenants: A tenant has one name - #143

Merged
l-nmch merged 2 commits into
mainfrom
feat/one-name-for-a-tenant
Nov 14, 2026
Merged

l-nmch merged 2 commits into
mainfrom
feat/one-name-for-a-tenant

Conversation

@l-nmch

@l-nmch l-nmch commented Nov 14, 2026

Copy link
Copy Markdown
Member

What

A tenant has one name. displayName leaves the body of a tenant (GET, list, POST) and the creation; a body that gives it is 400, like any field the API does not know.

With the plan gone (#139, #141) the display name was the only thing PATCH /v1/tenants/{t} could change, and the owner cannot change either (an OpenFGA tuple), so the route is removed: it answers 405. A tenant is renamed by nobody: its name is the namespace, the Incus project and the key of its rights. To hand one over, give the new person the admin role with a membership, as before. tenants:write now only deletes (its description says so); an existing key that holds it keeps working.

  • Removed: displayName of the tenant body and of the creation, MaxDisplayName, PatchRequest and its validation, the store Patch, the handler and the route, the updateTenant operation and TenantPatch of the OpenAPI.
  • The store no longer writes spec.displayName and no longer reads it. Objects that still carry it are not touched.
  • The displayName of an API key is another thing and stays.
  • docs/reference/tenants.md, endpoints.md and authorization.md say it, with the rule of the name.

Stacked on #141 (the plan), which already removed the plan of the same types: this branch is cut from it, so the base is fix/remove-plan and GitHub retargets it to main when #141 is merged.

Not in this pull request

The description of the Incus project is still made by the Tenant composition from spec.displayName, with the name as the fallback: with no display name sent it is the name, which is what is wanted. Stopping the composition from reading the field, and what happens to the objects that carry it, is phorge-fr/Hangar#488. The console side is phorge-fr/phorge-console#59 (it must stop sending displayName, which is now a 400, before this is deployed).

Tests

  • internal/tenants, internal/kube, internal/api: the display name and the patch tests are gone; new checks that PATCH is 405 for an admin, a viewer, a stranger, a key and nobody, that displayName on creation is 400 (given and empty), that the body of a tenant carries none, and that the store writes no spec.displayName.
  • TestOpenAPIMatchesTheRoutes follows the removed route; the rate-limit tests use another write route.
  • gofmt -l, go vet ./..., go test -race ./..., yamllint --strict on the OpenAPI and the docs check pass locally. golangci-lint is not installed locally, CI runs it. The integration test no longer renames, and expects 405 for a patch; it is not run here (it needs the cluster).

Closes #118

The display name leaves the body of a tenant and the creation, and with it the only thing a PATCH of a tenant could change: the route
is gone (405). The name is a slug, it is the namespace, the Incus project and the key of the rights, and the owner is an OpenFGA tuple;
nothing about a tenant changes afterwards.

A body that still gives displayName is refused as any field the API does not know (400). The tenants:write scope now only deletes.

Closes #118
@l-nmch l-nmch added this to the 2027-Q1 milestone Nov 14, 2026
@l-nmch l-nmch added the area/api Phorge API and console label Nov 14, 2026
@l-nmch l-nmch self-assigned this Nov 14, 2026
@l-nmch l-nmch added this to Roadmap Nov 14, 2026
Base automatically changed from fix/remove-plan to main November 14, 2026 17:15
@l-nmch
l-nmch merged commit cd22abc into main Nov 14, 2026
11 checks passed
@l-nmch
l-nmch deleted the feat/one-name-for-a-tenant branch November 14, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Phorge API and console

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

One name for a tenant

1 participant