Expand description
The operator’s bot.did.policy and bot.did.policyBinding records, and
everything from reading one to a didbot_policy::PolicyTree built from
them.
records reads each record strictly. lookups gathers the records
a write’s policies read before it is judged, and named answers which
accounts a written record names. set reads a whole
observation of both collections into declarations, checks what the
records alone can show, and computes the digest bot.did.stats
publishes. engine names the engines this build compiles a document
with. bindings says whom each policy is bound to, and subject
builds the subjects a policy judges, from the diff a write carries.
didbot-pds builds the enforced set from these, and
didbot-policy-check hands the same code to a browser, so this crate
builds for wasm32-unknown-unknown.
§From declarations to a tree
record::ParsedPolicy is what a statement becomes on its way to
didbot-policy. compile turns one into a registered declaration,
resolving language against the evaluators this build carries and
giving a predicate it cannot compile the scoped, fail-closed treatment.
merge::build assembles the builtin policies and whatever
declarations it is handed into one tree, with last_good deciding
what to enforce when a newer revision will not compile and across
holding that store for the length of a run.
§A partial view is the normal condition, not an error
plan/policy.md: policies are not a set, they are independent records,
and polling only ever samples a random point of that set. The view this
crate is handed can be empty, can be missing records nothing has yet
seen, and can still be enforcing a record the operator has since
deleted – none of that corrupts anything else’s verdict, because
deny-only policies never interact. What this crate is careful never to
do is let a failed refresh discard anything: see last_good.
Re-exports§
pub use across::AcrossBuilds;pub use bindings::BindingIndex;pub use bindings::Boundary;pub use bindings::Coverage;pub use builtin::builtin_policies;pub use builtin::builtin_records;pub use builtin::BuiltinPolicy;pub use compile::CompileReport;pub use compile::Language;pub use compile::PolicyWarning;pub use compile::ScopedDenial;pub use last_good::LastGoodPolicies;pub use lookups::Lookups;pub use merge::build;pub use merge::LastGoodFallback;pub use merge::LoadReport;pub use named::named_accounts;pub use named::named_handles;pub use record::ParsedPolicy;pub use records::Accounts;pub use records::Action;pub use records::Document;pub use records::Includes;pub use records::Lookup;pub use records::PolicyBinding;pub use records::PolicyRecord;pub use records::PolicyRef;pub use set::BuildFailure;pub use set::Observed;pub use set::PolicyRevision;pub use set::RejectedBuild;pub use subject::borrow;pub use subject::diff;pub use subject::OwnedChange;
Modules§
- across
- What one deployment keeps between policy builds.
- bindings
- Whom each policy is bound to: the reach a
bot.did.policyBindingrecord describes, and the index a gate asks before it consults a policy. - builtin
- Source 1: policies compiled into the binary, immutable.
- compile
- Turning a batch of
ParsedPolicyrecords into declarations registered on aPolicyTreeBuilder– the step where “applicability parses, the predicate does not” gets its scoped, fail-closed treatment, by actually callingdidbot_policy::Evaluator::compile. - engine
- The engines this build compiles a policy document with, and the tree built from them.
- last_
good - The operator source’s last-good-revision state, held across rebuilds.
- lookups
- Which records a write’s policies read, gathered from the whole set.
- merge
- Assembling every source into one
didbot_policy::PolicyTree. - named
- Which accounts a record names.
- record
- The declaration one policy statement becomes between the operator’s
record and
didbot_policy::PolicyDeclaration. - records
- The
bot.did.policyandbot.did.policyBindingrecords, as didbot reads and writes them. - set
- Reading one observation of the operator’s two collections into the declarations a tree is built from, and the checks that need nothing but the records themselves.
- subject
- The subjects a policy judges, and the diff a write carries to one.
Structs§
- Action
Set - The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. WhichWriteActions a write-shaped applicability declaration covers. - KindSet
- The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. Which account kinds a write-shaped applicability declaration covers. - Revision
- The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. A policy record’s own revision, for detecting a stale observation.
Enums§
- Applicability
- The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. What a policy statically applies to — the data the tree indexes on. - Scope
- The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. Whether a declarative dimension is unconstrained, or limited to a specific set of values. - Staleness
- The core’s own types, re-exported: every field of
record::ParsedPolicyis one of these, so a caller that declares a policy reaches them through this crate rather than depending ondidbot-policyfor the names alone. How stale an evaluator’s view of the world may be before it is unhealthy.