Skip to content

PM-2648: Send copilot application emails to PMs#865

Merged
jmgasper merged 1 commit into
developfrom
PM-2648
Jun 17, 2026
Merged

PM-2648: Send copilot application emails to PMs#865
jmgasper merged 1 commit into
developfrom
PM-2648

Conversation

@jmgasper

Copy link
Copy Markdown
Collaborator

What was broken
PM users and opportunity creators could miss email notifications when a copilot applied for an opportunity.

Root cause
The apply handler resolved PM role subjects and the opportunity creator inline with application creation, so recipient lookup failures could suppress all application emails. It also reused the role subject list directly and did not wait for email bus event submissions.

What was changed
Added a dedicated notification flow that resolves PM role subjects and the opportunity creator, filters recipients without emails, deduplicates recipients by email, logs lookup or send failures without blocking the application response, includes the applicant handle, and awaits external email bus event submissions.

Any added/updated tests
Added unit coverage for PM and creator notification events, including the fallback path where the creator is still notified if PM role lookup fails.

Validation run:

  • NODE_ENV=test DB_SCHEMA_NAME=public node node_modules/mocha/bin/_mocha --timeout 10000 --require babel-core/register --require ./src/tests src/routes/copilotOpportunityApply/create.spec.js --exit
  • NODE_ENV=test DB_SCHEMA_NAME=public node node_modules/eslint/bin/eslint.js src/routes/copilotOpportunityApply/create.js src/routes/copilotOpportunityApply/create.spec.js
  • NODE_ENV=test DB_SCHEMA_NAME=public npm run build

Full npm test was attempted with DB_SCHEMA_NAME=public, but it stops in npm run lint on pre-existing unrelated lint errors across legacy copilot/project files before reaching DB, ES, or mocha.

What was broken
PM users and opportunity creators could miss email notifications when a copilot applied for an opportunity.

Root cause
The apply handler resolved PM role subjects and the opportunity creator inline with application creation, so recipient lookup failures could suppress all application emails. It also reused the role subject list directly and did not wait for email bus event submissions.

What was changed
Added a dedicated notification flow that resolves PM role subjects and the opportunity creator, filters recipients without emails, deduplicates recipients by email, logs lookup or send failures without blocking the application response, includes the applicant handle, and awaits external email bus event submissions.

Any added/updated tests
Added unit coverage for PM and creator notification events, including the fallback path where the creator is still notified if PM role lookup fails.
@jmgasper jmgasper merged commit ba8e43a into develop Jun 17, 2026
1 check passed
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