feat(audit,approvals,deliveries): wire audit producers, ITSM change requests, and fix Dockerfile.archie (#2153)

This commit is contained in:
sam committed 2026-11-28 00:42:37 +11:00
1 parent fdfcbab4bd
commit d0d79cbf91
26 files changed
+671 -35

No files matched your search

+24
View File
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"log/slog"
"reflect"
"time"
"github.com/google/uuid"
@@ -75,6 +76,29 @@ type auditStore interface {
List(ctx context.Context, f store.Filter) ([]store.EventRow, error)
}
// Recorder records immutable security and operational audit events.
type Recorder interface {
Record(ctx context.Context, e Event) error
}
// Emit forwards e to r when r is configured, logging any persistence error to
// log without failing the caller's operation.
func Emit(ctx context.Context, r Recorder, log *slog.Logger, e Event) {
if r == nil {
return
}
v := reflect.ValueOf(r)
if v.Kind() == reflect.Pointer && v.IsNil() {
return
}
if m, ok := r.(*Module); ok && m.store == nil {
return
}
if err := r.Record(ctx, e); err != nil && log != nil {
log.WarnContext(ctx, "record audit event", "category", e.Category, "action", e.Action, "error", err)
}
}
// Module records and serves one organisation's append-only audit stream.
type Module struct {
orgID string