# v404 - Notification Scheduler Run History and Health

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

## Purpose

v404 continues the notification delivery track after v403 scheduler/webhook execution hardening.

The goal is to make protected scheduler health visible to Workspace Admins without moving settings, provider setup, diagnostics, scheduler secrets, or delivery controls onto the operational `/notifications` alert page.

## Changes

- Added workspace-level scheduler run records using the existing `OutboundEmailLog` table.
- Protected scheduler runs now write a simple `app_notifications.email_digest.scheduler_run` record for each workspace checked.
- Scheduler run records show only simple workspace-safe status:
  - running
  - completed
  - dry run complete
  - skipped
  - needs attention
- Added scheduler health to digest history returned by `GET /api/app-notifications/email-digest`.
- Added scheduler run history to Workspace Settings > Notifications.
- Added scheduler health cards for:
  - recent runs
  - needs attention count
  - last run status
- Preserved existing digest send history separately from scheduler run history.
- Kept `/notifications` alert/action-only.
- Kept provider setup in `/company/integrations`.
- No scheduler secret value, SMTP credential, raw provider response, or raw delivery log is shown to normal users.

## Placement

Allowed in Workspace Settings > Notifications:

- scheduled digest plan
- trigger rules
- automation lock/readiness wording
- scheduler health
- scheduler run history
- simple run counts and statuses
- manual preview and approved send controls

Not allowed on `/notifications`:

- notification preferences
- digest controls
- digest history
- scheduler health
- scheduler run history
- provider setup
- provider diagnostics
- raw delivery logs
- scheduler secrets

## Notes

This build avoids Prisma changes by reusing `OutboundEmailLog` with a separate scheduler-run template key. Digest send records still use `app_notifications.email_digest`; scheduler run records use `app_notifications.email_digest.scheduler_run`.
