A Verifier Needs a Failure Contract
Give verifiers a typed failure contract that keeps execution blocked when evidence is missing, binds verdicts to inputs, and tells operators what to repair.
An empty reply can open the gate
In a fictional maintenance workflow, a verifier checks whether every host in a proposed operation belongs to a named inventory partition at a pinned snapshot. The reply lists hosts that fail the membership check in a repeated violations field. The Protocol Buffers Language Guide (proto 3) specifies an empty list as the default for a repeated field. An adapter that equates an empty list with a pass opens the gate on an empty reply.
Use a verdict enum with UNSPECIFIED as its zero value and distinct values for pass and rejection. Reject an unspecified or unrecognized verdict and a pass that lists violations. Exercise the production decoder with a stub that returns gRPC OK and an empty protobuf message. The adapter must record invalid_response and keep the gate closed. A companion fixture returns a pass with an earlier proposal's digest and must produce the same outcome with a binding diagnostic.
Who gets paged when the claim stays open
The gRPC Status Codes and Error handling guides distinguish application failures from statuses the library can generate. This unary verifier evaluates a pinned snapshot without side effects. Only a validated pass advances to the remaining authorization checks on the ordinary path.
| Gate state | Adapter rule | Recovery owner and next move |
|---|---|---|
pass |
A bound verdict establishes the claim. | Gate owner continues authorization. |
rejected |
A bound verdict establishes that the claim is false. | Proposal owner reviews the violations. |
unsupported |
Confirmed method-not-found or a validated capability result for an unsupported claim. | Integration owner selects a compatible verifier. |
malformed_request |
INVALID_ARGUMENT identifies an invalid request. |
Caller owner repairs request construction. |
access_blocked |
UNAUTHENTICATED identifies invalid or missing credentials. PERMISSION_DENIED identifies an invocation denial. |
Identity owner investigates the denial. |
unavailable |
UNAVAILABLE, with dependency and send phase when known. |
Service owner checks dependency health. |
timed_out |
The local deadline wins, or an open attempt receives DEADLINE_EXCEEDED. |
Runtime owner diagnoses where time went. |
resource_exhausted |
RESOURCE_EXHAUSTED, with limit and origin when known. |
Integration owner triages unknown origins and client limits, and sends confirmed server limits to the capacity owner. |
invalid_response |
Decoding, verdict validation, or request binding fails. | Integration owner investigates the reply. |
canceled |
Cancellation wins an open attempt locally or arrives as CANCELLED. |
Workflow owner accounts for the cancellation. |
verifier_error |
Other RPC failures, with the raw status and any trusted diagnostic. | Integration owner triages and hands off to the snapshot, workflow, or service owner according to the diagnostic. |
An OK reply enters payload validation. Non-OK replies stay on the failure path even if trailers carry a positive finding. A trusted client diagnostic that confirms a response decoding failure maps an INTERNAL to invalid_response. With a bare INTERNAL or UNKNOWN, integration triages the verifier_error and hands it to the service owner if the evidence points to the service. Integration also retains library cardinality failures and unexplained UNIMPLEMENTED responses. A confirmed missing method or a capability result validated against the request establishes unsupported.
Integration sends verifier_error to the snapshot owner when a trusted diagnostic ties NOT_FOUND to a missing snapshot or partition, FAILED_PRECONDITION to an unfinished build, or OUT_OF_RANGE to a revision ahead of the inventory. These failures leave membership unevaluated. A replacement snapshot changes the claim's inputs and requires a fresh verdict. Integration sends an ABORTED evaluation conflict to the workflow owner to decide whether to restart the sequence and sends reported DATA_LOSS to the service owner to investigate and isolate any confirmed corrupt source. Integration retains failures without an actionable diagnosis.
The time and limit diagnostics determine what a repeat could achieve. Queue pressure points to runtime capacity or scheduling. Dominant evaluation time points to a smaller proposal or a later cutoff that still leaves time to execute. When structured diagnostics confirm a fixed per-request work cap, the capacity owner reports the cap and the proposal owner can split the work. A client receive limit can surface as the same RESOURCE_EXHAUSTED after evaluation has finished, so that limit belongs to the integration owner. With an ambiguous origin, preserve the uncertainty and withhold automatic retries. A transient UNAVAILABLE can be retried even after a possible send because this evaluation is side-effect-free on the pinned snapshot. The send phase still matters for capacity planning because another worker may be doing the same work.
Bind the verdict before admitting it
Before admitting a verdict, match its tenant, claim identifier and revision, canonical proposal digest, and snapshot to the dispatch record. Include the named partition in the digested inputs. Use a versioned canonical encoding so a change in field order preserves identity while a change of partition invalidates it. Resolve the evidence reference in the trusted tenant scope and check that it identifies the same evaluation and verdict. A direct reply takes its attempt ID from the call context. A relay must authenticate the result together with the attempt ID because two attempts can share all claim inputs. Persist the attempt ID with the decision and its evidence reference when available. Local failures take their identity from the dispatch record.
Decide which completion owns the attempt
A stalled timer callback can let a late reply reach the decision handler first. Serialize completion, cancellation, and expiry under the same attempt lock and check the monotonic clock while holding it. Classify the reply and validate any returned verdict before seeking the lock. While the attempt is open, use this admission rule.
record(timed_out if monotonic_now() >= deadline else event.outcome)
The timer contributes a timeout event at or after the deadline, cancellation contributes canceled, and completion contributes the classified response. Expiry wins at equality even when the timer has yet to run. A decision recorded under the lock is terminal.
In the fictional trace, the action has enough verification time for both dispatches to receive a 120 ms attempt limit. The full proposal spends 0 ms in the queue and reaches the server's fixed work cap after 35 ms of evaluation. The caller receives the failure and records resource_exhausted at 35 ms in the trace. The capacity owner reports the cap and the proposal owner splits the host list. Since the claim is membership for every host, the gate can assemble a pass from bound passes on parts whose manifests together contain exactly the original host set under the same partition and snapshot. The first part waits 105 ms in the worker queue and the caller records timed_out at 120 ms. The verifier finishes 27 ms of evaluation and logs pass at 132 ms, 12 ms after timeout and before observing cancellation. Each row measures time from its own dispatch.
Figure 1 — Queueing consumes 105 ms of the split part’s 120 ms attempt limit. The worker needs 27 ms to check that part and finishes at 132 ms, 12 ms after the caller times out. Illustrative dispatch trace, not measured data.
A retry can overlap the timed-out evaluation. Set the verification cutoff at the action deadline minus the time reserved for the remaining authorization checks and execution. Every attempt, backoff, and verdict admission draws from the time left before that cutoff. Issue a fresh attempt ID only if the remaining time covers backoff and reevaluation. Bound the new deadline by the earlier of the per-attempt limit measured from dispatch and the verification cutoff. Apply the same rule to transient unavailability and confirmed transient capacity limits. Propagate cancellation to reclaim capacity and cap outstanding evaluations per workflow, counting canceled work until the worker acknowledges termination or its execution lease expires and prevents further work. A valid rejection settles the claim for that proposal and snapshot. Trying other replicas for a pass can hide inconsistent inventory reads.
Budget verification as part of the action
Figure 2 models a separate fictional verifier under a fixed workload. It applies each cutoff to the same distribution of verdict arrival and validation times, holding queue and worker behavior fixed. At cutoffs of 50, 100, 150, 200, and 300 ms, callers admit valid verdicts on 70%, 90%, 96%, 98%, and 99% of requests, respectively. Both pass and rejected count when ready for admission strictly before the cutoff. The model has zero non-timeout failures, so timeout falls from 2% at 200 ms to 1% at 300 ms. Moving the cutoff by 100 ms pushes back the latest start of the remaining authorization checks by 100 ms. The action then needs a longer overall deadline or a smaller reserve for authorization and execution.
Figure 2 — Among the plotted cutoffs, moving from 200 to 300 ms buys one percentage point of verdict coverage, from 98% to 99%. Illustrative cutoff model, not measured data.
A verifier outage can halt urgent remediation. In the action's on-time completion objective, count otherwise eligible actions blocked by missing or late verifier evidence as misses. Track the share of verification requests with a valid verdict admitted within the allocated time as a dependency indicator. A valid rejection counts as a timely decision and stays visible in policy reporting. Measure live RPC latency separately from verdict admission time. An RPC can return promptly while evidence lookup or lock contention still causes the caller to miss its cutoff.
Where policy permits emergency execution during verifier unavailability or timeout, require joint approval from the incident commander and the inventory owner. Bind a single-use authorization to the tenant, exact host manifest and operation, and an expiration within the incident window. Before dispatch, record the approvers, the failed attempt and its diagnostic, the urgency, the independent inventory evidence used to confirm membership, and the rollback conditions. The executor records that authorization as an override and still applies the remaining checks. A valid rejection remains binding. Keep overrides visible in the verifier dependency indicator as failures even when the emergency action succeeds.
A closed attempt and a completed evaluation
The caller's outcome answers whether evidence arrived in time to govern execution. The worker's outcome answers what it found and how much capacity it used. Keep both under the original attempt ID. In the split trace, the late pass preserves the membership finding and the queue delay explains why the gate stayed closed. If late passes accumulate while evaluation time holds steady, the runtime owner has evidence to investigate queueing before extending the cutoff and taking time away from remediation.