Skip to content

Changed member welcome email job to run based on config#16

Open
tomerqodo wants to merge 6 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_changed_member_welcome_email_job_to_run_based_on_config_pr246from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_changed_member_welcome_email_job_to_run_based_on_config_pr246
Open

Changed member welcome email job to run based on config#16
tomerqodo wants to merge 6 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_changed_member_welcome_email_job_to_run_based_on_config_pr246from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_changed_member_welcome_email_job_to_run_based_on_config_pr246

Conversation

@tomerqodo
Copy link
Copy Markdown

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#246


Note

Shifts welcome email gating from a labs flag to a config key and aligns outbox/job behavior and tests.

  • Replaces labs.isSet('welcomeEmails') with config.get('memberWelcomeEmailTestInbox') in MemberRepository.create and the welcome email job scheduler
  • Outbox MemberCreatedEvent now added when config is set or when source is member; skipped if config is unset or source is disallowed (import, admin, api)
  • Schedules process-member-welcome-emails every 5 minutes only when the config key is present and not running tests
  • Updates integration/unit tests to use configUtils and config.get stubs, asserting new conditions and payloads (timestamp, source)

Written by Cursor Bugbot for commit 96cac63. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

}

if (!hasScheduled.processOutbox && !process.env.NODE_ENV.startsWith('test')) {
if (hasScheduled.processOutbox && !process.env.NODE_ENV.startsWith('test')) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inverted condition prevents job from being scheduled

High Severity

The condition was changed from !hasScheduled.processOutbox to hasScheduled.processOutbox, inverting the logic. Since hasScheduled.processOutbox is initialized to false, the condition hasScheduled.processOutbox && ... is always false, so jobsService.addJob() is never called and the welcome email processing job is never scheduled.

Fix in Cursor Fix in Web

if (this._labsService.isSet('welcomeEmails') && WELCOME_EMAIL_SOURCES.includes(source)) {
var member;
const welcomeEmailConfig = config.get('memberWelcomeEmailTestInbox');
if (welcomeEmailConfig || WELCOME_EMAIL_SOURCES.includes(source)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong operator breaks source filtering for outbox entries

High Severity

The condition was changed from && to ||, breaking source filtering. The original logic required BOTH the feature flag AND an allowed source. With ||, when welcomeEmailConfig is truthy, outbox entries are created for ALL member sources (including import, admin, api) instead of only the 'member' source, contradicting the test expectations.

Fix in Cursor Fix in Web

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