Skip to content

feat(notifications): email published schedule assignment changes - #210

Open
theosiemensrhodes wants to merge 9 commits into
mainfrom
feat/schedule-assignment-notifications
Open

theosiemensrhodes wants to merge 9 commits into
mainfrom
feat/schedule-assignment-notifications

Conversation

@theosiemensrhodes

@theosiemensrhodes theosiemensrhodes commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Volunteers currently receive no email when an admin adds or removes them from a published schedule. Enqueue a normal jobs.notify-schedule-assignment job through JobService in the same transaction as the assignment change.

Use pg-boss's native cancellation to replace older pending/active notices sharing a schedule/volunteer singleton key. Hidden edits cancel older jobs without creating retroactive notices. The handler rechecks publication, account status and membership and prepares the email under short-lived domain locks in term/course/schedule/user order. It releases the database transaction, rechecks cooperative native cancellation, and then sends through SMTP. A slow SMTP connection therefore does not retain domain locks or an application database connection. pg-boss owns persistence, retry backoff and completion.

Depends on #209 and is restacked on its cancellation/validation fixes. This diff contains the assignment job, template, ClassService integration and tests. No additional database state, migration, worker framework or delivery registry.

Scope coordination: #219 owns the concurrent publication/edit locking and schedule ownership fixes; #216 owns per-shift assignment history and effective roster behavior. Those changes require integration with this ClassService delta rather than duplicate implementations here.

Validation on the combined stack: TypeScript and production build pass. All 10 test files outside coverage-service.test.ts pass; the full run has 117 passing tests and 21 existing failures caused by past-dated July 2026 coverage fixtures, which are unchanged from main. Assignment coverage includes real pg-boss add/remove email delivery, enqueue rollback, stale/rapid changes, draft term/class gating, hidden-edit cancellation, inactive users, net-zero saves, writable domain rows during stalled SMTP, and cancellation checks after releasing database locks.

Delivery remains at-least-once. SMTP acceptance followed by a crash before job completion can duplicate a message. Changes committing after the final state/cancellation checks can race a message entering SMTP; later edits cannot retract an in-flight email.

@theosiemensrhodes
theosiemensrhodes force-pushed the feat/schedule-assignment-notifications branch from d24506c to 96e00a4 Compare November 23, 2026 05:58
@theosiemensrhodes
theosiemensrhodes force-pushed the feat/schedule-assignment-notifications branch 3 times, most recently from 906937f to 4f28f77 Compare November 23, 2026 20:40
@theosiemensrhodes
theosiemensrhodes force-pushed the feat/schedule-assignment-notifications branch from 4f28f77 to ab78d28 Compare November 23, 2026 21:06
Signed-off-by: Theo Siemens-Rhodes <112789743+theosiemensrhodes@users.noreply.github.com>
Signed-off-by: Theo Siemens-Rhodes <112789743+theosiemensrhodes@users.noreply.github.com>
Signed-off-by: Theo Siemens-Rhodes <112789743+theosiemensrhodes@users.noreply.github.com>
Base automatically changed from feat/transactional-email-outbox to main November 23, 2026 22:33
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