feat(policy): govern delegation and review escalation
Module Package Release / publish-packages (push) Successful in 12s
Module Package Release / publish-packages (push) Successful in 12s
This commit is contained in:
@@ -132,6 +132,58 @@ class FunctionAssignmentGovernancePolicyTests(unittest.TestCase):
|
||||
self.assertTrue(responder.allowed)
|
||||
self.assertFalse(unrelated.allowed)
|
||||
|
||||
def test_delegation_ceilings_and_escalation_rules_are_bounded(self) -> None:
|
||||
decision = self.resolve(
|
||||
function_settings={
|
||||
"assignment_governance": {
|
||||
"request_profile": "holder_with_authority_clearance",
|
||||
"authority_function_id": "authority-1",
|
||||
"delegation_allowed": True,
|
||||
"maximum_delegation_depth": 3,
|
||||
"maximum_delegated_validity_days": 45,
|
||||
"escalation": {
|
||||
"holder": {
|
||||
"target_function_id": "escalation-1",
|
||||
"timeout_hours": 24,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
self.assertTrue(decision.delegation_allowed)
|
||||
self.assertEqual(3, decision.maximum_delegation_depth)
|
||||
self.assertEqual(45, decision.maximum_delegated_validity_days)
|
||||
self.assertEqual("escalation-1", decision.escalation_rules[0].target_function_id)
|
||||
self.assertEqual(24, decision.escalation_rules[0].timeout_hours)
|
||||
|
||||
def test_escalated_review_requires_explicit_target_holder(self) -> None:
|
||||
allowed = self.resolve(
|
||||
action="approve_escalation",
|
||||
current_state="escalated",
|
||||
context={
|
||||
"actor_is_escalation_target": True,
|
||||
"actor_routes": {"escalation": {"effective": True}},
|
||||
},
|
||||
)
|
||||
unavailable = self.resolve(
|
||||
action="approve_escalation",
|
||||
current_state="escalated",
|
||||
context={
|
||||
"actor_is_escalation_target": False,
|
||||
"actor_routes": {
|
||||
"escalation": {
|
||||
"effective": False,
|
||||
"reason": "The target function is vacant.",
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
self.assertTrue(allowed.allowed)
|
||||
self.assertFalse(unavailable.allowed)
|
||||
self.assertEqual("The target function is vacant.", unavailable.reason)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user