Which rule-language style should a platform team standardise on for its policy guardrails?
answer
- optimise for the second reader
- most rules assert one object's shape
- choose for the bulk, not the hardest rule
- one escape hatch, never three styles
- XACML: general, and unread
basics
~20 sThere is no universal answer: you are choosing who can author and review guardrails for years. Cover the bulk with a reviewable restricted style, keep one escape hatch for rules that need quantification, and optimise for the second reader.
solid answer
~50 sYou are not picking a syntax; you are picking who can write and review guardrails for the next several years. Most rules are shape assertions about a single object, so a match or expression style states them in a few lines a stranger can check, and a restricted expression language buys a real guarantee — no I/O, no unbounded iteration, so evaluation terminates and its cost is knowable before it runs on the path of every change. Keep exactly one escape hatch in a style that can quantify and name intermediate results, for the minority of rules needing a join, and watch that the escape hatch does not quietly become the default. XACML is the cautionary tale: an extremely general policy language whose artifacts were long XML documents almost nobody hand-authored or read, so the expressiveness bought very little. Optimise for the second reader.
go deeper
Know that the style a team writes rules in is a deliberate choice with consequences, and that being able to read a colleague's rule is one of the things being optimised for.
Be able to lay out the trade concretely: restricted styles are readable and bounded but cannot cross objects, expressive styles can quantify but narrow the pool of reviewers.
Show you would inventory the actual rules first, keep a bounded escape hatch with a named owner, and insist that anything on the path of every change has a bounded worst case.
Own it as a governance call: the style decides who can author and attest to controls for years, so defend the choice in terms of review capacity, traceability to the written standard, and the failure mode of a language only tools can write.
## The question behind the question Asked as *which language*, this sounds like a tooling preference. It is a staffing and governance decision: the style you standardise on determines who can author a guardrail, who can review one, how fast a rule can be changed after it misfires, and which requirements you are simply unable to encode. Answer it in those terms. ## Start from the distribution of rules, not the hardest one Inventory the guardrails you actually need. In most estates the distribution is lopsided: the large majority are assertions about a single object — a required field, a forbidden value, a value inside a permitted set — and a small minority are relations across objects, such as *every workload with more than one replica must be covered by a PodDisruptionBudget*. The common mistake is to choose for the hardest rule in the backlog. That picks the most expressive style for everything, and pays its review cost on the hundred simple rules that did not need it. Choose for the bulk, and handle the minority explicitly. ## What the restricted styles buy A declarative match document is written in the same serialization as the object it judges, so an engineer who knows the resource can read the rule without knowing the policy system. A restricted expression language adds computation while keeping strong guarantees: no I/O, no side effects, no unbounded iteration. Those are not arbitrary limitations — they mean evaluation terminates by construction and the cost of a rule can be reasoned about before it is allowed onto the path of every change. A rule that runs on every change is infrastructure, and infrastructure whose worst case you cannot bound is an outage waiting for the right input. The price is the ceiling described above, plus the fact that a single expression has nowhere to name an intermediate result, so complexity shows up as nesting. ## What the expressive style buys, and what it costs A logic language can quantify, join across objects, and — crucially — name intermediate results so each name lines up with a clause of the written standard. For the rules that genuinely need it, it is not merely more powerful but more *readable* than the same logic crushed into one expression. Its cost is a second skill set. Fewer engineers can author it, fewer can review it, and its evaluation-cost story is weaker. Adopt it as a bounded escape hatch — an explicit list of rules that live there, with a named owner — rather than as the house style, and re-examine it if the list keeps growing. ## XACML's lesson XACML is an XML-based, attribute-oriented policy language standardised by OASIS, with policy sets, policies and rules, combining algorithms such as deny-overrides and first-applicable, and decisions of Permit, Deny, NotApplicable or Indeterminate. As a design it is extremely general: it can express almost any access rule you can describe. The lesson is not that it was a bad idea, but that generality was bought with a shape people could not work with. The artifacts were long XML documents that few engineers hand-authored and fewer read in review; authoring moved into specialist tooling, and the policies became something you trusted a tool to produce rather than something a colleague checked. Expressiveness that nobody exercises is not expressiveness — it is a maintenance surface. Any modern choice should be tested against the same question: can a second engineer read one of these rules and tell me it matches the standard? ## Making the decision concretely - **Count the rules that need quantification.** If it is a handful, the escape hatch is right. If it is a third of the backlog, choose the expressive style as the house style and accept the training cost. - **Count the reviewers.** How many people must be able to approve a guardrail for the review queue not to become one person? That number caps how exotic your style can be. - **Fix a traceability rule.** Each rule names the clause it enforces, and rules narrower than their clause say so. This is what makes the style change survivable later. - **Decide the cost story.** Whatever runs in the path of every change must have a bounded worst case, and a rule that cannot demonstrate one does not go there. - **Cap the count of styles at two.** Three styles means no reviewer is fluent in the one in front of them. ## How to answer in an interview Say there is no context-free answer, then give the decision procedure: the distribution of rules decides the default, the number of competent reviewers caps the expressiveness, bounded evaluation is non-negotiable on the hot path, and one escape hatch is kept with a named owner and an explicit list. Close with the failure you are steering away from — a language so general that rules become artifacts only a tool can produce and no colleague can check.
- What is the argument for allowing two styles rather than exactly one?The distribution of rules is lopsided. Most guardrails are single-object shape assertions that a restricted style states in a few readable lines, keeping authorship open to product teams; a small minority need quantification or a join and are clearer in a style with named intermediate results. Two styles serve both. The failures are three styles, where no reviewer is fluent, and an escape hatch that quietly becomes the default.
- Why does bounded evaluation matter when you choose a style?A rule that runs on every change is infrastructure. A style with no I/O and no unbounded iteration terminates by construction and its cost can be reasoned about before it ships, so a pathological rule is caught in review rather than discovered as a stalled pipeline or a slow admission path. A fully general language buys expressiveness by giving that guarantee up.
- How would you tell whether the escape hatch has become the default?Track it as a number: what share of active rules live in the expressive style, how many people have approved a change to one in the last quarter, and how long those reviews sit. A rising share with a flat reviewer count is the signal. Either invest in training and make it the house style deliberately, or find out why simple rules are being written there.
saying these in an interview costs you the question
- Picks the most expressive language available and stops there
- Treats the choice as tooling preference, not review capacity
- Chooses for the hardest rule in the backlog
- Assumes every engineer will learn a logic language eventually
- Answers with a product name instead of the style's ceiling