feat(web,api,auth): people-tab pending invites + member management (#275)#278
Conversation
|
CodeRabbit (@coderabbitai) review |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-web | f9bdbd1 | Commit Preview URL Branch Preview URL |
Jul 20 2026, 12:48 AM |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughPending invite listing and revocation, member removal, and role updates now span auth routes, API helpers, ChangesAuth management
API management
Web client contracts
People tab controls
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant PeopleTab
participant MeRoutes
participant OrgWorkspaceHelpers
participant AuthInternalRoutes
PeopleTab->>MeRoutes: authenticated invite or member request
MeRoutes->>OrgWorkspaceHelpers: invoke workspace operation
OrgWorkspaceHelpers->>AuthInternalRoutes: internal organization request
AuthInternalRoutes-->>OrgWorkspaceHelpers: result or status error
OrgWorkspaceHelpers-->>MeRoutes: mapped result
MeRoutes-->>PeopleTab: workspace response
Possibly related PRs
Suggested labels: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-auth | 9a5abf6 | Commit Preview URL Branch Preview URL |
Jul 20 2026, 12:41 AM |
… queries /simplify pass on #275: - extract loadTargetMember() in internal-routes.ts (was duplicated verbatim across the remove-member and change-role routes; removes drift risk on the self/owner-protection ordering) - Promise.all the independent target/invite + actorRole lookups in the three mutating internal routes (one fewer sequential D1 round-trip per request; check ordering and response codes unchanged) - drop the redundant `ok` param from manageResultFor (derivable from status) No behavior change. auth 52/52, web api-client 32/32, full suite 1672/1672.
✅ Action performedReview finished.
|
Closes #275. Follow-up to #274, which added a read-only member list to the workspace people tab. This adds pending-invite listing with revoke, and member management (remove, change role) — all admin/owner-gated, on the user-facing
/account/workspaces/:name/peoplesurface only.Permission matrix
Enforced in the auth worker (it owns the
member/invitationtables); the/meAPI layer only coarse-gates (adminWorkspaceOr403= admin|owner) and passesactorUserId.memberadminownermember→admin/ demoteadmin→memberThe
owneris immutable and unremovable (exactly one, set at provision), so "the last owner is never removed/demoted" holds without a counting query. The #260 last-admin guard protects the globaladmin()plugin, not org members, so this ships its own protections. Role changes are limited toadmin↔member;owneris never a role-change source or target.What's in it, per layer
apps/auth/src/internal-routes.ts) — 3 new internal routes (DELETE …/invites/:id,DELETE …/members/:memberId,PATCH …/members/:memberId), each enforcing the matrix via a sharedactorRolehelper. Direct drizzle,errorJsonshape.apps/api) —org-workspaceshelpers (invitesForOrg/revokeInvite/removeMember/updateMemberRole) mapping auth errors to@uploads/errors, plus 4adminWorkspaceOr403+allowWrite-gated/meroutes. The members list now exposes the opaquemember.idonly to admin/owner callers — regular members keep today's sanitized payload with no handle.apps/web) — api-client calls, escaped render helpers (renderInvitesHtml+ per-row controls inrenderMembersHtml), and people-tab wiring: a Pending-invites section with revoke, and per-member roleselect+ remove, suppressed on owner rows and your own row.confirm()on destructive actions; server is the real gate.Management targets
member.id, never the globaluserId.Testing
@uploads/api+@uploads/authtypes clean;@uploads/webtypecheck 0 errors/0 warnings; oxfmt clean.Notes
@uploads/auth,@uploads/api,@uploads/webare all on the changeset ignore list (Workers-deployed); a changeset would be release poison.docs/superpowers/.me.ts. Can fold into a follow-up.Summary by CodeRabbit