Compare two refund rules
Joe wants to waive refund approvals. Compare his proposal with the rule the shop already approved, then find the first customer transaction that changes.
guarantee manager_approval when order_total > 50000 USD_centsguarantee manager_approval when falseReview a complete refund edition
Refunds over $500 require manager approval.Refunds do not require manager approval.Find the first difference
| Refund | Current rule | Proposed rule |
|---|---|---|
| $499.99 | No approval | No approval |
| $500.00 | No approval | No approval |
| $500.01 | Manager approval | No approval |
The owner’s decision
Mary Jane can keep the rule or approve the waiver for a new version. Finding the $500.01 case gives her a concrete decision to make. The proposal alone leaves the current rule in force.
The same case in Rego
package shop.refunds
import rego.v1
default requires_manager := false
requires_manager if input.cents > 50000This Rego policy returns true at 50,001 cents. Rego can also compare two versions when both are supplied. Phaseline’s job inside VERIFY is to bring the approved predecessor into the comparison when Joe never mentions it.
Rego reference