Skip to main content

WorkGraphMachine

Struct WorkGraphMachine 

Source
pub struct WorkGraphMachine;

Implementations§

Source§

impl WorkGraphMachine

Source

pub fn validate_item_projection(item: &WorkItem) -> Result<(), WorkGraphError>

Mechanically assert that a WorkItem’s projected lifecycle fields agree with its machine-owned machine_state authority.

This is a pure structural check: it borrows item immutably and can only return Ok(()) (every projection matches the machine state) or an Err rejecting the drift. It never synthesizes, repairs, or derives any lifecycle/revision field — the canonical truth lives in WorkGraphMachineState, and this guard merely rejects projections that disagree with it.

Source

pub fn public_error_class( error: &WorkGraphError, ) -> Result<WorkGraphPublicErrorClass, WorkGraphError>

Resolve the public error class for a WorkGraphError.

The shell performs only a pure typed extraction of the error variant into a WorkGraphErrorKind discriminant (one kind per variant, no grouping). The variant->class POLICY is owned by the canonical WorkGraphLifecycleMachine: this drives the machine’s ClassifyWorkGraphPublicError input and mirrors the emitted WorkGraphPublicErrorClassified effect. The shell decides nothing.

Source

pub fn classify_public_confirmation_admission( completion_policy: &WorkCompletionPolicy, ) -> Result<WorkPublicConfirmationAdmissionKind, WorkGraphError>

Resolve whether an untrusted PUBLIC caller may confirm an item with the given machine-owned completion policy.

The trust-scoped eligibility “only a self-attested completion policy may be confirmed by a public caller; every other policy requires trusted in-process host authority” is owned by the canonical WorkGraphLifecycleMachine, not the public-confirm surface. The shell performs only a pure typed extraction of the machine-owned completion_policy into the DSL observation, drives the machine’s ClassifyPublicConfirmationAdmission input, and mirrors the emitted PublicConfirmationAdmissionClassified verdict. The shell decides nothing and fails closed if the machine refuses or emits no verdict.

Source

pub fn classify_create_completion_policy_admission( completion_policy: &WorkCompletionPolicy, ) -> Result<WorkCreateCompletionPolicyAdmissionKind, WorkGraphError>

Resolve whether a requested completion policy is admissible at CREATE for a non-goal work item.

The creation policy “non-goal work items must use the self-attest completion policy” is owned by the canonical WorkGraphLifecycleMachine, not the create shell. The shell performs only a pure typed extraction of the requested completion policy into the DSL observation, drives the machine’s ClassifyCreateCompletionPolicyAdmission input over a fresh authority, and mirrors the emitted CreateCompletionPolicyAdmissionClassified verdict. The shell decides nothing and fails closed if the machine refuses or emits no verdict.

Source

pub fn classify_completion_policy_mutation_admission( item: &WorkItem, requested: &WorkCompletionPolicy, ) -> Result<WorkCompletionPolicyMutationAdmissionKind, WorkGraphError>

Resolve whether a requested completion-policy mutation is admissible.

The immutability invariant “a work item’s completion policy is fixed at creation and cannot be changed by an update” is owned by the canonical WorkGraphLifecycleMachine, not the shell. The shell performs only a pure typed extraction of the requested completion policy into the DSL observation (variant plus supervisor owner key plus reviewer quorum threshold), drives the machine’s ClassifyCompletionPolicyMutationAdmission input over the item’s recovered machine state, and mirrors the emitted CompletionPolicyMutationAdmissionClassified verdict. The machine compares the requested policy — in full — against its own machine-owned completion policy; this function decides nothing and fails closed if the machine refuses or emits no verdict.

Source

pub fn classify_confirmation_admission( completion_policy: &WorkCompletionPolicy, requested_principal: Option<&WorkOwnerKey>, supplied_evidence_kind: WorkConfirmationEvidenceObservation, ) -> Result<WorkConfirmationAdmissionKind, WorkGraphError>

Resolve whether a trusted-path goal confirmation is admissible for a work item’s machine-owned completion policy.

