Skip to content

Roll out with shadow mode, then enforce

Try a plan on real traffic without blocking anyone. When the “would denies” look right, switch to enforce from the console, with no deploy.

Every plan has a mode. The mode never changes the decision. It only tells your code what to do with a deny.

enforce shadow
On allow Run the tool. Run the tool.
On deny Don’t run the tool. Run the tool anyway. The deny is recorded as a “would deny”.
Use it for Real limits Trying a plan on real traffic without blocking anyone
The one rule for your code: run the tool if decision is allow or mode is shadow.
  1. New plans you create in the console start in shadow: the mode menu on Add plan says “shadow (start here)”. The two sandbox plans you get at sign-up, pilot and prod, are in enforce, so the “6th call is a deny” demo works.

  2. A deny is always HTTP 200, in both modes. Check the mode field in the answer and apply the rule:

    Fragment: a shorter form of the end of main() in decide.py from First deny (Python tab), which sets status, body, left and request_id.

    python
    if status != 200:
    e = body["error"] # branch on e["code"], never on the message
    ...
    if body["decision"] == "allow":
    print(f"allow: run the tool ({left}, request_id {request_id})")
    return 0
    if body["mode"] == "shadow":
    print(f"would deny (shadow): {body['reason']}, run the tool anyway ({left}, request_id {request_id})")
    return 0
    print(f"deny: {body['reason']}, don't run the tool ({left}, resets {body['resets_at']}, request_id {request_id})")
    return 2

    Leave mode out of your requests so the plan’s setting applies. If you send "mode": "shadow" or "mode": "enforce", that pins it for the call and the console switch has no effect.

  3. Allowed calls count toward the plan limit the same way in both modes and denies never do, so the count is already right when you switch. Denies are always free.

    • Overview: “N calls in the last 7 days would have been denied. These calls ran because they were in shadow mode.”, with a link to the Plans page. The Would deny, last 7 days card number opens those rows on Decisions, with counts by plan and by key.
    • Decisions: filter to would-deny, or by decision, mode, key, tool, reason, plan, customer and date. The table is 50 rows at a time, newest first, with Older and Newer. Counts by key and by plan sit above the rows. A row reads would deny (call ran), and the mode column says shadow.
    • Plans: every plan shows how many would-denies it had in the last 7 days and in its current period, and how many keys those were on. The number opens those rows. The mode button still says Enforce or Shadow.
    • Export (CSV or JSON): a shadow deny has decision = deny, mode = shadow, and would_deny = true. An allow or an enforce deny has would_deny = false. The same file includes plan_id, plan_name, and plan_policy_version (empty when the row has no stored version). The download on a filtered Decisions page is those rows. To get only the would-denies from a full export, see Pull the would-denies from an export. The default range is still the last 90 days, or the history you keep if that is shorter.
    1. Open the Plans page.
    2. On the plan’s row, click Enforce in the Mode column.

    Your running server picks up the new mode on its next call, with no deploy, as long as your code doesn’t pin a mode. The switch is recorded in Console → Change log. To roll back, click Shadow in the same place.

    A retry that reuses an idempotency key first seen in shadow, within 24 hours, gets the stored shadow answer back, even after the switch to enforce. Only new idempotency keys are decided in enforce.

The Decisions page can filter to would-denies and shows 50 rows at a time, with Older and Newer. To review every would-deny in a spreadsheet, download the export and filter it. From code, GET /v1/decisions lists them: send decision=deny and keep the rows with mode: shadow.

  1. In the console, open Decisions. Under Date range, pick From and To (UTC) and click Set range. The default is the last 90 days, or less if your retention is shorter.
  2. Click CSV or JSON under the range. The file has every decision in the range, newest first, up to 100,000 rows. If the range has more, the page says the export is paged and gives you a Next page (older) link. Download each page.
  3. Keep the rows where decision is deny and mode is shadow. Those are the calls that would have been denied in enforce and ran anyway. Rows with decision = deny and mode = enforce were real denies.

mode is the mode that applied to that call. A call that sent "mode": "shadow" on an enforce plan is a would-deny too.

In a spreadsheet, filter the decision column to deny and the mode column to shadow. From a terminal:

Terminal window
# PowerShell, CSV export
Import-Csv .\ordainer-decisions-2026-11-09.csv |
Where-Object { $_.decision -eq 'deny' -and $_.mode -eq 'shadow' } |
Export-Csv .\would-denies.csv -NoTypeInformation
Terminal window
# jq, JSON export
jq '[.decisions[] | select(.decision == "deny" and .mode == "shadow")]' ordainer-decisions-2026-11-09.json > would-denies.json

Use your own file name; the export names files ordainer-decisions- plus the download date.

To see what would break when you switch, group the would-denies by reason (for example quota_exceeded or tool_not_in_plan), then by customer / customer_external_id and key_label. remaining and limit show where that key stood at the time.

Prefer our Node SDK? Install it with npm install ordainer; the Node / Express quickstart walks through it.

With mode unset (the default), the SDK follows the plan’s mode from each answer. Your server log shows a line like this for a shadow deny:

log
[ordainer] shadow: would deny tool=research.run reason=quota_exceeded remaining=0/5 request_id=req_… (call allowed)

To pin a mode instead (fragment: Ordainer comes from const { Ordainer } = require('ordainer');):

const ordainer = new Ordainer({ mode: 'shadow' });

A pinned mode overrides the console. Remove the pin to follow the console again. To send would-denies to your own metrics, pass onDecision: (d) => …; d.wouldDeny is true for shadow denies.

Your caller never sees a would-deny: in shadow the tool runs and returns its normal answer. Before you copy anything from req.ordainer into a response, read What your caller sees in shadow.

Shadow mode never blocks a call because of a plan or test limit. After your test keys reach their monthly limit, each shadow call still counts and is logged as a would-deny with the reason test_limit_reached, and the answer still tells your tool to run. To protect the service, shadow calls have a safety ceiling of 10 times your test limit. Past it, they return HTTP 429 with safety_limit_reached until your test usage resets at the start of the next month (UTC), and those calls aren’t counted or recorded. That’s a safety limit, not a deny. Our SDK (version 1.2.0 and later) lets the tool run automatically. If you call our API directly, we recommend letting the tool run and logging the error. If you reach it, email support@ordainer.ai.

The monthly test limit is per organization, shared by all its test keys, and only allowed decisions use it up. One busy customer’s allowed calls use up this shared allowance for every other customer in your organization, so give each customer its own key on a plan with a cap (plan caps count per key).

Shadow is about what to do with a real decision. Fail open / fail closed is about what to do when we can’t answer (timeout, network error, server error). They are separate settings. See Fail open vs fail closed.