pub struct WorkGraphMachine;Implementations§
Source§impl WorkGraphMachine
impl WorkGraphMachine
Sourcepub fn validate_item_projection(item: &WorkItem) -> Result<(), WorkGraphError>
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.
Sourcepub fn public_error_class(
error: &WorkGraphError,
) -> Result<WorkGraphPublicErrorClass, WorkGraphError>
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.
Sourcepub fn classify_public_confirmation_admission(
completion_policy: &WorkCompletionPolicy,
) -> Result<WorkPublicConfirmationAdmissionKind, WorkGraphError>
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.
Sourcepub fn classify_create_completion_policy_admission(
completion_policy: &WorkCompletionPolicy,
) -> Result<WorkCreateCompletionPolicyAdmissionKind, WorkGraphError>
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.
Sourcepub fn classify_completion_policy_mutation_admission(
item: &WorkItem,
requested: &WorkCompletionPolicy,
) -> Result<WorkCompletionPolicyMutationAdmissionKind, WorkGraphError>
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.
Sourcepub fn classify_confirmation_admission(
completion_policy: &WorkCompletionPolicy,
requested_principal: Option<&WorkOwnerKey>,
supplied_evidence_kind: WorkConfirmationEvidenceObservation,
) -> Result<WorkConfirmationAdmissionKind, WorkGraphError>
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.
Sourcepub fn classify_terminality(item: &WorkItem) -> Result<bool, WorkGraphError>
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.
Sourcepub fn classify_blocker_satisfied(
gated_item: &WorkItem,
blocker: Option<&WorkItem>,
) -> Result<bool, WorkGraphError>
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.
pub fn create_item( request: CreateWorkItemRequest, realm_id: String, namespace: WorkNamespace, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn update_item( item: WorkItem, request: UpdateWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn claim_item( item: WorkItem, request: ClaimWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn claim_ready_item( item: WorkItem, request: ClaimWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn refresh_eligibility( item: WorkItem, unresolved_blocker_count: u64, now: DateTime<Utc>, ) -> Result<Option<(WorkItem, WorkGraphEvent)>, WorkGraphError>
pub fn release_item( item: WorkItem, request: ReleaseWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn block_item( item: WorkItem, expected_revision: u64, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn close_item( item: WorkItem, request: CloseWorkItemRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
pub fn add_evidence( item: WorkItem, request: AddEvidenceRequest, now: DateTime<Utc>, ) -> Result<(WorkItem, WorkGraphEvent), WorkGraphError>
Sourcepub fn classify_readiness(
item: &WorkItem,
now: DateTime<Utc>,
) -> Result<bool, WorkGraphError>
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.
Sourcepub fn is_ready(item: &WorkItem, now: DateTime<Utc>) -> bool
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.
pub fn ready_items(items: Vec<WorkItem>, now: DateTime<Utc>) -> Vec<WorkItem>
pub fn validate_link( edge: &WorkEdge, existing_items: &[WorkItem], existing_edges: &[WorkEdge], ) -> Result<(), WorkGraphError>
Trait Implementations§
Source§impl Clone for WorkGraphMachine
impl Clone for WorkGraphMachine
Source§fn clone(&self) -> WorkGraphMachine
fn clone(&self) -> WorkGraphMachine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more