Skip to main content

worst

Function worst 

Source
pub fn worst(outcomes: impl IntoIterator<Item = Outcome>) -> Outcome
Expand description

Fold outcomes into the most severe one, taking Allow < Reject < Freeze — the same total order combine folds by, exposed for callers that hold outcomes without a PolicyId to attribute each one to.

The motivating caller is a batch of writes judged as a unit (com.atproto.repo.applyWrites): each operation is judged on its own subject and the batch’s answer is the most severe of theirs, so a freeze tripped by any one operation outranks a rejection tripped by another and reaches the caller as a freeze. Ties are broken by input order, exactly as in combine: the first outcome at the worst severity is the one whose reason is reported.

Kept beside combine rather than reimplemented at each call site so that severity precedence lives in exactly one place — the private severity order both folds read — and a change to it cannot leave two folds disagreeing.