Repository navigation
app/: staff commands ported from the Loco server (user:set-staff, org:add-member, org:set-plan, org:delete, stripe:setup) (sc-8900) - #146
Merged
Conversation
…t-staff, org:add-member, org:set-plan, org:delete, stripe:setup (sc-8900) Co-authored-by: Claude <noreply@anthropic.com>
…nections (sc-8900) Co-authored-by: Claude <noreply@anthropic.com>
ndbroadbent
force-pushed
the
app-staff-commands
branch
from
December 3, 2026 18:53
ebd1fb4 to
91bb33f
Compare
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.
This ports the Loco server's staff tasks (
git show 0788198^:server/src/tasks/...) to Laravel Rust commands inapp/src/console/staff.rs, registered inwith_commands. It is PR (b) of the staff tooling work. It doesn't depend on #145 (/mcp/admin).Arguments are the old ones as clap options: Loco's
email:xbecomes--email x.user:set-staff --email <addr> --staff <true|false>users.staff. Email matching ignores case.no user …), or--staffthat isn't true/falseorg:add-member --org <slug> --user <email or forge login> [--role admin|member|read]source = staff, or takes over an existing membership: sets the role and sourcestaff, and clearssynced_atso the forge sync leaves it alone. A new member gets the "added to org" email once, as the oldgrantdid. Role defaults tomember.org:set-plan --org <slug> --plan <free|team|staff>org:delete --org <slug>no organization)stripe:setupbilling::stripe::ensure_catalog(products, prices, portal configuration)Tests:
app/tests/staff_commands.rscovers each command's change, a repeat run, and each refusal. Writing them caught a NULL-decoding bug in the user lookup, fixed here. Stripe's API calls (deleting a customer, the catalog) aren't exercised; the tests cover the refusals that come before them.Gates (build box):
cargo fmt --all --check,cargo clippy --locked --workspace --all-targets -- -D warningsandcargo test --locked --workspaceall pass. One earlier run had 5api_buildsfailures that didn't recur on the rerun and aren't in code this PR touches; I didn't keep their panic messages.Docs: docs/deploy.md's Commands section lists the commands, replacing the "no app/ command: … by hand" note that #132 added.
VisualCI build: no visual or JSON changes expected.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review fix (second commit)
user:set-staff --staff falsenow revokes the user's OAuth connections that hold theadminscope (revoke_admin_connections). It marks the connection (family) revoked, so its access and refresh tokens stop working, and so does a code not yet exchanged for tokens. Theirmcpconnections are left alone. The command prints how many it revoked./mcp/admin(#145) already re-checksusers.staffon every call, so this is defence in depth: the tokens themselves become useless. Before #145 there are no admin tokens to revoke.Test:
user_set_staff_false_revokes_admin_connectionscovers an admin token, an mcp token and a pending admin code. The admin token and the code are revoked, the mcp one isn't, and a second run revokes 0.Gates on the build box: fmt, clippy
-D warningsandcargo test --locked --workspaceall pass.