Skip to content

Ensure that announcement emails are not re-sent - #1905

Open
becky-gilbert wants to merge 3 commits into
developfrom
announcement-email-query
Open

Ensure that announcement emails are not re-sent#1905
becky-gilbert wants to merge 3 commits into
developfrom
announcement-email-query

Conversation

@becky-gilbert

Copy link
Copy Markdown
Contributor

This PR ensures that announcement emails are not resent if there's a failure/crash from when the message row is first created and when the timestamp is saved to that row.

Previously, if a message row existed for a given study/user/child then that would be excluded from the list of potential email targets unless the timestamp for the message is NULL. Therefore there was a chance that we would send out duplicate emails if the original attempt was successful and the problem occurred at some point between the communication with SendGrid and the message row's timestamp update in the database. This PR changes the query so that we treat any message rows with NULL timestamps as 'sent', i.e. erring on the side of not sending an email vs sending duplicates. We can always cross-reference any NULL message rows with SendGrid to see whether or a particular attempt was successful.

This also adds tests for the NULL-timestamp-as-sent case, and for two other gaps in our test coverage:

  • A given message row should only impact that exact study/user/child combination
  • Inactive user accounts should be excluded as potential email targets

…e a message line exists, even if sent_timestamp is NULL, to ensure that same email is never resent
… without an existing message row that has a NULL timestamp
… row should only exclude that specific study/family/child combination from potential targets; inactive users should be excluded as potential targets
@becky-gilbert becky-gilbert linked an issue Jul 16, 2026 that may be closed by this pull request
@becky-gilbert becky-gilbert self-assigned this Jul 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

Bug: multiple announcement emails for same study/user/child?

1 participant