Skip to content

Observability: structured logs at domain state transitions #216

Description

@mforce

What to build

Application-layer handlers perform every business state transition (daily entry submit/lock/adjust, egg lot creation, FIFO allocation, sales order confirm/void, payments, inventory movements) with zero logging — a production incident currently leaves no narrative between "request arrived" and "exception stack trace or audit row".

Add structured logging to the money-path handlers:

  • Information on successful state transitions, with stable structured property names (entity ids, account id, quantities where meaningful)
  • Warning when a handler returns a failed Result (expected failure), including the failure reason
  • Property names consistent across handlers (e.g. AccountId, FlockId, OrderId) so log queries work across features

Scope: daily entry lifecycle, FIFO allocation, sales order lifecycle, payments, egg/feed/water inventory movements. Purely additive — no behavior change, no new failure modes (logging must never throw into the handler path).

Acceptance criteria

  • Daily entry submit/lock/adjust, FIFO allocation, order confirm/void, and payment recording each emit an Information log with structured ids on success
  • Failed Result paths in those handlers emit Warning with the failure reason
  • No secrets, tokens, or personal data in logged properties
  • Property names are stable and shared across handlers
  • Build clean (warnings are errors); existing test suite green

Blocked by

None - can start immediately (pairs well with the telemetry-pipeline slice, but is independent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions