Skip to content

accounts+frontend: user/team/session CRUD, RLS-scope fixes, settings - #2

Merged
AntoineToussaint merged 2 commits into
mainfrom
user-team-session-settings-crud
Jul 6, 2026
Merged

accounts+frontend: user/team/session CRUD, RLS-scope fixes, settings#2
AntoineToussaint merged 2 commits into
mainfrom
user-team-session-settings-crud

Conversation

@AntoineToussaint

@AntoineToussaint AntoineToussaint commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Generic saas-starter features flowed back from the warden-platform consumer.

Backend (accounts): UpdateUser honors the target uuid with a self-or-admin gate; new UpdateTeam/DeleteTeam + RevokeSession RPCs (proto + Go + connect handlers, regenerated). Systemic RLS fix: self-writes (consent, user settings, user CRUD) now wrap store.As(Identity).Within (team writes WithOrgTx, platform-admin session revoke WithBypass) so they stop silently no-op'ing under RLS. Also: UserSettings store used WHERE id instead of uuid; buf.gen go_package_prefix was stale (apiaccounts).

Frontend: user edit/delete dialogs, team rename/delete, session force-logout, notification-settings wired to the real UserSettings.notifications, settings mutation takes a MessageInitShape.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added team editing and deletion flows, plus platform session revocation.
    • Added user profile editing and user deletion actions.
    • Notification settings now let users manage delivery channels directly.
  • Bug Fixes

    • Improved reliability of user consent and settings updates.
    • Fixed team and user updates so changes save correctly.
  • UI Improvements

    • Added confirmation dialogs and action menus for destructive actions.
    • Updated forms and buttons to better reflect create/edit/save states.

…ke, settings

Backend (accounts): UpdateUser honors target uuid w/ self-or-admin gate; add
UpdateTeam/DeleteTeam + RevokeSession RPCs (proto + Go + connect handlers,
regenerated); fix RLS-scoping on self-writes (consent/settings/user CRUD now
wrap store.As(Identity).Within, team writes WithOrgTx, session revoke WithBypass)
so they don't silently no-op under RLS; fix UserSettings store using WHERE id vs
uuid; fix buf.gen go_package_prefix (api->accounts).

Frontend: user edit/delete dialogs, team rename/delete, session force-logout,
notification-settings wired to real UserSettings.notifications, settings mutation
takes a MessageInitShape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@slopbuster

slopbuster Bot commented Jul 6, 2026

Copy link
Copy Markdown

💳 Subscription Required

codefly-dev has used all free reviews this month.

Subscribe to continue

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AntoineToussaint, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 83b50df2-8faf-48b5-b691-2ffb294eaefb

📥 Commits

Reviewing files that changed from the base of the PR and between bac64ac and c521d18.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • module/tools/base-manifest.json
📝 Walkthrough

Walkthrough

Adds Team update/delete and platform session revocation across proto, OpenAPI, Go backend (handlers, business logic, Postgres store), plus frontend mutations/UI for team rename/delete, session force-logout, user edit/delete, and rewires notification settings to persist via backend user settings API. Also scopes several existing writes within identity-based transactions.

Changes

Backend: proto/API contracts and Go implementation for team & session management

Layer / File(s) Summary
Proto and OpenAPI contracts
module/services/accounts/proto/api.proto, module/services/accounts/proto/buf.gen.yaml, module/services/accounts/openapi/api.swagger.json
Adds UpdateTeamRequest/Response, DeleteTeamRequest, RevokeSessionRequest messages, corresponding TeamService/PlatformAdminService RPCs, mirrored REST paths and schema in swagger, and updates the Buf Go package prefix.
Store interface and Postgres implementation
.../business/store.go, .../infra/postgres_team.go, .../infra/postgres_user_settings.go
Adds UpdateTeam/DeleteTeam to Store and implements them in Postgres; fixes user settings queries to key off users.uuid instead of id.
Business service logic
.../business/teams.go, .../business/platform_admin.go, .../business/consent.go, .../business/user_settings.go, .../business/users.go
Implements Service.UpdateTeam/DeleteTeam and RevokeSession; scopes AcceptConsent, UpdateUserSettings, UpdateUser, and DeleteUser writes within identity-scoped transactions.
RPC and Connect handler wiring
.../adapters/rpcs.go, .../adapters/connect_handlers.go
Adds TeamServer.UpdateTeam/DeleteTeam and PlatformAdminServer.RevokeSession handlers with authorization checks; updates UserServer.UpdateUser to authorize the target UUID via requireSelfOrPlatformAdmin; forwards new methods through Connect handlers.

