plane icon indicating copy to clipboard operation
plane copied to clipboard

[bug]: Project member list API does not expose the membership ID required for retrieve/update/delete

Open wet6123 opened this issue 1 month ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current behavior

The public REST API's project member list endpoints do not expose the project membership ID required by the detail endpoints.

  • GET /api/v1/workspaces/{slug}/projects/{project_id}/project-members/ returns user profiles, where id is User.id.
  • The /members/ alias behaves the same way.
  • GET /api/v1/workspaces/{slug}/projects/{project_id}/project-members-lite/ also returns the user ID: its serializer explicitly maps id to member.id.
  • However, GET, PATCH, and DELETE on /project-members/{id}/ (and /members/{id}/) look up ProjectMember by its primary key, so they require ProjectMember.id, not User.id.

As a result, a client cannot discover the membership ID for an existing project member through these public member list endpoints, and cannot use the returned user ID to retrieve, update, or remove that membership.

Creating a member with POST does return ProjectMember.id, but that does not solve discovery for existing memberships. The detail GET also returns a user profile rather than the ProjectMemberSerializer response declared in its OpenAPI annotation.

Steps to reproduce

  1. Use a project containing an existing member, with sufficient permissions to read and manage project members.
  2. Call GET /api/v1/workspaces/{slug}/projects/{project_id}/project-members/.
  3. Take the member's id from the response. This is the user's UUID.
  4. Call GET /api/v1/workspaces/{slug}/projects/{project_id}/project-members/{returned_id}/, or attempt a role update with PATCH on that URL.
  5. The backend searches for ProjectMember.pk = returned_id, although the supplied ID identifies a User. The intended membership cannot be resolved unless the two distinct record IDs happen to match.
  6. Calling project-members-lite/ does not provide the missing membership ID either.

This report is based on source inspection; a live HTTP reproduction and its exact error status have not been verified.

Expected behavior

Public project member list responses should expose both the user ID and the membership ID, allowing clients to list existing members and then retrieve, update, or remove a selected membership.

One backward-compatible approach would be to keep the existing user id and add an explicit project_member_id field to both list endpoints. The detail GET response and its OpenAPI schema should also agree about the IDs and fields returned.

Source evidence

Inspected repository commit: 7466675e471efe1c96b122615f7a0d30c9b2eb05.

Related: #8631 requests public project membership mutation support. This report concerns the distinct ID mismatch/discovery problem in the existing endpoints.

Environment

Repository source inspection; deployment environment not specified.

Browser

Not applicable (REST API).

Edition

Community repository.

Version

Repository commit 7466675e471efe1c96b122615f7a0d30c9b2eb05; deployed version not specified.

wet6123 avatar Oct 07 '26 04:10 wet6123

Hi! I’d like to work on this issue.

I’ve reviewed the current public project-member API implementation and confirmed the ID mismatch between the list endpoints and the detail endpoints. I’ll prepare a focused fix that preserves the existing user id while exposing the corresponding project membership ID, and I’ll add contract tests covering the list/detail flow and both member endpoint variants.

I’ll keep the change scoped to this API contract issue.

faizansaiyed123 avatar Oct 07 '26 05:10 faizansaiyed123