fix(addie): use organization_memberships in prospect-claim admin lookup#3801
Merged
fix(addie): use organization_memberships in prospect-claim admin lookup#3801
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Slack prospect-claim button handler (
handleProspectClaiminserver/src/addie/bolt-app.ts) queried a non-existentorg_membershipstable when verifying the claimer's admin status. The actual table isorganization_memberships. Production was 500ing on every claim attempt: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 --noEmitcleanprospect_ownerand an ephemeral confirmation is posted (verify after deploy)🤖 Generated with Claude Code