issue-224-user-identity-admin-crud-gap.md
markdown
sha256:7281683f5c41e5d88b6d8811fbdafebd3e01a0c9dcd90975cfcb444ba71e8e81
docs: add local source-of-truth for musehub#225, #226, #227…
Sonnet 5
1 day ago
user/identity is missing full Rails-style CRUD (CLI/HTTP/MCP) — no admin delete, no CLI wrapper for self-delete
Background
Surfaced while cleaning up 3 throwaway agent identities registered on
staging during musehub#99 testing (ci-bot-demo-test-...,
ci-bot-check2-..., fix-check-bot-...). There is currently no way to
remove them.
This workspace's convention is that every muse object gets full
Rails-style CRUD exposed consistently across CLI, HTTP, and MCP
(singular-noun-then-verb naming — e.g. muse hub issue create/read/update/ delete, muse hub label create/list/update/delete). user/identity is
an outlier against that convention.
What exists today
Server-side (musehub/api/routes/musehub/users.py):
GET /users/{username}— read profilePOST /users— create profilePUT /users/{username}— update own profileGET /me/export— GDPR Article 20 data exportDELETE /me— GDPR Article 17 erasure, self-service only: scoped toclaims.identity_idfrom the caller's own auth token. Soft-deletes the identity, hard-deletes all its registered keys, soft-deletes owned repos.
CLI (muse hub user --help): only read and update subcommands exist.
No delete at all — not even wrapping the self-service DELETE /me.
Gaps
- No CLI/MCP wrapper for the existing self-service delete. A human or agent operating entirely through first-party tooling cannot exercise their own GDPR Article 17 right to erasure — the only path today would be a raw authenticated HTTP call.
- No admin-scoped delete-other-account capability. There is no
DELETE /users/{id}(or similar) for an admin/operator to remove an account that isn't their own — e.g. cleaning up test/spam/throwaway registrations, moderation actions, or offboarding. This is the specific gap that blocked cleaning up the 3 accounts above. - No
create/deleteCLI or MCP surface at all, symmetric with theread/updatethat already exist.
Scope
- Add
muse hub user delete [--handle <handle>](self, defaulting to the authenticated caller) wrapping the existingDELETE /me. - Design and implement an admin-scoped deletion path — likely
DELETE /admin/users/{id}or similar, gated by an admin capability check (see how other admin-only mutations in this codebase gate access, if any precedent exists; if none, this needs its own design decision on what "admin" means for a MuseHub instance). - Wire the admin path into
muse hub user delete --handle <other-handle>(or a distinctmuse hub admin user delete, if admin operations deserve a separate namespace — decide and be consistent). - Expose whatever lands here through MCP tooling too, per the existing CLI/HTTP/MCP parity convention.
- Decide whether
muse hub user createis worth adding for symmetry, or whether account creation should stay exclusively tied to thekeygen/registerauth flow (likely the latter — creating a "user" outside of key registration doesn't obviously make sense for an identity-is-a-keypair system). Document the decision either way so this doesn't get re-litigated.
Acceptance criteria
- A human can delete their own account through
muse hub user deletewithout touching raw HTTP. - An admin can delete a different account through some documented, capability-gated path.
- Both paths are documented in
muse/docs/agent-guide.md's Gitism Glossary / hub command reference, consistent with every other resource.
File History
1 commit
sha256:7281683f5c41e5d88b6d8811fbdafebd3e01a0c9dcd90975cfcb444ba71e8e81
docs: add local source-of-truth for musehub#225, #226, #227…
Sonnet 5
1 day ago