Skip to content

fix(addie): use organization_memberships in prospect-claim admin lookup#3801

Merged
bokelley merged 2 commits intomainfrom
bokelley/fix-org-memberships
May 2, 2026
Merged

fix(addie): use organization_memberships in prospect-claim admin lookup#3801
bokelley merged 2 commits intomainfrom
bokelley/fix-org-memberships

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 2, 2026

Summary

The Slack prospect-claim button handler (handleProspectClaim in server/src/addie/bolt-app.ts) queried a non-existent org_memberships table when verifying the claimer's admin status. The actual table is organization_memberships. Production was 500ing on every claim attempt:

relation "org_memberships" does not exist
  at handleProspectClaim (file:///app/dist/addie/bolt-app.js:2043:28)

Bug introduced in #1196 (prospect triage feature, Feb 2026); the typo went unnoticed because the admin-only path is rarely exercised in tests.

Test plan

  • tsc --noEmit clean
  • Pre-commit unit tests pass
  • In Slack, click "Claim" on a prospect notification — confirm the user is set as prospect_owner and an ephemeral confirmation is posted (verify after deploy)

🤖 Generated with Claude Code

bokelley and others added 2 commits May 1, 2026 20:42
The Slack prospect-claim handler queried `org_memberships`, which doesn't
exist — the actual table is `organization_memberships`. Claiming an
enterprise prospect via the action button was 500ing in production.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The is_admin flag computed by the lookup query was never read, so any
linked Slack user could have claimed a prospect once the table-name fix
made the query succeed. Now non-admins get an ephemeral rejection and
the attempt is logged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit e7ffef0 into main May 2, 2026
18 checks passed
@bokelley bokelley deleted the bokelley/fix-org-memberships branch May 2, 2026 00:53
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