Files
spencermandClaude Opus 5.5 a82e056b6a
ci / frontend (pull_request) Successful in 1m11s
ci / server (pull_request) Successful in 12m2s
ci / image (pull_request) Skipped
ci / e2e (pull_request) Successful in 6m1s
Phase 9: Admin completion, reconcile, notifications, integrity, backups
Admin: Departments (name and stations; add shows the three groups IT must
create), Profiles (welder stamp, station limits, active) with a CSV import
that previews and applies only when clean, Checklists (weld and plain),
Security (session, lockout and rate-limit settings with bounds, alerts for
the last 24 hours, the integrity result), Access log with filters and a
guarded CSV, Who is in, Stamp check, Notifications, and the employeeID
flags. Every Admin change is audited.

Worker: ad-reconcile (nightly and on "refresh from AD now"), session-refresh
(15 minutes), integrity (seals, asset hashes, missing and orphan files, the
audit chain), backup-check, notify-send and notify-digest. Notifications
route per event type to AD groups, users, mailboxes or the department
Supervisor group, immediately or in a daily digest, over STARTTLS verified
against the PESCO CA, with dry run on the test stack.

Backups: scripts/backup/ps-backup.sh and ps-restore.sh with a systemd timer
at 02:00 America/Denver. Restore rehearsed on the test stack 2026-10-21.
CI: pip-audit and npm audit. pypdf 6.21.1 and certifi 2026.10.19.

Migration 0010. Closes the app part of I6, M3, O1, O2 and S3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 18:27:09 -06:00

31 lines
973 B
Python

"""notify-digest, every 5 minutes: send the daily digests whose time has passed (see notify/digest.py). Not
pausable."""
from __future__ import annotations
from datetime import datetime
from ...feed.config import FeedSettings
from ...notify import digest
from . import Counts, JobContext, JobSpec, directory, reload_departments
EVERY_SECONDS = 5 * 60
def run(ctx: JobContext) -> Counts:
has = ctx.conn.execute("SELECT EXISTS (SELECT 1 FROM notification_outbox WHERE sent_at IS NULL)").fetchone()[0]
if not has:
return {"due": 0}
reload_departments(ctx.conn)
counts = digest.run_digest(ctx.conn, ctx.settings, directory(ctx), ctx.now_site())
if counts.get("failed"):
ctx.degrade(str(counts.get("error") or f"{counts['failed']} digest messages failed"))
return counts
def _cadence(_: FeedSettings, __: datetime) -> int:
return EVERY_SECONDS
SPEC = JobSpec(name="notify-digest", run=run, cadence=_cadence, pausable=False)