feat(events): add user_identity field to DomainEvent and propagate through event pipeline #1257

Merged
freemo merged 1 commits from feature/domain-event-user-identity into master 2026-04-02 16:59:08 +00:00

1 Commits

Author SHA1 Message Date
Luis Mendes 6a31f376ac feat(events): add user_identity field to DomainEvent and propagate through event pipeline
CI / build (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 20s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m48s
CI / security (pull_request) Successful in 4m10s
CI / typecheck (pull_request) Successful in 4m26s
CI / unit_tests (pull_request) Successful in 8m57s
CI / docker (pull_request) Successful in 1m41s
CI / coverage (pull_request) Successful in 12m34s
CI / e2e_tests (pull_request) Successful in 21m7s
CI / integration_tests (pull_request) Successful in 25m6s
CI / status-check (pull_request) Successful in 8s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 55m6s
Added user_identity field (str | None, default None) to the frozen DomainEvent
Pydantic model, enabling authenticated user identity to be carried as a
first-class event attribute rather than buried in the details dict.

Updated AuditEventSubscriber to prefer event.user_identity over the legacy
details-dict extraction with a backward-compatible fallback: when the field
is set it is used directly (and removed from details to prevent duplication);
when None, the subscriber falls back to popping user_identity from details.

Added Behave BDD scenarios testing user_identity defaults, explicit values,
JSON round-trip, DomainEvent field propagation through the audit pipeline,
field-vs-details precedence, and None fallback. Added Robot Framework
integration tests covering the identity field pipeline, details fallback,
and field precedence. Also fixed a pre-existing test mismatch in
resource_cli_flags_904.feature where the clone-into scenario expected
"container types" but the error message reads "container resource types".

ISSUES CLOSED: #715
2026-04-02 11:19:03 +00:00