Raxol.Agent.Authorization.Labels (Raxol Agent v2.6.0)

Copy Markdown View Source

Label state for the authorization engine, with monotonic merge.

Labels are a plain map that policies read (to gate on) and write (verdict writes). When several policies write the SAME key, a monotonic label keeps the MOST-RESTRICTIVE value rather than last-write-wins -- the CRDT-flavored _merge_monotonic_writes from omnigent. This guarantees a stricter policy can never be loosened by a later, more permissive one in the same pass.

A monotonic spec maps a label key to an ordering, least-restrictive first:

%{access: [:read, :write, :admin], risk: [:low, :medium, :high]}

Keys not in the spec merge last-write-wins.

Summary

Functions

Merge writes into labels. Monotonic keys keep the most-restrictive value; other keys take the written value.

Types

labels()

@type labels() :: map()

monotonic()

@type monotonic() :: %{optional(term()) => [term()]}

Functions

merge(labels, writes, monotonic \\ %{})

@spec merge(labels(), map(), monotonic()) :: labels()

Merge writes into labels. Monotonic keys keep the most-restrictive value; other keys take the written value.