# v402 — Notification Scheduled Digest Planning and Guarded Trigger Rules

Status: Build history record  
Product UI impact: Workspace Settings > Notifications only  
Prisma schema impact: none

## Summary

v402 reviewed v401 and continued the notification delivery track. It adds scheduled digest planning and guarded trigger checks while preserving the placement rule introduced after v390.

## Product changes

- Added scheduled digest plan data to `GET /api/app-notifications/email-digest`.
- Added `CHECK_TRIGGERS` support to `POST /api/app-notifications/email-digest`.
- Added guarded trigger evaluation for:
  - urgent alert digest checks;
  - overdue or late work digest checks;
  - due-today digest checks;
  - daily team digest checks.
- Added duplicate-send guards:
  - no empty digests;
  - no repeated pending send attempts within a short wait window;
  - no repeated digest sends within a short cooldown window;
  - no repeated daily team digest after one has already been sent today.
- Added an automation lock controlled by `DISPATCH_SPOT_NOTIFICATION_AUTO_DIGEST_ENABLED=true`.
- Default behavior remains approval-first. If automation is not explicitly enabled, trigger checks can report that digest items are ready but must still be previewed and approved manually.
- Reused existing `OutboundEmailLog` records. No new Prisma model or migration was required.

## Placement rule

- `/notifications` remains alert/action-only.
- Digest planning, digest history, trigger checks, and readiness wording remain inside Workspace Settings > Notifications.
- Provider setup remains in Workspace Integrations.
- SMTP credentials, provider diagnostics, raw delivery logs, and setup controls are not shown on operational pages.

## Guarded automation rule

Automatic digest sending must remain locked unless explicitly enabled at the platform/deployment level. Even when enabled, sends must still pass readiness, item selection, duplicate-send, and cooldown checks before sending.
