Check Permission Before You Check Preconditions
Two checks guard most privileged operations: may this person do it, and is it possible right now. The order matters more than it looks.
The problem
Do preconditions first and your error messages become an information channel:
"You cannot approve this: the second signature is still outstanding."
Useful for an approver. But if the caller had no right to approve anything, you've just told them the case exists, that it's mid-approval, and which step it's waiting on.
The order
// 1. May the actor perform this action at all?
if (!actor.Permissions.Contains(transition.RequiredPermission))
return TransitionOutcome.Refused(Refusal.NotPermitted);
// 2. Only now, is it possible?
var failures = guards.Where(g => !g.Evaluate(context).Satisfied).ToList();
if (failures.Count > 0)
return TransitionOutcome.Refused(Refusal.PreconditionUnmet, failures);An unauthorised caller gets one flat refusal and learns nothing about the state of the thing they touched.
Why it matters
This is the cheapest information-disclosure fix in any workflow system, and it is almost always got wrong — because preconditions are the interesting logic, so they get written first and the permission check gets bolted on afterwards, where it reads naturally.
Worth writing the test that pins it: an actor without the permission gets exactly the same response whether or not the preconditions are met. If those two responses ever differ — in body, in status code, or in timing — the check has moved back to the wrong place.