probo icon indicating copy to clipboard operation
probo copied to clipboard

Batch signature and approval notifications via debounced worker

Open SachaProbo opened this issue 5 months ago • 2 comments

ENG-506

Replace the immediate per-document approval email and the manual "send signing notifications" action with a single debounced worker that batches pending requests per recipient and organization.

The worker scans every tenant on an interval (default 5m) and sends one consolidated signing email and/or one approval email per recipient/org, listing all documents awaiting their signature or approval. A request is notified once it has been pending past the debounce delay (default 15m), then re-notified on a reminder cadence (default 72h) until actioned. A new last_notified_at column on signatures and approval decisions, stamped via a conditional UPDATE, provides the debounce, reminder schedule and concurrency-safe dedup.

Email copy now lists the documents and mentions the ~3 day reminder cadence. Removed the inline approval-on-publish email, the SendSigningNotifications service method/mutation/MCP tool, its IAM action, and the related console UI and n8n operation.


Summary by cubic

Batch signature and approval notifications into a debounced worker that sends one consolidated email per recipient and organization. Removes the manual action and per-document approval emails; adds configurable interval/debounce with a 1‑day base reminder cadence (1x, 2x, 3x), a 4‑email cap, and multi‑document emails with deep links.

Coredata +556 -80

  • Add last_notified_at and notification_count (migration) to track cadence.
  • Add due-group loaders and claim/bump helpers for signatures/approvals with a 4-email cap.
  • Add LoadByIDs for versions/quorums; remove LoadAwaitingSigning; add DocumentType.Label.

Service +630 -218

  • Add debounced document notification worker that batches per recipient/org with concurrency-safe claims and widening reminders.
  • Wire worker in probod with defaults and env/config; add document notification config.
  • Remove immediate approval-on-publish emails and the SendSigningNotifications path.

GraphQL API +0 -28

  • Remove the sendSigningNotifications mutation and resolver.

MCP +0 -44

  • Remove the sendSigningNotifications tool and schema.

App: console +1 -61

  • Remove the "Send signing notifications" button, hook, and permission wiring.

Package: emails +45 -29

  • Presenter now takes a main URL and a list of document summaries; subjects reference org compliance documents.
  • Templates list pending docs with deep links; updated copy for multiple documents.

Package: n8n-node +0 -64

  • Remove the "Send Signing Notifications" operation and menu entry.

Tests +10 -0

  • Add builder defaults/custom-values tests for document notification config.

Other +5 -0

  • Add .env examples for DOCUMENT_NOTIFICATION_INTERVAL, DOCUMENT_NOTIFICATION_DEBOUNCE_DELAY, and DOCUMENT_NOTIFICATION_REMINDER_INTERVAL.

Written for commit a82d97ad84b0b4d14f01547e5834262319a13180. Summary will update on new commits.

Review in cubic

SachaProbo avatar Jun 15 '26 10:06 SachaProbo

@cubic-dev-ai review please

SachaProbo avatar Jun 15 '26 14:06 SachaProbo

@cubic-dev-ai review please

@SachaProbo I have started the AI code review. It will take a few minutes to complete.

cubic-dev-ai[bot] avatar Jun 15 '26 14:06 cubic-dev-ai[bot]