-
Notifications
You must be signed in to change notification settings - Fork 2
feat: evidence notification digest #311
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
Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
fix: evidences should always expire fix: gather only the latest evidence chore: helper functions and commands Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
fix: messages should be debug Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
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.
Pull request overview
This pull request implements an evidence notification digest feature that allows users to receive scheduled email summaries of their evidence compliance status. The digest highlights evidence that requires attention (not-satisfied and expired items) and includes a scheduler infrastructure to support recurring jobs.
Changes:
- Adds a cron-based scheduler service with support for daily, weekly, and monthly jobs
- Implements a digest service that aggregates evidence statistics and sends HTML/text email digests to subscribed users
- Introduces new API endpoints for managing digest subscriptions and triggering/previewing digests manually
- Adds auto-expiration logic for evidence based on configurable default expiry months
- Updates the User model with a DigestSubscribed field to track subscription preferences
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/scheduler/scheduler.go | Defines the Scheduler interface and Job abstraction for scheduled tasks |
| internal/service/scheduler/cron.go | Implements the CronScheduler using robfig/cron library with thread-safe job management |
| internal/service/scheduler/scheduler_test.go | Provides unit tests for scheduler functionality |
| internal/service/digest/service.go | Core digest service with evidence aggregation, user filtering, and email sending |
| internal/service/digest/job.go | GlobalDigestJob implementation that wraps the digest service for scheduling |
| internal/service/digest/service_test.go | Unit tests for digest data structures |
| internal/service/email/templates/templates/evidence-digest.html | HTML email template for evidence digest |
| internal/service/email/templates/templates/evidence-digest.txt | Plain text email template for evidence digest |
| internal/service/relational/ccf_internal.go | Adds DigestSubscribed boolean field to User model |
| internal/api/handler/users.go | Adds GET/PUT endpoints for user digest subscription management |
| internal/api/handler/digest.go | Admin endpoints for manually triggering and previewing digests |
| internal/api/handler/evidence.go | Adds auto-expiration logic for new evidence based on config |
| internal/api/handler/api.go | Registers digest handler with admin authorization middleware |
| internal/config/config.go | Adds configuration fields for evidence expiry defaults and digest scheduling |
| cmd/run.go | Initializes email service, digest service, and scheduler on application startup |
| cmd/root.go | Registers environment variables and digest CLI command |
| cmd/digest.go | CLI commands for testing and previewing digest functionality |
| go.mod | Adds robfig/cron/v3 dependency |
| sso.yaml | Updates admin email mapping |
| sdk/integration_base_test.go | Updates RegisterHandlers call signature with new parameters |
| internal/api/handler/*_integration_test.go | Updates all integration tests for new RegisterHandlers signature |
| internal/api/handler/evidence_test.go | Updates EvidenceHandler constructor call |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
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.
Pull request overview
Copilot reviewed 29 out of 30 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
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.
Pull request overview
Copilot reviewed 31 out of 32 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.