Skip to content

fix: move document complete email to a job - #2835

Merged
dguyen merged 1 commit into
mainfrom
fix/move-document-complete-email-to-jobs
May 22, 2026
Merged

dguyen merged 1 commit into
mainfrom
fix/move-document-complete-email-to-jobs

Conversation

@dguyen

@dguyen dguyen commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Description

Move the document completion email sending logic into it's own job. This allows us to send webhooks in the event that our email service is down.

Copilot AI review requested due to automatic review settings May 20, 2026 06:12
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
prd-docs Ignored Ignored May 20, 2026 6:12am
prd-openpage-api Ignored Ignored May 20, 2026 6:12am
stg-docs Skipped Skipped May 20, 2026 6:12am

Request Review

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit

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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 502985c3-9b96-48a7-b29d-6fa56f3ab153

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/move-document-complete-email-to-jobs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Pull request overview

Moves document completion email delivery out of the seal-document workflow and into a dedicated background job, so webhook delivery isn’t blocked by email sending failures.

Changes:

  • Removes inline “document completed” email sending from internal.seal-document and replaces it with a jobs.triggerJob(...).
  • Introduces a new email job definition + handler: send.document.completed.emails.
  • Registers the new job in the central jobs client so it can be triggered/processed.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/lib/jobs/definitions/internal/seal-document.handler.ts Stops sending completion emails inline; triggers the new completion-email job after sealing + webhook.
packages/lib/jobs/definitions/emails/send-document-completed-emails.ts Adds the new job definition (trigger name + Zod schema) for completion emails.
packages/lib/jobs/definitions/emails/send-document-completed-emails.handler.ts Implements the job handler that loads the envelope and sends completed emails + audit logs.
packages/lib/jobs/client.ts Registers the new job definition with the job client.
Comments suppressed due to low confidence (1)

packages/lib/jobs/definitions/emails/send-document-completed-emails.handler.ts:27

  • io is accepted in run but never used, which will trigger Biome’s noUnusedVariables warning. Other email jobs also wrap the actual send operations in io.runTask(...) for observability; consider either removing io from the signature or using it to wrap the mail-sending work (and/or per-recipient sends) to keep behavior consistent and avoid the unused parameter warning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +321 to +327
await jobs.triggerJob({
name: 'send.document.completed.emails',
payload: {
envelopeId,
requestMetadata,
},
});

@roshboi roshboi 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.

lgtm

@dguyen
dguyen merged commit fec5d55 into main May 22, 2026
12 checks passed
@dguyen
dguyen deleted the fix/move-document-complete-email-to-jobs branch May 22, 2026 04:21
scoobs-mystery-bytes pushed a commit to scoobs-mystery-bytes/documenso that referenced this pull request May 30, 2026

This branch was previously deployed

1 inactive deployment
Preview – stg-docs — e63dcd36 Deployed May 20, 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.

3 participants