# v401 — Notification Digest History and Readiness Polish

Current baseline reviewed: v400.

v401 continues the notification delivery track while preserving the corrected placement rule: notification delivery controls live in Workspace Settings > Notifications, provider setup lives in Workspace Integrations, and `/notifications` remains alert/action-only.

## Decision

Continue with notification digest history/readiness polish before returning to another product surface.

The purpose of this build is to make the v400 digest feature easier to trust and operate after a send attempt by showing the user simple status, last-send timing, recent send records, and retry guidance without exposing provider diagnostics.

## Product changes

- Added `GET /api/app-notifications/email-digest` for simple digest send history.
- Reused existing `OutboundEmailLog` records; no Prisma schema change was required.
- Added recent digest history in Workspace Settings > Notifications.
- Added last digest status and last attempted timing.
- Added simple counts for sent, needs-attention, and waiting digest send records.
- Added plain retry guidance based on the latest digest send status.
- Improved readiness wording so users know whether to preview/send, turn on choices, or go to Workspace Integrations.
- Kept failure messages sanitized so normal users do not see SMTP credentials, raw provider errors, raw logs, or provider diagnostics.

## Placement and safety

The digest history panel remains inside Workspace Settings > Notifications.

`/notifications` was not changed and remains limited to:

- alert list;
- read/unread;
- hide/show again;
- urgent/watch labels;
- links to related work records.

Provider setup remains in `/company/integrations`.

## What changed in code

- `app/api/app-notifications/email-digest/route.ts`
- `components/notifications/notification-email-digest-panel.tsx`
- `src/modules/app-notifications/app-notification-delivery.service.ts`
- `types/index.ts`

## Prisma impact

No Prisma schema changes were made.

v401 uses the existing `OutboundEmailLog` table and the existing `app_notifications.email_digest` template key.

## Deployment note

The WHM command must continue the v399.1 deployment hardening sequence:

1. visible unzip;
2. deploy cleanup;
3. preflight;
4. build;
5. post-build restart.

## Build validation

- `node scripts/dispatchspot-build-preflight.mjs` passed.
- Local Next build was not run in the sandbox because installed dependencies / `node_modules` are not included in the source package.

## Next recommendation

Review Workspace Settings > Notifications and confirm digest history, last-send status, readiness wording, and retry guidance are clear. Then continue notification digest hardening with optional scheduled digest planning, or return to another high-use operational surface.
