Skip to content

Fix: email worker never received jobs; add roadmap - #14

Merged
devinder-dev merged 5 commits into
mainfrom
fix/wave-0
Oct 21, 2026
Merged

devinder-dev merged 5 commits into
mainfrom
fix/wave-0

Conversation

@devinder-dev

Copy link
Copy Markdown
Owner

What

  1. Bug fix — reminders and overdue notices were never sent.
    startEmailWorker() created its BullMQ Worker without prefix: QUEUE_PREFIX.
    BullMQ then falls back to its default bull: prefix, while the email queue
    writes under fakturly:. The worker started cleanly and watched keys nothing
    wrote to.
  2. Roadmap — docs/roadmap.md, linked from the README: multi-tenancy first,
    then payments v2 (Bankgiro/BgMax), TOTP + BankID, refunds and recurring
    invoices, API keys and webhooks, EU VAT + Peppol, Fortnox, and an AI layer.

Why the tests missed it

jobs.test.ts built its own worker with the right prefix, so it tested a copy
of the wiring rather than startEmailWorker() itself.

The new test

Adds a job through the real getEmailQueue() and asserts the real
startEmailWorker() processes it. Verified both ways: fails with the prefix
removed, passes with it.

While writing it, a second issue showed up: the construction-only test worker
was still running and acted as a competing consumer, taking the job first.
It now uses autorun: false.

Verification

  • bun run typecheck clean; backend suite 481 pass / 9 skip / 0 fail
  • Running app (demo mode): POST /invoices/{id}/reminder → the worker sends the
    reminder → an EmailLog row with a provider message id

startEmailWorker() built its Worker without `prefix: QUEUE_PREFIX`, so
BullMQ fell back to its default 'bull:' keys while the email queue writes
under 'fakturly:'. The worker started cleanly and processed nothing:
overdue notices and payment reminders were enqueued and never sent.

The existing jobs test built its own worker with the right prefix, so it
stayed green. The new regression test uses the production functions on
both ends (getEmailQueue → startEmailWorker) and fails without the fix.
The construction-only test worker now uses autorun: false, because a
running worker on the same queue is a competing consumer that stole the
regression test's job.
@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fakturly-app Ready Ready Preview Oct 21, 2026 10:09am UTC

@devinder-dev
devinder-dev merged commit 0711b15 into main Oct 21, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 3ed48e37 Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant