Skip to main content
The decide flow is how a Midaz ledger asks Tracer for a decision that follows your policies and bindings. Tracer answers, for each control of each policy, what it decided and what the ledger must do with that. The ledger then obeys one field: the outcome. What changes in your operation: the ledger’s tracer.mode stops being the only switch between β€œreport” and β€œblock”. A binding can enforce a policy on Pix and only report on TED, on the same ledger. The mode becomes the fallback for whatever no binding decides. Trade-off: once your tenant publishes its first policy, a ledger on the decide flow applies only the rules and limits of published policies. Upgrade Tracer first, and plan what your first policy holds before you publish it.
The decide flow is available from the Midaz release that introduces policies. The reserve flow stays the default and is unchanged.

Choose the flow of a ledger


The ledger setting tracer.flow picks the call the ledger makes to Tracer before it commits balances: reserve is never stored: a ledger that has no flow uses reserve. Any other value is refused when you write the settings. tracer.mode still controls whether the ledger calls Tracer at all. With off, or with an honored skip.tracer on the transaction, the ledger makes no call, whatever the flow. Under decide, the ledger sends its mode as the fallback mode: enforce becomes ENFORCE and advisory becomes ADVISORY. Set the flow in the ledger settings:
See Ledgers for the other ledger settings. On both flows, the ledger confirms the holds when the transaction commits and releases them when it cancels.

What the ledger sends


On the decide flow, the ledger sends the same fields as a reserve, plus its organization, its ledger, its fallback mode, and the transaction as rules see it:
  • The transaction id, scheme, subType, amount, asset, description, route, timestamp, and metadata. Metadata values keep their type.
  • One operation for each leg, sources and destinations, each with its amount, its account id, alias, and type.
  • For each account the ledger can read: its status, segment id, portfolio id, and metadata.
When the ledger cannot read an account, it names that account’s status, segment, portfolio, and metadata as unavailable fields. A rule that depends on an unavailable field is inconclusive: its policy answers REVIEW with the reason rule_evaluation_error, unless a later DENY or REVIEW rule matches. See Absent and unavailable fields. The decide flow sends no merchant, and no segment or portfolio name.

What Tracer answers


Each control of each policy gets three values: The answer then combines them:
  • outcome is REFUSE when any control of any policy refuses, and PROCEED otherwise. The ledger obeys outcome.
  • verdict takes DENY over REVIEW over ALLOW across every control of every policy. It is diagnostic only.
  • instructionSource is BINDING only when every control’s instruction came from a binding. Otherwise it is FALLBACK.
  • reason is filled only on REFUSE. It comes from, in this order, a DENY by a rule, a DENY by a limit, then a REVIEW.
  • Holds come back only on PROCEED.
A refusal is a successful answer, not a transport error. A policy whose controls are all OFF is listed as not executed.

Advisory and audit

A DENY or REVIEW under ADVISORY or AUDIT is reported and the transaction proceeds. It shows in verdict and in the per-policy results, and the ledger logs a warning and marks its trace span with app.tracer.advisory=true.
  • Under ADVISORY, a limit within its ceiling holds capacity. Over the ceiling it holds nothing and reports DENY, and the ENFORCE holds stay.
  • Under AUDIT, a limit compares the current and reserved usage with its ceiling and holds nothing.
With no binding, a refusal comes only from the ENFORCE fallback. An advisory ledger on the decide flow never refuses on a verdict, as on the reserve flow.

Without published policies


While the tenant has no published policy, the decide flow runs the same evaluation as the reserve flow: every active rule, then every applicable limit, with the same holds. Every control takes the fallback mode, and the answer lists one policy entry with an empty policyId and revision 0. The upgrade publishes no policy, so a ledger that switches to decide before your first publication answers as it did on reserve. From your first publication on, a rule or limit outside every published policy no longer applies to the decide flow. See The first published policy.

Outcomes on the ledger


A second decide for the same transaction behaves like a repeated reserve: Tracer evaluates it again, keeps the holds the first decide took and writes no second record. The Midaz error list describes each ledger code.

The validation record


Every decide writes one validation record, like a reserve. GET /v1/validations?transaction_id={transactionId} returns it. A record of the decide flow also carries: A record of the reserve flow, of POST /v1/validations, or written before the release that introduces policies leaves these fields out. A request a partner made does not receive policies.

Upgrade order


  1. Run the Tracer database migration. It publishes no policy, so your active rules and limits still apply.
  2. Roll out the Tracer image.
  3. Roll out the ledger image.
  4. Switch each ledger to tracer.flow=decide when you choose.
A ledger on decide against a Tracer that does not serve the decide call treats it as an unavailable Tracer. An enforce ledger with failPosture closed then rejects with 0178.
Set every ledger back to tracer.flow=reserve before you roll Tracer back below the release that introduces policies. On reserve no binding applies: every active rule and limit runs, and tracer.mode alone decides whether the ledger blocks. Before the switch, set each ledger’s tracer.mode to the enforcement you want without bindings. An advisory ledger whose bindings were ENFORCE stops refusing, and an enforce ledger whose bindings were ADVISORY, AUDIT or OFF starts refusing on every active rule and limit.

Next steps