pub struct QueryResultGuard { /* private fields */ }Expand description
Post-invocation guard that enforces row and column constraints on query tool responses.
Implementations§
Source§impl QueryResultGuard
impl QueryResultGuard
Sourcepub fn new(config: QueryResultGuardConfig) -> Result<Self, String>
pub fn new(config: QueryResultGuardConfig) -> Result<Self, String>
Construct a guard with the given configuration.
Invalid or over-broad PII regex patterns reject guard construction so policy loading fails closed instead of silently widening output.
Sourcepub fn config(&self) -> &QueryResultGuardConfig
pub fn config(&self) -> &QueryResultGuardConfig
Read-only access to the configuration.
Sourcepub fn redact_result(&self, scope: &ChioScope, value: &mut Value)
pub fn redact_result(&self, scope: &ChioScope, value: &mut Value)
Redact the response in place.
This is the primary transform entrypoint: kernel integrations
and the PostInvocationHook impl both delegate here.
Behaviour:
- If
scopehas anyConstraint::MaxRowsReturned, the rows array is truncated to the minimum of those limits. - If
scopehas anyConstraint::ColumnDenylist, matching columns (bare name ortable.column) are replaced by the redaction marker inside every row. - If the config has
redact_pii_patterns, every matched substring in every string value is replaced. - Constrained responses that do not expose rows under a recognised shape are redacted fail-closed instead of passing through unchanged.
Source§impl QueryResultGuard
Non-mutating convenience that bundles the scope.
impl QueryResultGuard
Non-mutating convenience that bundles the scope.
Sourcepub fn as_hook(&self, scope: ChioScope) -> QueryResultHook<'_>
pub fn as_hook(&self, scope: ChioScope) -> QueryResultHook<'_>
Build a PostInvocationHook adapter bound to an ChioScope.
Callers that already have a concrete scope can still construct a
fresh adapter per request. When the kernel provides a scope via
PostInvocationContext, the hook prefers that context over the
fallback scope stored here.
Sourcepub fn into_owned_hook(self, scope: ChioScope) -> OwnedQueryResultHook
pub fn into_owned_hook(self, scope: ChioScope) -> OwnedQueryResultHook
Build an owned PostInvocationHook adapter for runtime
pipelines that need a 'static hook object.