loom-pr · policy
Source declarations, signatures and documentation for policy.
Source: sigil/weave/tools/loom-pr/src/policy.rs. SHA-256: 9d7992d3bc2ec43a3796b837925ba4925469be541397ce015f1273aa873bf136.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
policy::MergePolicy
How many distinct, valid approvals are required to merge.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MergePolicy {
/// Minimum approver-DIDs whose signatures verify against the current
/// `head_commit_seq`. Default `1`.
pub min_approvals: u32,
/// If set, only DIDs in this allow-list count. Empty means "any DID
/// counts" (open-source default — anyone can review). v2 will replace
/// this with a Sigil Mandate reference.
#[serde(default)]
pub allowed_approvers: Vec<String>,
/// If true, the PR's own author cannot satisfy the threshold (a
/// reviewer-must-not-be-author guard). Default `true`.
#[serde(default = "default_block_self_approval")]
pub block_self_approval: bool
}Source line: 13.
policy::MergeDecision
Outcome of evaluating a set of approvals against a policy.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum MergeDecision {
/// At least `min_approvals` distinct, valid, on-policy approvals
/// pinned to the current head; merge is authorized.
Approved {
/// DIDs that contributed to the threshold (deduped).
contributing_dids: Vec<String>,
},
/// Not enough qualifying approvals.
Insufficient {
/// How many we counted as valid.
valid: u32,
/// What the policy required.
required: u32,
},
}Source line: 44.
policy::MergePolicy::evaluate
Evaluate approvals for pr. Each approval is signature-checked
once and counted toward the threshold iff:
- Signature verifies against its embedded pubkey.
payload.pr_idmatches the PR.payload.approved_head_seqmatches the PR's current head.payload.approver_didis on the allow-list (or list is empty).- Approver DID is not the PR author when
block_self_approval.
pub fn evaluate(&self, pr: &Pr, approvals: &[Approval]) -> MergeDecision;Source line: 69.