Skip to content

CROSSLINK-269 Email pullslips#624

Open
JanisSaldabols wants to merge 6 commits into
mainfrom
CROSSLINK-269
Open

CROSSLINK-269 Email pullslips#624
JanisSaldabols wants to merge 6 commits into
mainfrom
CROSSLINK-269

Conversation

@JanisSaldabols
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 1, 2026 09:30
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 PR introduces a new scheduled batch action (email-pullslips) that sends pull-slip emails (optionally with a merged PDF attachment) via AWS SES, and extends batch actions to persist arbitrary actionParams in the database and API.

Changes:

  • Added an EmailSenderService task handler that builds and sends raw MIME emails through AWS SES, optionally attaching a merged pull-slip PDF.
  • Extended scheduler batch actions to accept/store actionParams (JSONB) and renamed the email batch action from email / send-email to email-pullslips across API, events, and migrations.
  • Added a simple SES mock service for local testing and introduced AWS SDK v2 SES dependencies.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
illmock/ses/ses_mock.go Adds a local SES mock HTTP server to support testing with endpoint override.
broker/sqlc/sqlc.yaml Overrides batch_action.action_params Go type for sqlc generation.
broker/sqlc/sched_schema.sql Adds action_params JSONB column to batch_action.
broker/sqlc/sched_query.sql Persists action_params in SaveBatchAction.
broker/scheduler/service/email_sender.go Implements SES raw-email sending + MIME building + optional PDF attachment.
broker/scheduler/service/email_sender_test.go Adds unit tests for email data extraction, MIME building, and task handling.
broker/scheduler/api/api_handler.go Wires batch-action creation to email-pullslips and passes actionParams into task payload + DB record.
broker/scheduler/api/api_handler_test.go Updates tests to use email-pullslips action name.
broker/pullslip/service/pdf.go Refactors PDF service into an interface + concrete implementation for easier injection/mocking.
broker/pullslip/service/pdf_test.go Updates tests for the PDF service refactor.
broker/oapi/open-api.yaml Updates batch-action enum and adds actionParams schema.
broker/migrations/042_add_action_params.up.sql Adds action_params column and attempts to rename event name.
broker/migrations/042_add_action_params.down.sql Drops action_params column and attempts to revert event name.
broker/go.mod / broker/go.sum Adds AWS SDK v2 dependencies for SES integration.
broker/events/eventmodels.go Renames the email event constant to email-pullslips.
broker/app/app.go Initializes EmailSenderService and conditionally registers the new event handler.

Comment thread broker/scheduler/service/email_sender.go Outdated
Comment thread broker/scheduler/service/email_sender.go Outdated
Comment thread broker/scheduler/service/email_sender.go
Comment thread broker/migrations/042_add_action_params.up.sql Outdated
Comment thread broker/app/app.go Outdated
Comment thread broker/app/app.go Outdated
Comment thread illmock/ses/ses_mock.go Outdated
Comment thread broker/migrations/042_add_action_params.down.sql Outdated
Comment thread illmock/ses/ses_mock.go Outdated
Comment thread broker/migrations/042_add_action_params.down.sql Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 16 out of 17 changed files in this pull request and generated 3 comments.

Comment thread broker/app/app.go Outdated
Comment thread broker/sqlc/sqlc.yaml Outdated
Comment thread illmock/ses/ses_mock.go Outdated
Copilot AI review requested due to automatic review settings June 1, 2026 13:37
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 16 out of 17 changed files in this pull request and generated 4 comments.

Comment thread broker/scheduler/api/api_handler.go
Comment thread broker/migrations/042_add_action_params.up.sql
Comment thread broker/migrations/042_add_action_params.down.sql
Comment thread illmock/ses/ses_mock.go Outdated
Comment thread broker/scheduler/service/email_sender.go
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 15 out of 15 changed files in this pull request and generated 4 comments.

Comment thread broker/scheduler/service/email_sender.go Outdated
Comment thread broker/scheduler/service/email_sender.go Outdated
Comment thread broker/scheduler/api/api_handler.go
Comment thread broker/README.md Outdated
EventNameSendNotification EventName = "send-notification"
EventNameCheckAvailability EventName = "check-availability"
EventNameSendEmail EventName = "send-email"
EventNameEmailPullslips EventName = "email-pullslips"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JanisSaldabols this is not wrong, but I sorta expected that all batch actions would have a generic invoke-batch-action event type like the regular actions have invoke-action and action name would go to the action custom data.

Comment thread broker/README.md
| `SMTP_PORT` | SMTP server port | `2525` |
| `SMTP_USERNAME` | Username for SMTP authentication | (empty value) |
| `SMTP_PASSWORD` | Password for SMTP authentication | (empty value) |
| `SMTP_FROM_ADDR` | Default sender address for outgoing emails | (empty value) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JanisSaldabols I don't think this makes sense because a single broken deployment will be shared across all tenants and each will likely want their from address. Use the directory email field instead.

ctx.Logger().Warn("email batch truncated: selector matched more records than the per-email limit",
"matched", fullCount, "limit", maxRecordsPerEmail)
}

Copy link
Copy Markdown
Contributor

@jakub-id jakub-id Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JanisSaldabols please replaceAll {{fullCount}}, {{actualCount}} and {{batchQuery}} in the email body with fullCount, limit and selector so we can template the email.


// maxRecordsPerEmail caps the number of patron requests fetched for a single
// email batch. Selectors matching more records will be truncated with a warning.
const maxRecordsPerEmail = 100
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JanisSaldabols can you make this configurable via env as BATCH_PULLSLIP_MAX_COUNT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants