Intermediate Representation for Caravela's triple-target policy system.
A policy :entity do ... end block in the domain DSL parses into a
Caravela.Policy.Entry struct that captures three categories of
rules:
scope— a 2-arity function(query, actor) -> querycompiled into the context'sapply_scope/3helper (Ecto WHERE clauses).fieldrules — per-field visibility predicates of arity 1 or 2 (fn actor -> bool endorfn actor, record -> bool end). Field rules compile intocompute_field_access/2andproject_fields/3on the context, and into thefield_accessprop reaching Svelte via LiveSvelte.allowaction gates — one per{:create, :update, :delete}.
The Caravela.Policy module itself only holds the structs.
Caravela.Policy.Compiler emits the matching __caravela_policy_*__
function clauses into the domain module.