Phase 10, part 8: the audit log, and who made what

Sign-ins and failed ones, everything admins do to users, connections,
posting accounts, each post published and email sent, pull requests and
deletions go in an audit log (schema 36), kept two years; admins read it
under Settings → Activity. Drafts, published posts and outreach emails
show who made them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:31:33 -07:00
co-authored by Claude Opus 5.5
parent bb4772637c
commit c8964cec12
23 changed files with 601 additions and 11 deletions
+25
View File
@@ -2344,6 +2344,31 @@ starts** (multi-tenant still doesn't).
reminders of running-out sign-ins cover every account.
- Agents get the same grid in Phase 11.
**Part 8 built 2026-11-25** on `phase10`.
- Schema 36: `audit_log` (when, who, their name then, person, agent or
system, the action, its target, detail, IP), kept two years (pruned by
the hourly `job:accounts`), and `outreach.created_by`. `internal/audit`
records and lists it.
- Recorded where they happen: the setup, sign-ins, failed sign-ins (with
the address tried, known or not), locks, sign-outs, resets asked and
done, password and two-factor changes, joining; every admin action on
Users (invited, access changed with the new access, resent, withdrawn,
turned off and on, unlocked, two-factor reset, signed out, removed);
connections made and removed; posting accounts signed out and who-may-
post changes; each post published (the account and the post's link,
each copy), and scheduled posts and queued emails sent on their own
(as Supermarket, for the person who scheduled or wrote them).
- Recorded by their route (`auditedRoutes`, in activity.go), when the
request worked (it redirected): scheduling and discarding posts,
queueing and sending emails, CRM queueing, mailing-list adds,
suppression, pull requests (SEO changes, briefs, pages, the theme,
search-engine setup), a new site, IndexNow, the metrics page, restoring
backups, the company profile, and the deletions.
- Settings → Activity (admins): newest first, a hundred at a time,
filtered by person, kind and text.
- *By Jane*: on drafts in Posts (who wrote it), published posts (who
posted it, and as which account) and outreach emails (who drafted it).
1. **Users and sessions.**
- Tables:
- `users`: email, name, kind (person or agent), status (invited,