Method CheckAsync
- Namespace
- IntentSharp
- Assembly
- IntentSharp.dll
CheckAsync(GuardrailCheckpoint, SubjectValues, IReadOnlyList<string>, CancellationToken)
Checks one operation at checkpoint against the named rule sets and returns the decision. A
target calls it before it executes, and an application calls it at a checkpoint of its own; pass the decision to
Ensure(GuardrailDecision) before the operation proceeds. No model is called.
public ValueTask<GuardrailDecision> CheckAsync(GuardrailCheckpoint checkpoint, SubjectValues values, IReadOnlyList<string> sets, CancellationToken cancellationToken = default)
Parameters
checkpointGuardrailCheckpointThe checkpoint being checked.
valuesSubjectValuesThe subjects' values and the check's context.
setsIReadOnlyList<string>The sets to apply, in order; empty applies the client's default sets.
cancellationTokenCancellationTokenCancels the check.
Returns
- ValueTask<GuardrailDecision>
The decision; check Allowed.
Remarks
The check reads the source once, evaluates every rule of the named sets whose subject belongs to the checkpoint,
and fails closed: it refuses when no set is named and the client has no default sets, when a named set is not
loaded or the source cannot supply its rules, when a required subject is not covered by an enforced rule, and when
a set holds a detect-only rule on a security subject. A required subject with no value or an unknown value, a
security subject under an enforced rule with no value, a value no enforced allow rule allows on a required
subject, a rule on an undeclared subject, a kind that throws and a pattern that times out are violations. The decision also carries the settings the operation runs
under: each setting takes a named set's value, else a settings file's, else the code value, else its library
default, or its fail-closed value when it is a security setting.
Exceptions
- ArgumentNullException
valuesorsetsis null.- ArgumentException
checkpointis the default value, or a set name is empty.- OperationCanceledException
cancellationTokenwas cancelled.