Skip to content

Organization updates over the API and MCP (name and slug, admins) - #303

Open
ndbroadbent wants to merge 2 commits into
mainfrom
org-update-api
Open

ndbroadbent wants to merge 2 commits into
mainfrom
org-update-api

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

What

An organization's name and slug can now be changed over the API and MCP, by its admins, with the same rules and redirect as its settings page (#277).

  • API: PATCH /api/v1/organizations/{org} taking { "name"?, "slug"? } (unknown fields refused, as on every /api/v1 body). It needs a personal access token (vcu_) of an admin: a project token gets 403, a member who isn't an admin gets 403 with the settings page's words, and someone outside the org gets 404. It answers with the organization.
  • GET /api/v1/organizations/{org} is new too: the REST API had no organization read, so the PATCH answers with what this returns, which is MCP's get_organization answer (one shared function, VisualCi::organization_json). A project token sees its own project and the plan, as over MCP.
  • MCP: update_organization (org, name?, slug?) next to get_organization and create_organization. Its description says the old slug keeps working and links redirect. It answers like get_organization.
  • Shared rules: the settings page's PATCH /api/ui/orgs/{org} validation and update moved into auth::orgs::change (name length, threshold, then orgs::rename → Organization::rename_slug, with its reserved and taken checks, the previous_organization_slugs redirect record, the rename cap and the gallery purge), plus auth::orgs::need_admin for the admins-only check and its message. The settings page, the API and MCP all call those, so nothing is duplicated. {org} may be an old slug.
  • API errors use the API's {error, description} shape with the settings page's messages: 422 for an invalid or reserved slug or a bad name, 409 that slug is taken, 403 for non-admins (new ApiError::refused maps a handler's abort_with).
  • Docs: the API reference has a new Organizations section, and agents.md and llms-header list update_organization. The plugin skills were regenerated (visualci-review lists tools). There's a changelog entry.

Why

So agents can rename an organization: customers' agents will want this, and the coordinator needs it now to rename visualci-com to visualcihq.

Tests

  • org_settings::admins_rename_the_organization_over_the_api: a member is refused (403 with the settings page's message), so is a project token (403), an outsider (404) and no token (401). Invalid, reserved and taken slugs get the settings page's 422/409 errors. A field the endpoint doesn't take gets 422. A name-only update works. A slug rename answers with the new slug, then GET through the old slug works with a member's token and the project token, and the old page path redirects (302) to the new one.
  • mcp::admins_update_the_organization: a member, a project token, an invalid slug and a taken slug are refused. A name-only update works. A rename works, and get_organization and get_project still accept the old slug.
  • Review follow-ups:
    • org_role now prefers the current slug over an old one (ORDER BY (o.slug = {slug}) DESC), matching Organization::by_slug.
    • Tests: a project token's GET has no members, invitations, usage history or emails (with a pending invitation that an admin's GET does show), and a non-member's GET is a 404. {} and the current slug change nothing (no old-slug row is added). Renaming to another organization's old slug is a 409 over both the API and MCP, and an outsider's update_organization gets "no organization … that this token can see".
    • The PATCH reads its body after the token check, so a request with no token gets a 401 even if its body is malformed.
  • The tools/list goldens for both token kinds now include update_organization, as expected.
  • cargo test --test app, cargo clippy --all-targets -D warnings, cargo fmt --check, node scripts/skills.mjs --check, changelog-entry.mjs --check-new, the frontend build plus site.mjs, and the docs and changelog vitest files all pass locally.

ndbroadbent and others added 2 commits December 5, 2026 15:40
…slug, with the settings page's rules and redirect

PATCH /api/v1/organizations/{org} (with GET), and MCP's update_organization, share the settings page's
validation and rename through auth::orgs::change and need_admin. Personal tokens of admins only; the old
slug keeps working.

Co-Authored-By: Claude <noreply@anthropic.com>
…ks the token before the body, and more tests

Co-Authored-By: Claude <noreply@anthropic.com>
@visualci-com

visualci-com Bot commented Dec 5, 2026

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #1451 · 7 changed, 10 added, 571 unchanged · waiting for review

This PR vs base: 7 changed, 10 added since #1431, across 1 build · 17 not approved yet

Snapshot What changed Close-up: before → after
screenshots/changelog/1440-dark (changed)
before · after

Content below here moved
screenshots/changelog/1440-light (changed)
before · after

Content below here moved
screenshots/changelog/390-dark (changed)
before · after

Content below here moved
screenshots/changelog/390-light (changed)
before · after

Content below here moved
and 13 more in the build

docspring/visualci · journeys · build #1448 · 53 unchanged · no changes

This PR vs base: nothing since #1428, across 2 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant