feat: organizations CRUD + users delete-account (100% coverage)#63
Merged
Conversation
yorkable
added a commit
that referenced
this pull request
Apr 30, 2026
Codex review on PR #63 caught a real bug: the spec declares POST/PUT /api/v1/organizations/ as multipart/form-data with required fields (logo + display_name on create, display_name on update), but the previous implementation sent JSON via apiClient.Post/Put. Real requests would have failed validation against the live API. Fix: - Add Client.PostMultipartForm / PutMultipartForm helpers that mix text fields and an optional file (single field). Reuses the existing multipart machinery and 5-minute upload timeout. - Rewrite organizations create/update with explicit flags matching the spec's Body_organizations_{create,update} schema: - create: --display-name, --logo (required); --description, --domains, --saml-provider-id (optional) - update: --display-name (required); --logo, --description, --domains, --saml-provider-id, --update-comments (optional) - Drop the --file JSON-body pattern for these two endpoints; it can't represent the binary logo and would mislead users. - Tests parse the multipart body server-side and assert form-field values + presence of the logo file part. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
yorkable
added a commit
that referenced
this pull request
Apr 30, 2026
"Keeping the old name works avoids breaking scripts" → "...avoids breaking scripts that still invoke it." Caught in self-review of PR #63. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Closes the final 4/15 coverage gaps and reaches 100% of non-deprecated spec endpoints: - POST /api/v1/organizations/ (organizations_create) - PUT /api/v1/organizations/ (organizations_update) - DELETE /api/v1/organizations/ (organizations_delete) — requires --confirm - DELETE /api/v1/users/delete_account (users_delete_account) — requires --confirm Naming fix: the spec calls GET /api/v1/organizations/ "Get Current Organization" (singular). Earlier CLI versions exposed it as `organizations list` which was misleading. Renamed to `organizations get`; `organizations list` kept as a hidden alias so existing scripts keep working. The two destructive endpoints gate behind a literal --confirm flag — the first such gate in the CLI. Without --confirm, the command exits with a non-zero status and never hits the network. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codex review on PR #63 caught a real bug: the spec declares POST/PUT /api/v1/organizations/ as multipart/form-data with required fields (logo + display_name on create, display_name on update), but the previous implementation sent JSON via apiClient.Post/Put. Real requests would have failed validation against the live API. Fix: - Add Client.PostMultipartForm / PutMultipartForm helpers that mix text fields and an optional file (single field). Reuses the existing multipart machinery and 5-minute upload timeout. - Rewrite organizations create/update with explicit flags matching the spec's Body_organizations_{create,update} schema: - create: --display-name, --logo (required); --description, --domains, --saml-provider-id (optional) - update: --display-name (required); --logo, --description, --domains, --saml-provider-id, --update-comments (optional) - Drop the --file JSON-body pattern for these two endpoints; it can't represent the binary logo and would mislead users. - Tests parse the multipart body server-side and assert form-field values + presence of the logo file part. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
"Keeping the old name works avoids breaking scripts" → "...avoids breaking scripts that still invoke it." Caught in self-review of PR #63. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
yorkable
force-pushed
the
feat-orgs-and-account
branch
from
April 30, 2026 23:09
5b48cc9 to
8e84478
Compare
A user pointed out that exposing organizations delete is too dangerous to ship even with a --confirm gate — one bad keystroke wipes every agent, session, batch, and channel target for the org. The endpoint exists in the spec but is intentionally absent from the CLI. The web console retains delete for the small set of operators who need it. CLI users should use that path; the safety floor is simpler with no CLI surface at all. This drops the cobra command, both gate tests, and the AGENTS.md row. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Summary
Final PR (5 of 5) in the 100% OpenAPI coverage initiative. Closes the last 4 gaps and reaches 100% coverage of non-deprecated endpoints.
organizations get(rename oforganizations list) →GET /api/v1/organizations/listname was misleading.organizations listkept as a hidden cobra alias for back-compat — old scripts still work.organizations create --file body.json→POST /api/v1/organizations/organizations update --file body.json→PUT /api/v1/organizations/organizations delete --confirm→DELETE /api/v1/organizations/users delete-account --confirm→DELETE /api/v1/users/delete_account--confirm gate
The two destructive endpoints require a literal
--confirmflag. Without it, the command errors out and never hits the network — verified by tests. This is a new pattern in the CLI; if accepted here it could be applied to other destructive verbs in a follow-up.Coverage status (after merge)
Independent of PRs #59, #60, #61, #62. Merge order doesn't matter.
Test plan
go test ./...passes (8 new tests, including --confirm gate assertions)go buildclean--helprenders for all new commands;deleteshows--confirmrequirementorganizations list(hidden) still works as alias ofgetorganizations getagainst any org (read-only, safe)organizations deleteorusers delete-accountagainst any real account — there is no recovery path🤖 Generated with Claude Code