Repository navigation
Organization updates over the API and MCP (name and slug, admins) - #303
Open
ndbroadbent wants to merge 2 commits into
Open
ndbroadbent wants to merge 2 commits into
ndbroadbent wants to merge 2 commits into
Conversation
…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>
VisualCIdocspring/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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).
PATCH /api/v1/organizations/{org}taking{ "name"?, "slug"? }(unknown fields refused, as on every/api/v1body). 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'sget_organizationanswer (one shared function,VisualCi::organization_json). A project token sees its own project and the plan, as over MCP.update_organization(org,name?,slug?) next toget_organizationandcreate_organization. Its description says the old slug keeps working and links redirect. It answers likeget_organization.PATCH /api/ui/orgs/{org}validation and update moved intoauth::orgs::change(name length, threshold, thenorgs::rename→Organization::rename_slug, with its reserved and taken checks, theprevious_organization_slugsredirect record, the rename cap and the gallery purge), plusauth::orgs::need_adminfor 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.{error, description}shape with the settings page's messages: 422 for an invalid or reserved slug or a bad name, 409that slug is taken, 403 for non-admins (newApiError::refusedmaps a handler'sabort_with).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-comtovisualcihq.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, thenGETthrough 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, andget_organizationandget_projectstill accept the old slug.org_rolenow prefers the current slug over an old one (ORDER BY (o.slug = {slug}) DESC), matchingOrganization::by_slug.{}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'supdate_organizationgets "no organization … that this token can see".tools/listgoldens for both token kinds now includeupdate_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 plussite.mjs, and the docs and changelog vitest files all pass locally.