Expand description
action-gate-core: a pure, deterministic decision gate over an ordered
Check registry.
Gate::evaluate runs its checks in registration order and returns the
first check’s Some(decision), or an unconditional Decision::allow if
none triggers. It is a pure function of (context, checks): no host calls,
no clock, unit-testable, and byte-stable via decision_to_canonical_json.
Determinism depends on check ordering being stable, which the builder
guarantees (insertion order).
§Config is in the checks, not a global bundle
There is no global policy-bundle type here. Each check owns its parameters (a secrets check owns its regex set, an allowlist owns its list). The consumer assembles the gate:
use action_gate_core::{Gate, checks::{AllowlistCheck, SecretsCheck}};
use action_gate_types::ActionContext;
let gate = Gate::builder()
.check(SecretsCheck::default())
.check(AllowlistCheck::new(["email.send", "email.draft"]))
.build();
let decision = gate.evaluate(&ActionContext::new("email.send"));
assert!(decision.is_allow());§Degrade is a signal, not an action
Outcome::Degrade does not perform a degraded action. The gate returns it;
the consumer decides its meaning (route to a human, require confirmation).
The gate never touches the world.
Structs§
- Action
Context - Everything a
Checkneeds to make its decision about a proposed action. - Decision
- The result a
Checkreturns and theGateyields. - Gate
- A pure decision gate over an ordered list of checks.
- Gate
Builder - Builds a
Gateby registering checks in evaluation order.
Enums§
- Outcome
- The three possible outcomes of a decision.
Traits§
- Check
- A single gate check.
Functions§
- decision_
to_ canonical_ json - Serialize a decision to canonical (key-sorted) JSON, for byte-stable hashing
and comparison. Two producers serializing the same logical decision produce
the same bytes regardless of
serde_json’spreserve_orderstate. - sha256_
hex sha256:<hex>overbytes. Thesha256:prefix keeps the hash self-describing, matching the ledger primitive inattest-ledger.