The eligibility “is this confirming principal + supplied evidence kind admissible for this completion policy” is owned by the canonical WorkGraphLifecycleMachine, not the goal-confirm shell. The shell performs only pure typed extraction of the observations (the machine-owned completion policy + its supervisor owner key, the requested confirming principal owner key + kind, and the typed evidence-kind observation projected from the evidence’s typed confirmation classification), drives the machine’s ClassifyConfirmationAdmission input, and mirrors the emitted ConfirmationAdmissionClassified verdict. This function decides nothing and fails closed if the machine refuses or emits no verdict.

Source

pub fn classify_terminality(item: &WorkItem) -> Result<bool, WorkGraphError>

Resolve whether a work item is terminal.

The shell extracts no fact: it drives the canonical WorkGraphLifecycleMachine’s ClassifyTerminality input over the item’s recovered machine state. The machine owns the lifecycle_phase and the terminality verdict (which phases are terminal); this function mirrors the emitted WorkItemTerminalityClassified.terminal, failing closed if the machine refuses or emits no verdict. It decides nothing.

Source

pub fn classify_blocker_satisfied( gated_item: &WorkItem, blocker: Option<&WorkItem>, ) -> Result<bool, WorkGraphError>

Resolve whether a single blocking edge is satisfied.

The shell extracts only the raw blocker lifecycle phase (a pure observation projected from the blocker’s own machine state) and whether the blocker was resolvable at all, then drives the canonical WorkGraphLifecycleMachine’s ClassifyBlockerSatisfied input over the gated item’s recovered state. The machine owns the satisfaction POLICY (a blocking edge is satisfied iff its blocker reached terminal SUCCESS, Completed) and emits the verdict; this function mirrors it. The caller mechanically fans-in (counts) the unsatisfied edges. Fails closed.

Source

pub fn create_item( request: CreateWorkItemRequest, realm_id: String, namespace: WorkNamespace, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn update_item( item: WorkItem, request: UpdateWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn claim_item( item: WorkItem, request: ClaimWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn claim_ready_item( item: WorkItem, request: ClaimWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn refresh_eligibility( item: WorkItem, unresolved_blocker_count: u64, now: DateTime<Utc>, ) -> Result<Option<(WorkItem, WorkGraphEvent)>, WorkGraphError>

Source

pub fn release_item( item: WorkItem, request: ReleaseWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn block_item( item: WorkItem, expected_revision: u64, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn close_item( item: WorkItem, request: CloseWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn add_evidence( item: WorkItem, request: AddEvidenceRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>

Source

pub fn classify_readiness( item: &WorkItem, now: DateTime<Utc>, ) -> Result<bool, WorkGraphError>

Classify whether a work item is ready to claim at now.

The shell extracts only the raw wall-clock now (a pure observation) and drives the canonical WorkGraphLifecycleMachine’s ClassifyReadiness input over the item’s recovered machine state. The machine owns the readiness POLICY — reproducing exactly the Claim transition guards (ClaimOpen / ClaimExpiredInProgress) — and emits the verdict; this function mirrors the emitted WorkItemReadinessClassified.ready, failing closed if the machine refuses or emits no verdict. It decides nothing.

Source

pub fn is_ready(item: &WorkItem, now: DateTime<Utc>) -> bool

Mirror the machine-owned readiness verdict as a bool, failing closed.

The readiness verdict belongs to the canonical WorkGraphLifecycleMachine (see WorkGraphMachine::classify_readiness). This filter-facing projection mirrors the machine bool; if the machine refuses to classify, it fails closed by treating the item as NOT ready so an unclassifiable item is never offered as claimable work.

Source

pub fn ready_items(items: Vec<WorkItem>, now: DateTime<Utc>) -> Vec<WorkItem>

Trait Implementations§

Source§

impl Clone for WorkGraphMachine

Source§

fn clone(&self) -> WorkGraphMachine

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WorkGraphMachine

Source§

impl Debug for WorkGraphMachine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkGraphMachine

Source§

fn default() -> WorkGraphMachine

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more