31-May-2026 — persist scheduled-task history and fix Brevo daily-cap overflow release ref #127
Follow-on fixes to the Brevo daily-cap overflow release and scheduled-tasks
admin shipped in 6296d441.
Daily-cap queue and overflow release were failing
- campaignQueueSummary set the campaign-completion endDate to end-of-today,
which is in the future, so Brevo rejected the getEmailCampaigns call with
"End date should not be greater than current date". This broke both the
Daily-Cap Queue refresh and the overflow-release scheduled task (which calls
releasePendingCampaigns -> campaignQueueSummary). endDate is now "now".
NGX campaigns identified by stored id, not the Brevo tag
- This account's Brevo plan rejects campaign tags (405), so createCampaign's
tag-fallback strips the tag and campaigns come back untagged. The queue
matched NGX campaigns only by tag, so none were ever recognised and the
release released nothing. createCampaign now records each created campaign id
in the ngxBrevoCampaigns collection, and campaignQueueSummary matches on the
stored id OR the tag (tag kept as a fallback). Plan-independent.
Scheduled-task execution history now survives restarts
- Run history was held only in the in-memory task registry and was lost on
every server restart. Each run is now persisted to the scheduledTaskRuns
collection (capped at the most recent 20 per task) and reloaded when the task
registers at startup.
Scheduled-task failures surface the real error
- The runner recorded only the SDK's generic "HTTP request failed"; it now
extracts the Brevo HttpError body into the run message (shown in the run
history Message column in the UI) and logs the full status, body and stack.
Stop logging the Brevo API key
- brevo-config logged the full API key in plaintext on every config load; that
line is removed.