Skip to content

feat(queues): add persistent queue prototype - #190

Draft
sampolahtinen wants to merge 6 commits into
mainfrom
agent/queue-module-prototype
Draft

feat(queues): add persistent queue prototype#190
sampolahtinen wants to merge 6 commits into
mainfrom
agent/queue-module-prototype

Conversation

@sampolahtinen

Copy link
Copy Markdown
Contributor

Introduces the first persistent queue walking skeleton for Composer. It provides a typed queue definition and producer/consumer API, durable Postgres storage, and an independent Compute dispatcher that pushes work to application services.

Changes

  • Queue module: Adds defineQueues, queueProducer, queueConsumer, serveQueues, queues, and queueDispatcher under @prisma/composer-prisma-cloud/queues.
  • Durable delivery: Stores messages, queue configuration, availability times, attempts, and leases in Postgres. Enqueue is idempotent, claims use FOR UPDATE SKIP LOCKED, and delivery is at least once.
  • Retry policy: Adds per-queue fixedBackoff configuration, persisted delayed retries, maximum-attempt enforcement, and terminal failed messages.
  • Deployable example: Adds examples/queues, where one Compute service hosts the UI, producer, and consumer while a separate dispatcher delivers messages. The fail-once control demonstrates a real failed first attempt and successful retry with the same message ID.
  • Documentation and architecture: Adds the queue design specification, public-package exports, architecture classifications, authoring guidance, and prototype operational findings.

Why

Queues remain a Prisma Cloud module composed from existing Postgres and Compute primitives instead of becoming a Composer core primitive. Keeping the durable queue service separate from the dispatcher avoids a dependency cycle, permits consumers to enqueue follow-up work, and lets delivery continue without producer traffic.

Prototype boundaries

This is intentionally a draft walking skeleton. Batches, several competing consumer services, exponential retry, replay, pause and resume, and operational APIs are not implemented yet.

The deployment prototype also exposed two Composer lifecycle issues documented in .agents/diary/queues-prototype.md: artifact and binding updates can become active in the wrong order, and promoting a new continuously running Compute revision does not retire previous revisions. Only one dispatcher revision should run until deployment retirement or revision fencing is implemented.

Verification

  • pnpm format
  • pnpm typecheck — 78 tasks passed
  • pnpm lint
  • pnpm lint:casts
  • pnpm lint:deps
  • pnpm check:publish-deps
  • pnpm --filter @internal/queues test — 10 tests passed, including real Postgres integration tests
  • Deployed demo: three consecutive fail-once messages retried successfully with stable IDs after 5.1–5.3 seconds

Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9535e51f-0cc8-4ee4-9e98-08a3c6c97530

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@prisma/composer@190
npm i https://pkg.pr.new/@prisma/composer-prisma-cloud@190

commit: 4499ebb

Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
@sampolahtinen sampolahtinen changed the title Add persistent queue prototype feat(queues): add persistent queue prototype Jul 31, 2026
Define the first version as many producers feeding one logical consumer per queue. Reserve publish-and-subscribe fan-out for a separate future capability.

Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
Keep direct external enqueue outside version one while recording the intended static, authenticated HTTPS extension and the in-graph gateway path.

Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
Remove outbound OpenTelemetry and product analytics from user-deployed queue services. Keep operational activity durable in queue_activity and available only through the wired operational port.

Signed-off-by: Sampo Lahtinen <sampo.lahtinen@icloud.com>
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