pub enum CheckPolicy {
Silent,
Warn,
Strict,
}Expand description
How a submit-time projection sink reacts when a fail-open condition is encountered.
This is the Swarm IF SoT type for the check_policy axis; the
mlua-swarm core crate re-exports it as crate::core::config::CheckPolicy
so every existing path (EngineCfg.check_policy, TaskSpec.check_policy,
apply_check_policy) keeps its old type path unchanged.
Fail-open conditions include: work_dir / project_root unresolved,
OutputStore write error, FileProjectionAdapter::materialize_submission
error, and state lookup error. Each call site inside the engine’s
materialize_final_submission / materialize_artifact_submission
currently logs a tracing::warn! and returns without materializing the
file / dual-write; CheckPolicy is the first-class knob that lets a
caller opt into a different reaction without changing that behaviour by
default.
The three modes are (a) CheckPolicy::Silent — no log, no error,
operation continues; (b) CheckPolicy::Warn — log warn (existing
message literal preserved), no error, operation continues (the
default = pre-existing behaviour); (c) CheckPolicy::Strict — log
the same warn AND return EngineError::CheckPolicyStrict (in the core
crate) so the caller can fail the step / launch fast. When Strict
returns an error, the underlying OutputStore may already have
appended (dual-write side-effect is not rolled back) — this “state
dirty on fail” semantics is intentional: the append happens before
the fail-open branch runs, so Strict surfaces the mismatch instead of
hiding it.
The wire form is snake_case ("silent" / "warn" / "strict"); the
default is CheckPolicy::Warn.
Variants§
Silent
Skip both the log warn and the error path — completely silent. The operation continues (fail-open is still in effect).
Warn
Log a tracing::warn! with the call site’s existing message and
continue (fail-open). Default — byte-identical to the
pre-CheckPolicy behaviour of every submit-time projection sink
code path.
Strict
Log the same warn AND return EngineError::CheckPolicyStrict (the
core crate’s error variant). A caller that has opted in can fail the
step / launch fast instead of proceeding with a partially-realized
submission. This mode also drives a launch-time pre-dispatch
validation in TaskLaunchService::launch (the mlua-swarm core
crate): a launch whose effective policy resolves to Strict and
that supplies neither project_root nor work_dir is rejected
with TaskLaunchError::PreDispatch before any step is dispatched,
rather than dispatching a step that would deterministically hit
this same error at its first submit-time file materialize.
Trait Implementations§
Source§impl Clone for CheckPolicy
impl Clone for CheckPolicy
Source§fn clone(&self) -> CheckPolicy
fn clone(&self) -> CheckPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CheckPolicy
Source§impl Debug for CheckPolicy
impl Debug for CheckPolicy
Source§impl Default for CheckPolicy
impl Default for CheckPolicy
Source§fn default() -> CheckPolicy
fn default() -> CheckPolicy
Source§impl<'de> Deserialize<'de> for CheckPolicy
impl<'de> Deserialize<'de> for CheckPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CheckPolicy
Source§impl JsonSchema for CheckPolicy
impl JsonSchema for CheckPolicy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for CheckPolicy
impl PartialEq for CheckPolicy
Source§impl Serialize for CheckPolicy
impl Serialize for CheckPolicy
impl StructuralPartialEq for CheckPolicy
Auto Trait Implementations§
impl Freeze for CheckPolicy
impl RefUnwindSafe for CheckPolicy
impl Send for CheckPolicy
impl Sync for CheckPolicy
impl Unpin for CheckPolicy
impl UnsafeUnpin for CheckPolicy
impl UnwindSafe for CheckPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more