#433: audit verb registry — one source of truth, a self-growing dropdown #441

Merged
Cordy merged 8 commits from audit-verbs-433 into main 2026-09-06 05:05:37 +00:00
Owner

Closes #433. Built to the researched design (GitLab's audit-event-type registry + Keycloak's serverinfo-fed filter, with build-time enforcement neither has).

  • audit.Verbs — canonical, append-only vocabulary: 52 verbs in 9 groups (files, trash, locks, shares, spaces, legal holds, encryption, peering, seats & licence). Replaces the prose comment as the source of truth.
  • Scanner tripwire (verbs_test.go, witnessed compile-red): walks the repo, fails the build when any emitted verb — literal Action: fields plus the known dynamic families — is unregistered, or when an Action is built from an unexempted non-literal. It caught real drift twice during its own build: the peering runtime family (peer-auth/send/deliver/…), then auto-purge and key-drain wired in main.go — all absent from the manual inventory (and my own scout). The "auto-purge is never emitted" theory from the research phase was wrong; the scanner corrected it.
  • Server-fed dropdown: Info() carries the registry through the existing /api/v1/admin/audit/info; the query page builds grouped optgroups from it (9 i18n group labels ×4 locales). The hardcoded seven-option list is gone; the dropdown is version-correct by construction and preserves the current selection across refills.

CHANGELOG v0.6.135.

Closes #433. Built to the researched design (GitLab's audit-event-type registry + Keycloak's serverinfo-fed filter, with build-time enforcement neither has). - **`audit.Verbs`** — canonical, append-only vocabulary: 52 verbs in 9 groups (files, trash, locks, shares, spaces, legal holds, encryption, peering, seats & licence). Replaces the prose comment as the source of truth. - **Scanner tripwire** (`verbs_test.go`, witnessed compile-red): walks the repo, fails the build when any emitted verb — literal `Action:` fields plus the known dynamic families — is unregistered, or when an Action is built from an unexempted non-literal. **It caught real drift twice during its own build**: the peering runtime family (`peer-auth/send/deliver/…`), then `auto-purge` and `key-drain` wired in main.go — all absent from the manual inventory (and my own scout). The "auto-purge is never emitted" theory from the research phase was wrong; the scanner corrected it. - **Server-fed dropdown**: `Info()` carries the registry through the existing `/api/v1/admin/audit/info`; the query page builds grouped optgroups from it (9 i18n group labels ×4 locales). The hardcoded seven-option list is gone; the dropdown is version-correct by construction and preserves the current selection across refills. CHANGELOG v0.6.135.
Compile-red against main: Verbs and VerbInfo do not exist yet. The
scanner walks the repo's Go source and fails when any emitted audit verb
- literal Action fields and the known dynamic verb families - is not in
the registry, and when an Action is built from a non-literal outside the
exemption list. This is what makes the vocabulary self-growing: a new
verb cannot ship without the dropdown learning it (GitLab's registry +
Keycloak's serve-from-server, enforced at build time).
The scanner's first run caught what the manual scout missed: the four
Audit callbacks wired in cmd/cairnd/main.go carry the peering package's
runtime verbs (peer-auth, peer-send, peer-deliver families). Add the
.audit(" carrier so those literals are scanned at source, and exempt the
main.go plumbing that forwards them.
#433: audit verb registry - one source of truth, a self-growing dropdown
All checks were successful
ci / test-and-build (pull_request) Successful in 42s
faac44ab0a
audit.Verbs is the canonical, append-only action vocabulary (52 verbs in 9 groups). The scanner test walks the repo and fails the build when an emitted verb - literal Action fields plus the known dynamic families (admin peering, runtime peer-* helpers, driver file ops, lock break, space lifecycle) - is not registered, or when an Action is built from an unexempted non-literal. It proved itself during its own build: two red runs surfaced the peer-* runtime family, auto-purge and key-drain, all missing from the manual inventory. Info() serves the registry through /api/v1/admin/audit/info; the query page builds grouped optgroups from it (9 i18n group labels x4) instead of the hardcoded seven-option list.

TDD: registry scanner witnessed compile-red on the runner; all green after splice.
Cordy merged commit eab514b1d2 into main 2026-09-06 05:05:37 +00:00
Cordy deleted branch audit-verbs-433 2026-09-06 05:05:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#441
No description provided.