stage12-distributed-approval.py
TEXT FILE500 B · Public source code for developers, search crawlers and AI agents
1# SPDX-License-Identifier: 0BSD
2def eligible(intent_digest, approvals, trusted_principals):
3 voters = {principal for principal, digest in approvals
4 if principal in trusted_principals and digest == intent_digest}
5 return len(voters) >= 2
6
7trusted = {"finance", "operator"}
8assert not eligible("d1", [("finance", "d1")] * 2, trusted)
9assert not eligible("d1", [("finance", "d1"), ("operator", "d2")], trusted)
10assert eligible("d1", [("finance", "d1"), ("operator", "d1")], trusted)Read-only source · Select a line number to link directly · Raw download above
