Repository navigation
Phase 2: scheduled supplier risk digest by email - #37
Merged
Merged
Conversation
Phase 2, fourth item: scheduled reports.
- Migration 021: report_schedules (daily / weekly on a day / monthly on the
1st, hour in UTC, member recipients, skip-empty, active, next and last
run, last status), forced RLS.
- The digest lists the period's new matches recorded by the webhook
detector: public records naming suppliers (one line per recall event,
linked to the source) and disaster exposures, with the same caution as
the app. HTML and plain text; all record text is escaped.
- The coordinator sends due reports on its 30 s loop: claimed with
FOR UPDATE SKIP LOCKED and moved forward before sending, so replicas
never double-send. Windows are (since, until] in database time, so an
event on the boundary is in exactly one report.
- Recipients must be active members, checked when saved and when sent.
- SMTP settings (SMTP_HOST, ...). Compose gets Mailpit (127.0.0.1:8025) so
development email never leaves the machine; staging reads optional
smtp-* keys from scirm-secrets.
- Administration > Integrations > Scheduled reports: create, send now,
pause/resume, delete, next run and last result. Audited.
- docs/scheduled-reports.md. Also fixes a "sql =(" left by an earlier edit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Phase 2, fourth item: scheduled reports.
What's new
Administration → Integrations → Scheduled reports (admins): a supplier risk digest by email.
It carries the same caution as the app ("matched by name or location, not findings").
How it works
report_schedules, with forced RLS.FOR UPDATE SKIP LOCKEDand moved forward before sending, so replicas never double-send.(since, until]in database time, so an event on the boundary appears in exactly one report.SMTP_HOST,SMTP_PORT,SMTP_USERNAME,SMTP_PASSWORD,SMTP_FROM,SMTP_STARTTLS). All record text is HTML-escaped.127.0.0.1:8025), so development email never leaves the machine.smtp-*keys fromscirm-secrets, so pods start without them.PUBLIC_APP_URLon the coordinator provides the link back to SCIRM.docs/scheduled-reports.md.Testing
tests/security/test_reports.py(18 tests):<script>); "nothing new"tests/db:report_scheduleshas forced RLS.tscclean,vite buildOK. Strict docs build OK.[since, until). On Windows the clock ticks every ~15 ms, so an event could share the run's timestamp and be dropped. That's fixed with(since, until]and database time, and covered by a test.Not built
🤖 Generated with Claude Code