GLM-5.3 · 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
- 2 of 10
- Comments published
- 5
- Comments matching a bug
- 2
- Comments not matching
- 3
- Cost of this PR
- $1.213
Published comments (5)
Public group members page silently hides members beyond first 50 — Add next/previous controls like the admin page, or restore the unbounded listing for this consumer.
`automatic` resolves against member context, not group; remove icon shown for automatic groups — Since `automatic` is undefined on the member context, the remove icon appears even for automatic groups, where the server always rejects removal with 422. Resolve the flag against the group, e.g. `controller.automatic`, so the icon only renders when removal can succeed.
Stale offset after member removal can reload an empty members page — After removing the only member on the last page, `findMembers` reloads with the stale `offset`, so the server returns an empty list and the UI shows a blank page. Reset the offset when the current page empties or clamp it against the freshly returned `meta.total`.
Group member add/remove failures are silently swallowed — When the server rejects the request, the unhandled promises in `removeMember` and `addMembers` swallow the error, so the admin gets no feedback and the list silently stays unchanged. Add a rejection handler that displays the error, as the replaced save flow did.
add_members raises RecordNotUnique when adding an existing member — The unique index on `group_users` means `group.add(user)` raises `ActiveRecord::RecordNotUnique` — a 500 — whenever a username is already a member, and nothing on the client prevents resubmitting one. Guard each add with a membership check or reuse the diffing semantics of the old `Group#usernames=` setter.