GPT-6.1 Sol · Balanced
fix-proper-handling-of-group-memberships-discourse-cursor
Discourse · Ruby · L · 300–799 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 4 of 10
- Comments published
- 4
- Comments matching a bug
- 4
- Comments not matching
- 0
- Cost of this PR
- $0.689
Published comments (4)
Default member limit truncates the public group membership page — Users cannot reach members beyond the first 50 because the `group-members` route fetches once and its template has no pagination controls. Add pagination to the public page alongside the default `limit` change.
Page count adds an empty page when member count is a multiple of the limit — With exactly 50 members and a limit of 50, `totalPages` enables Next to an empty page. Use `Math.ceil(user_count / limit)` and preserve the intended zero-member behavior.
Removing membership leaves the user's primary group reference intact — `PostSerializer.primary_group_name` can still identify the user with the removed group because `primary_group_id` remains unchanged. Clear the matching reference when removing membership, preserving the cleanup previously performed by `Group.destroy_deletions`.
Adding an existing group member violates the unique membership index — Retrying Add or including an existing member in a batch makes `Group.add` violate the unique `(group_id, user_id)` index. Skip existing memberships before insertion, preserving the set-difference behavior of `usernames=`.