Estimated code review effort: 4 (Complex) | ~60 minutes

Frontend: team management, session revocation, user edit/delete, and notification settings UI

Layer / File(s) Summary
Notification settings backend wiring
.../notifications/ui/notification-settings.tsx, .../user-settings/service/mutations.ts
Replaces per-event checkboxes with a channel-based (in-app/push/sound) model persisted via React Query and userSettingsMutations.update, which now builds protobuf payloads via create/MessageInitShape.
Session revocation UI
.../platform/service/mutations.ts, .../platform/ui/sessions-page.tsx
Adds useRevokeSession mutation and a row-level "Force logout" action with confirmation dialog on the sessions table.
Team rename/delete UI
.../teams/service/mutations.ts, .../teams/ui/team-form.tsx, .../teams/ui/teams-page.tsx, .../teams/ui/teams-table.tsx
Adds update/remove team mutations, an edit mode for TeamForm, and rename/delete actions with confirmation dialogs wired into TeamsPage/TeamsTable.
User edit/delete UI
.../users/model/schemas.ts, .../users/service/mutations.ts, .../users/ui/delete-user-dialog.tsx, .../users/ui/edit-user-form.tsx, .../users/ui/users-page.tsx, .../users/ui/users-table.tsx
Adds editUserSchema, update/remove user mutations, new DeleteUserDialog/EditUserForm components, and wires edit/delete actions into UsersPage/UsersTable.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ConnectHandler as teamConnectHandler
  participant TeamServer
  participant Service
  participant Store as PostgresStore

  Client->>ConnectHandler: UpdateTeam(request)
  ConnectHandler->>TeamServer: UpdateTeam(ctx, req)
  TeamServer->>TeamServer: requireTeamAdmin(teamId)
  TeamServer->>Service: UpdateTeam(ctx, actorID, req)
  Service->>Service: resolveTeamOrg(teamId)
  Service->>Store: WithOrgTx -> UpdateTeam(teamId, name, description)
  Store-->>Service: updated Team
  Service-->>TeamServer: UpdateTeamResponse
  TeamServer-->>ConnectHandler: UpdateTeamResponse
  ConnectHandler-->>Client: Connect Response
Loading
sequenceDiagram
  participant Admin
  participant SessionsPage
  participant useRevokeSession
  participant PlatformAdminService

  Admin->>SessionsPage: click Force logout
  SessionsPage->>SessionsPage: set revokeTarget
  Admin->>SessionsPage: confirm in AlertDialog
  SessionsPage->>useRevokeSession: revoke.mutate({sessionId, reason})
  useRevokeSession->>PlatformAdminService: revokeSession(sessionId, reason)
  PlatformAdminService-->>useRevokeSession: success
  useRevokeSession->>useRevokeSession: invalidate ["sessions"]
  useRevokeSession-->>SessionsPage: toast success, clear target
Loading

Related issues: None specified.

Related PRs: None specified.

Suggested labels: backend, frontend, feature, api-change

Suggested reviewers: None specified.

🐰 A team renamed, a session cast out,
Delete or edit, the buttons now shout,
Uuid keys where ids once slept,
RLS scopes carefully kept,
Hop hop — the schema hops about!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@slopbuster

slopbuster Bot commented Jul 6, 2026

Copy link
Copy Markdown

💳 Subscription Required

codefly-dev has used all free reviews this month.

Subscribe to continue

…fest

The build matrix still pointed at the deleted module/services/api/code path
(renamed to accounts), so that job failed on a missing dir; point it at
accounts/code. Regenerate the base-file manifest for the edited base files so
base-integrity passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AntoineToussaint
AntoineToussaint force-pushed the user-team-session-settings-crud branch from d3c6599 to c521d18 Compare July 6, 2026 20:33
@slopbuster

slopbuster Bot commented Jul 6, 2026

Copy link
Copy Markdown

💳 Subscription Required

codefly-dev has used all free reviews this month.

Subscribe to continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant