- apps/scheduler/src/queue.ts: PUBLISH_QUEUE, BullMQ-compatible Redis connection
factory, queue factory, default retry/backoff job opts.
- apps/scheduler/src/worker.ts: makePublishWorker factory drives the publish-loop
state machine (queued -> dispatching -> published | failed/dlq) and persists
each transition to publications. Dispatcher is injected (fake in tests; the
LinkedIn client swaps in once Gate 0.9 / CMA lands).
- apps/scheduler/src/main.ts: runnable entry; boots the worker; LinkedIn dispatch
is fail-closed until CMA is approved.
- apps/scheduler/src/worker.integration.test.ts: gated behind INTEGRATION=1;
verifies enqueue -> consume -> row published within 5s, and failure -> dlq with
error recorded. Run against real Redis + Postgres.
Closes the Stage 4.1 DoD (enqueue -> worker-consume -> DB row updated within 5s).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>