Repository navigation
Conversation
This was referenced Dec 2, 2026
This branch has not been deployed
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.
The alert digest gets its selection: for a given moment, every user whose digest is due, the window of time it covers, and the new alerts it lists, grouped by project. This is a pure read. Nothing calls it yet; the email and the job that sends it come in the changes above. The selection is Bencher Plus only.
What changes
daily, they are not locked, and the end of their window has passed their mark (digest_through). Their send time is the latest moment at or before now when the clocks in their time zone strike theirdigest_hour. The window ends 1 hour before that send and starts at their mark. A user whose mark has already reached the end of the window is not due, which covers a user who signed up just before the hour. A mark 3 days old opens a 3 day window, so a server that was down at a user's hour sends the missed alerts at the next one.Asia/Kolkatais 03:30 UTC. A zone that skipped a whole date looks one more day back. The math isTimeZone::struckinbencher_valid.[start, end), and is still active. An alert dismissed inside the window is not new. An alert created between the end of the window and the send is neither new nor outstanding; it is new in the next window.|value - limit| / |limit|, so alerts in different units compare. A limit of 0 is the worst. A tie goes to the older alert, then to the one written first. The rest are counted as "more".index_alert_project_createdfor each of the user's projects, and the outstanding count readsindex_alert_project_status_modified. A guard in each query keeps SQLite on the right index, with a comment that says why. A user with no live project skips the alert query.Tests
lib/bencher_schema/src/model/user/digest.rscovers, on seeded fixtures: the two edges of the window; an alert dismissed inside the window; a user in two organizations, and none of an organization they do not belong to; a deleted project and a deleted organization; an unclaimed project; a user set toneverand a locked user; a project past 8 alerts, ranked on both sides with a limit of 0 and ties, written out of order; the outstanding count only beside a new alert; archived dimensions; due users and their windows, including a user not yet due today and a 3 day window; and sends that follow the local clock across a skipped hour, a repeated hour, and a zone 30 minutes off UTC.bencher_validtests a send across a date that a zone skipped whole.This PR is the second of four for the alert digest. It sits on #1607, which adds the digest settings, and the stack sits on top of the changepoint layers (stack #1536). Next: #1609.