Repository navigation
[DT-4263][1/7] Record a send id on each email row - #3149
Open
kevinmarete wants to merge 4 commits into
Open
kevinmarete wants to merge 4 commits into
kevinmarete wants to merge 4 commits into
Conversation
Every email a request writes now carries that request's send_id, so the email log can group a send exactly instead of inferring it from timestamps. Emails written outside a request, and every row before this change, keep a null send_id and fall back to the existing rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sendDailyMessages runs the expiration notices and both digests on an executor, outside the request filter, so those rows were written with no send id. Each job now runs under its own through EmailSendId.run. Also gives the filter an explicit priority, and drops the constructor that let an insert omit the send id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kevinmarete
marked this pull request as ready for review
October 10, 2026 05:31
kevinmarete
requested review from
otchet-broad and
rushtong
and
a balanced review from Copilot
and removed request for
a team
October 10, 2026 05:31
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Addresses
https://broadworkbench.atlassian.net/browse/DT-4263
Security risk: low — adds a nullable
send_idcolumn toemail_entity, filled with a random per-request UUID; no change to who receives email or who can read it.Summary
email_entityhas one row per recipient and nothing linking the rows of one send, so the email log (#3142) has to infer sends from a 10-minute gap between timestamps. Code review kept finding cases that inference gets wrong: overlapping batches, chains of repeat emails, sends split by the date range. This records the grouping when the emails are written instead.ThreadLocaland cleared on the response.EmailService.sendMessagewrites it on every row it inserts.send_id, email type and entity reference, and no send loop has to change.send_idnull. The email log will keep the current timestamp rule for those rows.EmailNotifierResource.sendDailyMessages, which submits the expiration notices and both digests to an executor. Each of those jobs runs under its own send id throughEmailSendId.run. The other executors (dashboards, dataset cleanup, reindexing) send no email.testFetchByCreateDate_with_limit_and_offsetto UTC: it read the local date but built UTC midnights, so it failed between 8pm and midnight Eastern.#3142 will switch its grouping to
send_idwhere it's set once this merges.Have you read CONTRIBUTING.md lately? If not, do that first.
🤖 Generated with Claude Code