Write the rules / Check before you publish
Check before you publish
Four ways to know what a change will do before it does it: the review every save opens, the tests, who gains and who loses, and shadow mode for running a rule on real traffic without letting it decide.
The review
Review & publish opens a read-only review before anything is saved, whoever or whatever wrote the change:
| Section | Answers |
|---|---|
| What the policy will say | each added, removed or changed rule, in words |
| The scenarios | the pack's own example requests, before and after, the ones that flip first |
| Requests this platform really answered | the PDP's recent real requests, replayed against the change |
| If the shadow rules were promoted | what turning shadow rules on would change |
Commit & publish stays off until the change passes the checks. If someone published since your review, the save is refused (409 stale) rather than quietly undoing their change: review again.
It replays the PDP's last 100 requests, held in memory. It is a strong signal, not a sample of the year: replaying a period from the ledger is not built.
Tests
The Policy Tester's Tests runs your suites on the published rules and, with unsaved changes, on your working copy beside them.
# policies/tests/stock-reads.yaml, shortened from the AI Agents pack's own
- suite: stock-reads
owner: supply-operations
about: Supply agents read stock only through their own gateways.
given: directory
examples:
- name: Supply agent reads Azure stock for Mia
who: a_supply_agent
for: u_plan_mia
does: read
on: r_stock_azure_prod
expect: allow
by: agent-read-stock-on-its-gateways
- name: Supply agent reads IBM Cloud stock
who: a_supply_agent
for: u_plan_mia
does: read
on: r_stock_ibm_prod
expect: no match
- Examples: who, does, on, optionally for whom, the answer expected, and the rule expected to decide it (
by).givensays which records to decide on: the directory, the pack's samples, or records written inline. - Never-rules: something that must never be allowed, checked against every request a rule could allow.
- Coverage: how many of the rules that decide any example are reached.
- Fill the gaps finds, for each rule no example reaches, a real case from your directory it decides and the closest case just outside it. Tick the ones to keep; they are added as a suite, recorded.
A Directory edit that grants access and breaks a test is held until you confirm it, too.
Impact: who gains, who loses
Impact compares your unsaved changes with the published rules, or any saved change with the rules before it, on today's directory. It asks only the requests a changed rule could match, so the answer is exact: these people and agents gain this access, these lose it. History's Who gained, who lost opens it on any past change.
Shadow rules
Set shadow: true on a rule and it runs on every real call but does not decide: each request gets the answer it would get without the rule, and what the rule would have done is recorded beside it.
- Deploy in shadowPublish the rule with shadow on.
- MeasureOn Decisions, filter Shadow differs: every real call where the rule would have answered differently.
- PromoteWhen the differences are the ones you meant, turn shadow off. The review shows what promoting changes first.
Ask a single question
Ask in the Policy Tester asks one question of the published rules, your working copy, or the live engine. Only Live is a real decision on the record; the other two are recorded nowhere. What if changes one attribute for the next questions only.