Skip to main content

PermissionedProcessRunnerFactory

Trait PermissionedProcessRunnerFactory 

Source
pub trait PermissionedProcessRunnerFactory: Send + Sync {
    // Required method
    fn runner_for(&self, request: &PermissionRequest) -> Arc<dyn ProcessRunner> ⓘ;

    // Provided methods
    fn validate_request(
        &self,
        _request: &PermissionRequest,
    ) -> Result<(), ProcessRunnerError> { ... }
    fn request_capabilities_are_satisfied(
        &self,
        _request: &PermissionRequest,
    ) -> Result<bool, ProcessRunnerError> { ... }
    fn targets_protected_metadata(&self, _request: &PermissionRequest) -> bool { ... }
    fn prepare_approved_request(
        &self,
        request: &PermissionRequest,
    ) -> Result<PreparedProcessPermission, ProcessRunnerError> { ... }
    fn runner_for_decision(
        &self,
        request: &PermissionRequest,
        _scope: ApprovalScope,
    ) -> Arc<dyn ProcessRunner> ⓘ { ... }
}
Expand description

Factory for runners created from approved permission requests.

Implementations translate a runtime-approved request into the concrete process backend/profile for that exact action. Adapters consume read-only session snapshots; runtime owns retention and capability lifetimes through SessionPermissionedProcessRunnerFactory. An adapter never records grants or grants authority beyond the runtime-approved request.

Required Methods§

Source

fn runner_for(&self, request: &PermissionRequest) -> Arc<dyn ProcessRunner> ⓘ

Creates the process runner for one approved permission request, without mutating session state. Runtime handles retention after successful preparation.

Provided Methods§

Source

fn validate_request( &self, _request: &PermissionRequest, ) -> Result<(), ProcessRunnerError>

Validates the request against the backend’s hard capability policy.

Backends that do not have additional policy constraints may keep the default only when they can enforce every capability in the request through their existing runner. A backend that cannot materialize a requested path or network grant must reject it. A validation failure must happen before any reviewer or process side effect is started.

Source

fn request_capabilities_are_satisfied( &self, _request: &PermissionRequest, ) -> Result<bool, ProcessRunnerError>

Returns whether the backend already enforces every capability in the request for the current process session.

This query covers capability state only; it does not authorize the requested action. Implementations must return false for capabilities that are action-scoped, such as network access, or when the backend cannot prove that the requested access is covered.

Source

fn targets_protected_metadata(&self, _request: &PermissionRequest) -> bool

Returns whether any requested path targets built-in Merry protected metadata (providers/, MERRY_API_KEY_FILE, or a ProductReadOnly write target), so runtime keeps approval single-action (Once) and defaults interactive review UIs to Deny.

Source

fn prepare_approved_request( &self, request: &PermissionRequest, ) -> Result<PreparedProcessPermission, ProcessRunnerError>

Prepares one validated action and its normalized path evidence without changing permission state. Adapters can share a single filesystem view across validation and materialization. The default retains no paths.

Source

fn runner_for_decision( &self, request: &PermissionRequest, _scope: ApprovalScope, ) -> Arc<dyn ProcessRunner> ⓘ

Creates the process runner for one approved permission request under an explicit merry_core::ApprovalScope.

merry_core::ApprovalScope::Once must not retain any session grant. merry_core::ApprovalScope::Session retains eligible capabilities when backed by a session-scoped permission store.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§