Skip to content

fix(slack): prevent incorrect deployer shown in deploy notifications#936

Open
billyvg wants to merge 2 commits intomainfrom
billy/feat-fix-slack-deploy-user
Open

fix(slack): prevent incorrect deployer shown in deploy notifications#936
billyvg wants to merge 2 commits intomainfrom
billy/feat-fix-slack-deploy-user

Conversation

@billyvg
Copy link
Copy Markdown
Member

@billyvg billyvg commented Jan 13, 2026

When GoCD sends a non-@sentry.io approved-by value (e.g., a system
username), getUser() was setting email to undefined, causing findUser()
to build an empty WHERE clause that returned the first user in the
database - often a former employee.

Changes:

  • Add isSentryEmail() check before calling getUser() in deploy notifications
  • Add guard in findUser() to return empty result when no valid params
  • Pass approvedBy as fallback to show raw GoCD username when Slack user
    not found (e.g., "admin has finished deploying" instead of wrong user)

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

When GoCD sends a non-@sentry.io approved-by value (e.g., a system
username), getUser() was setting email to undefined, causing findUser()
to build an empty WHERE clause that returned the first user in the
database - often a former employee.

Changes:
- Add isSentryEmail() check before calling getUser() in deploy notifications
- Add guard in findUser() to return empty result when no valid params
- Pass approvedBy as fallback to show raw GoCD username when Slack user
  not found (e.g., "admin has finished deploying" instead of wrong user)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.29%. Comparing base (c713794) to head (43c727c).

Files with missing lines Patch % Lines
src/brain/gocd/notifyOnGoCDStageEvent/index.ts 80.00% 1 Missing ⚠️
src/utils/db/findUser.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #936   +/-   ##
=======================================
  Coverage   89.28%   89.29%           
=======================================
  Files         123      123           
  Lines        3828     3838   +10     
  Branches      786      790    +4     
=======================================
+ Hits         3418     3427    +9     
- Misses        376      397   +21     
+ Partials       34       14   -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@billyvg billyvg marked this pull request as ready for review January 13, 2026 01:16
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