Extracts the cron-only auto-generate logic into shared modules (lib/sync/auto-generate.ts, automation-config.ts) and adds group-auto-assign.ts, which attaches ungrouped policies to an existing renewal group when their renewal dates are close. Both now also run automatically after every AMS sync (sync-engine.ts), guarded by a Postgres advisory lock so overlapping syncs cannot double-generate. The external /api/cron/auto-generate endpoint remains for manual/ out-of-band triggering, delegating to the same shared engine. Adds an admin settings UI + /api/admin/automation-settings route to configure grace periods and toggles without a redeploy, and surfaces the new audit actions (AUTO_GENERATE_TASKS_CLIENT, AUTO_ASSIGN_POLICY_GROUP) in the audit log filters. Includes a fixed AUTOMATION_GO_LIVE_AT floor (2026-07-07) in automation-config.ts, applied to every candidate query in auto-generate.ts and group-auto-assign.ts. Without it, the first run after enabling this treated every historical policy/client/group that happened to be old enough as newly eligible, generating tasks anchored to old renewal/expiration dates in one burst (incident: 6,552 tasks created 2026-07-07 02:01, most already 1-2 years overdue for Jeanne Strong and Luke Billman; cleaned up same day after a verified backup). The floor ensures automation only ever processes records created from its go-live date forward. |
||
|---|---|---|
| .. | ||
| .claude | ||
| docs | ||
| prisma | ||
| public | ||
| scripts | ||
| src | ||
| .gitignore | ||
| ARCHITECTURE.md | ||
| components.json | ||
| docker-compose.yml | ||
| Dockerfile | ||
| eslint.config.mjs | ||
| jest.config.js | ||
| jest.setup.js | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| prisma.config.ts | ||
| README.md | ||
| restart-dev.sh | ||
| SERVER.md | ||
| tsconfig.json | ||
This is a Next.js project bootstrapped with create-next-app.
Getting Started
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
Learn More
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
Deploy on Vercel
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.