Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Rename workspaces actor param to actingUserId (PR 1 of 3) - #35

Merged
Tsabary merged 1 commit into
mainfrom
feat/workspaces-acting-user-rename
Aug 24, 2026
Merged

Rename workspaces actor param to actingUserId (PR 1 of 3)#35
Tsabary merged 1 commit into
mainfrom
feat/workspaces-acting-user-rename

Conversation

@Tsabary

@Tsabary Tsabary commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Mirrors sublay-io/server-hosted#125. Merge after the server PR.

What

Renamed the acting-user param userIdactingUserId across 14 workspace modules, matching the convention this repo already uses in src/modules/chat/ (addMember, removeMember, changeMemberRole, createDirectConversation).

14 modules, not 10. Four endpoints — updateWorkspace, updateWorkspaceInheritFlag, deleteWorkspace, transferWorkspaceOwnership — take their actor from the capability middleware rather than their own controller. The server PR changes that middleware to read actingUserId, so leaving these four on userId would have silently broken the service-key act-as-user path on them.

Untouched: createWorkspaceInvite's invitee userId, and every targetUserId.

Caveat worth knowing

On those same four endpoints the field is currently discarded — the guard grants a key full authority before it resolves the named user. PR 2 fixes it; the docs PR carries warnings in the meantime. Renaming them now is still correct: it keeps the wire contract consistent so PR 2 only has to change behavior, not names.

Verification

421 tests passing, tsc --noEmit clean, tsup build (ESM/CJS/DTS) succeeds.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements

    • Standardized workspace operations to identify the user performing an action with the actingUserId field.
    • Updated workspace creation, editing, deletion, membership, ownership, invitation, and authority workflows to use the consistent field name.
    • Invitation target identification remains unchanged.
  • Tests

    • Updated workspace coverage to validate the standardized acting-user information across supported operations.

Mirrors server commit ecf63b6. Workspaces was the only bundle naming the
acting user `userId`; this repo already used `actingUserId` in its chat
modules, so workspaces was the outlier here too.

Renamed across 14 modules — four more than the server's controller count.
updateWorkspace, updateWorkspaceInheritFlag, deleteWorkspace and
transferWorkspaceOwnership take their actor from requireWorkspaceCapability's
resolveActor rather than their own controller, so the server's middleware
change means leaving them on `userId` would have silently broken the
service-key act-as-user path on those endpoints.

createWorkspaceInvite's invitee `userId` and all targetUserId params are
untouched.

Part 1 of 3 (plan-workspace-rank-ergonomics.md).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 021cc0df-dd04-4bd0-ae99-220279de70d7

📥 Commits

Reviewing files that changed from the base of the PR and between cad9d09 and 9858db0.

📒 Files selected for processing (15)
  • __tests__/workspaces.test.ts
  • src/modules/workspaces/acceptWorkspaceInvite.ts
  • src/modules/workspaces/createWorkspace.ts
  • src/modules/workspaces/declineWorkspaceInvite.ts
  • src/modules/workspaces/deleteWorkspace.ts
  • src/modules/workspaces/fetchManyWorkspaces.ts
  • src/modules/workspaces/fetchMyWorkspaceInvites.ts
  • src/modules/workspaces/fetchWorkspaceAuthority.ts
  • src/modules/workspaces/leaveWorkspace.ts
  • src/modules/workspaces/removeWorkspaceMember.ts
  • src/modules/workspaces/removeWorkspaceMemberFromSubtree.ts
  • src/modules/workspaces/transferWorkspaceOwnership.ts
  • src/modules/workspaces/updateWorkspace.ts
  • src/modules/workspaces/updateWorkspaceInheritFlag.ts
  • src/modules/workspaces/updateWorkspaceMember.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Workspace module inputs and HTTP request fields now use actingUserId for the authenticated actor. Workspace tests were updated across lifecycle, membership, invitation, authority, and response-mapping scenarios.

Changes

Workspace identity migration

Layer / File(s) Summary
Workspace request contracts and payloads
src/modules/workspaces/*
Workspace operation interfaces and request payloads or query parameters now use actingUserId.
Workspace request and response test updates
__tests__/workspaces.test.ts
Tests now provide and assert actingUserId across workspace operations. Invitation target userId behavior remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9858d

This PR standardizes the workspace acting-user parameter name without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: renaming the workspace actor parameter to actingUserId.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/workspaces-acting-user-rename

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Tsabary Tsabary self-assigned this Aug 24, 2026
@Tsabary
Tsabary merged commit a073445 into main Aug 24, 2026
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant