Skip to content

feat(groups): pick members while creating a group#766

Merged
1 commit merged into
dataelement:mainfrom
liqingb0220-stack:feat/group-create-with-members
Jul 23, 2026
Merged

feat(groups): pick members while creating a group#766
1 commit merged into
dataelement:mainfrom
liqingb0220-stack:feat/group-create-with-members

Conversation

@liqingb0220-stack

Copy link
Copy Markdown
Contributor

Summary

Creating a group only accepted a name, so members and Agents could only be pulled in after the group already existed. This adds member selection to the create flow itself.

The invite API takes a participant_id, and the only endpoint exposing those ids (GET /{group_id}/member-candidates) requires an existing group — so the create dialog had no way to resolve them. That is why this touches the backend as well as the UI.

Backend

  • POST /api/groups accepts an optional member_participant_ids. The group and every initial member are staged in one transaction, so an invalid member rolls the whole thing back rather than leaving an empty group behind.
  • New GET /api/groups/member-candidates — tenant-scoped, for use before a group exists. Registered before /{group_id} so the literal path is not parsed as a group id. Excludes the creator, who joins as manager on create.
  • Invite validation extracted into _invitable_participant, shared by the create and invite paths, so Agent visibility for the inviter is enforced identically in both.

Fully backward compatible: omitting member_participant_ids reproduces the previous behaviour, and the existing per-group candidates and invite endpoints are unchanged.

Frontend

  • New CreateGroupModal replaces the name-only prompt: group name, Agent/member tabs, search, multi-select with a live selection count. Selection survives tab switches; the confirm button is disabled while the request is in flight.
  • Styled with the existing group modal tokens; verified in both light and dark themes.

Testing

  • pytest -k group — 207 passed, including 4 new cases: create-with-members, rollback on an invalid member, audit details recording the invited ids, and a regression guard that /member-candidates stays registered ahead of /{group_id}.
  • ruff check clean on the changed backend files.
  • npm run build (tsc strict) passes.
  • Manual end-to-end on a local v1.11.1 deployment: one POST creates a 3-member group; an invalid participant_id returns 400 with no group persisted; the UI flow creates the group and navigates into it with all members present.

Checklist

  • Tested locally
  • No unrelated changes included

Creating a group only took a name, so members and Agents could only be
added after the group already existed. The invite API accepts a
participant_id, and the only endpoint exposing those ids required an
existing group, so the create flow had no way to resolve them.

Backend:
- POST /api/groups accepts an optional member_participant_ids list and
  stages the group with its initial members in one transaction, so an
  invalid member rolls the whole group back instead of leaving an
  empty group behind.
- Add GET /api/groups/member-candidates, a tenant-scoped listing for
  the create flow, registered before /{group_id} so the literal path is
  not parsed as a group id. It excludes the creator, who joins as
  manager on create.
- Extract _invitable_participant so create and invite share the same
  validation, including Agent visibility for the inviter.

Frontend:
- Replace the name-only prompt with CreateGroupModal: name, Agent and
  member tabs, search, multi-select and a live selection count.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Y1fe1Zh0u added a commit that referenced this pull request Jul 22, 2026
The integration branch needs this pull request alongside the other v1.11.2 candidates without changing the original PR state.

Constraint: Preserve the source PR commit and merge in numeric order.
Confidence: high
Scope-risk: moderate
Related: #766
Tested: Git merge completed without unresolved conflicts
Not-tested: Combined backend and frontend suites pending
@Y1fe1Zh0u Y1fe1Zh0u closed this pull request by merging all changes into dataelement:main in 40c1f6b Jul 23, 2026
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.

2 participants