-
Notifications
You must be signed in to change notification settings - Fork 2
Add daily registration digest email (QUI-785) #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4cae85e
bd8322e
b8f7a91
5ca2184
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,22 @@ class Agent(Base): | |
| created_at: Mapped[str] = mapped_column(String(64)) | ||
|
|
||
|
|
||
| class DigestState(Base): | ||
| """Single-row marker for the registration digest scheduler. | ||
|
|
||
| Holds the ISO-8601 UTC timestamp (``…+00:00``) of the last successful send. | ||
| The date prefix drives once-per-day idempotency across restarts; the full | ||
| timestamp is the ``new_since`` boundary, so a registrant who signs up later on | ||
| the send's own day is still counted next time. The row is created on first | ||
| send and its ``id`` is always ``1``. | ||
| """ | ||
|
|
||
| __tablename__ = "digest_state" | ||
|
|
||
| id: Mapped[int] = mapped_column(Integer, primary_key=True) # always 1 | ||
| last_sent_at: Mapped[str | None] = mapped_column(String(32), nullable=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Severity: low 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Declining this one. last_sent_at is always datetime.now(UTC).isoformat(), which is deterministically <=32 chars ("YYYY-MM-DDTHH:MM:SS.ffffff+00:00" = exactly 32), so String(32) fits by construction — there is no format variation to truncate. Enlarging it would also require another manual prod migration (create_all does not ALTER existing tables) for no functional gain. |
||
|
|
||
|
|
||
| class Job(Base): | ||
| __tablename__ = "jobs" | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DIGEST_HOUR_UTCis parsed as an int but isn’t validated to a 0–23 range, so misconfiguration can silently prevent sends or change the schedule in surprising ways. Consider validating/clamping early so ops failures are loud and diagnosable.Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5ca2184. config now rejects DIGEST_HOUR_UTC outside 0–23 at import with a clear ValueError.