Skip to content

[Teams] Fix team creation crash on free-text/Slack members#233

Merged
gregv merged 3 commits into
developfrom
claude/team-creation-flow
May 30, 2026
Merged

[Teams] Fix team creation crash on free-text/Slack members#233
gregv merged 3 commits into
developfrom
claude/team-creation-flow

Conversation

@gregv

@gregv gregv commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the team-creation flow crashing with "An unexpected error occurred" after a user adds team members.

  • NameError: SLACK_USER_ID_PREFIX is not defined — the constant never existed. Replaced with normalize_slack_user_id() (common/utils/oauth_providers.py), which builds the full oauth2|slack|{workspace}-{id} form and passes already-prefixed ids through safely.
  • Mixed-array member bugteamMembers is a freeSolo autocomplete array carrying BOTH Slack-user objects ({id, name, real_name}) AND raw free-text name strings. The old if "id" in member ran a substring test against strings: names containing "id" (Sidney/David/Madison) matched, then member["id"] raised TypeError; other free-text was silently dropped. Now guarded with isinstance(member, dict) + member.get(...). Only objects with a Slack id are invited to the channel / linked to users_list; free-text names are informational-only by design.

Pairs with frontend PR opportunity-hack/frontend-ohack.dev#308.

Test plan

  • Create a team selecting a Slack user from the dropdown — member is invited to the channel and linked.
  • Create a team typing a free-text name (e.g. "David") — no crash; name is informational, not linked.
  • python -m py_compile api/teams/teams_service.py passes.

🤖 Generated with Claude Code

gregv and others added 3 commits May 30, 2026 14:25
queue_team's member loop used `if "id" in member`, a substring test
against the mixed string/object teamMembers array (freeSolo picker):
free-text names containing "id" matched then raised TypeError, others
were silently dropped. Guard with isinstance(member, dict) + .get("id").
Also replaces the undefined SLACK_USER_ID_PREFIX with
normalize_slack_user_id() (NameError that broke the whole flow).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gregv gregv merged commit cfcd124 into develop May 30, 2026
4 checks passed
@gregv gregv deleted the claude/team-creation-flow branch May 30, 2026 21:49
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.

1 participant