Skip to content

feat(hub): add PostgreSQL background jobs - #145

Merged
nshki merged 3 commits into
build/hub/newfrom
copilot/hub-jobs-foundation
Oct 28, 2026
Merged

nshki merged 3 commits into
build/hub/newfrom
copilot/hub-jobs-foundation

Conversation

Copilot AI commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Why

The new Express Hub needs a shared foundation for background and recurring work before its Rails jobs can move over. This adds that foundation with PostgreSQL persistence and independent capacity for application-requested and scheduled work.

Closes #141.

What changes

BullMQ uses its PostgreSQL backend with two queues, on-demand and scheduled. Each has a separate worker command and concurrency setting. Producers submit validated payloads; workers validate them again, dispatch registered handlers, and drain active work on shutdown.

An explicit setup command runs Prisma migrations, BullMQ migrations, and schedule registration before application startup. Stable schedule IDs keep repeated deployments from creating duplicate schedules. Vitest prepares BullMQ in the database template and resets job data inside each worker's isolated database without clearing migration history.

The background-jobs guide documents process ownership, retries, delivery guarantees, and future domain requirements. No Rails jobs or production schedules are ported. Production images, frontend hosting, and deployment orchestration remain outside this change.

Created from a Slack conversation.

Add separate on-demand and scheduled BullMQ consumers, explicit release setup, validated job contracts, and isolated PostgreSQL test coverage without porting product jobs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nishiki <1121087+nshki@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings October 28, 2026 17:31
Copilot AI requested review from a team and nshki as code owners October 28, 2026 17:31

Copilot AI left a comment

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.

Copilot was unable to review this pull request because there is no eligible user to bill.

An enterprise owner can allow the organization to be billed for reviews like this by enabling Copilot code review for users without a license.

Copilot AI and others added 2 commits October 28, 2026 18:41
Extract worker database URL access and end-of-test queue disposal while retaining explicit reset-test resource ownership.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nishiki <1121087+nshki@users.noreply.github.com>
Remove low-value schema and helper edge cases, import-only checks, and mocked enqueue failures. Retain real persistence, schedule identity, isolation, retries, and shutdown safeguards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nishiki <1121087+nshki@users.noreply.github.com>
Copilot AI force-pushed the copilot/hub-jobs-foundation branch from 0815762 to 8f37334 Compare October 28, 2026 19:16
@nshki
nshki merged commit 3254a64 into build/hub/new Oct 28, 2026
26 checks passed
@nshki
nshki deleted the copilot/hub-jobs-foundation branch October 28, 2026 21:35
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.

5 participants