Skip to main content

PlannerError

Enum PlannerError 

Source
pub enum PlannerError {
    LockHeld {
        plan_id: String,
        deliverable_id: String,
        holder: String,
    },
    LockNotHeld {
        caller_id: String,
        deliverable_id: String,
    },
    LockExpired {
        deliverable_id: String,
        expired_at: DateTime<Utc>,
    },
    OverlapDetected {
        deliverable_id: String,
        files: Vec<PathBuf>,
    },
    MissingPrerequisite {
        deliverable_id: String,
        prereq: String,
    },
    PlanNotFound {
        plan_id: String,
    },
    DeliverableNotFound {
        plan_id: String,
        deliverable_id: String,
    },
    InvalidGraph {
        reason: String,
    },
    BackendError(Error),
}
Expand description

Errors returned by crate::ports::Planner methods.

Every variant carries enough context to log without further lookup. The stable string token at the start of the #[error(..)] message doubles as the wire-level error code surfaced by PA4’s MCP server, so the variant prefixes (LOCK_HELD, LOCK_NOT_HELD, etc.) MUST NOT change without bumping the MCP server schema.

Variants§

§

LockHeld

The requested deliverable is already locked by another caller. The holder field surfaces the conflicting caller for human triage.

Fields

§plan_id: String
§deliverable_id: String
§holder: String
§

LockNotHeld

The caller invoked an operation that requires holding a lock (mark_status, heartbeat) but the lock is held by someone else, or no lock exists at all.

Fields

§caller_id: String
§deliverable_id: String
§

LockExpired

The lock the caller is referencing has passed its TTL. The Planner is free to reclaim the deliverable for another caller.

Fields

§deliverable_id: String
§expired_at: DateTime<Utc>
§

OverlapDetected

acquire_cohort discovered that the candidate deliverable’s owned_files overlap with files held by an existing lock. Surfaced as a distinct variant (rather than LOCK_HELD) because the conflict is at the file level, not the deliverable level.

Fields

§deliverable_id: String
§files: Vec<PathBuf>
§

MissingPrerequisite

acquire_cohort cannot include the candidate because at least one of its prerequisites is not yet DeliverableStatus::Complete. This is not a hard error for the whole call (other cohort members may still be returned); it surfaces when a caller explicitly requests an ineligible deliverable.

Fields

§deliverable_id: String
§prereq: String
§

PlanNotFound

The plan id supplied to a lookup or mutation does not correspond to any submitted plan.

Fields

§plan_id: String
§

DeliverableNotFound

The deliverable id supplied to a lookup or mutation does not correspond to any deliverable in the named plan.

Fields

§plan_id: String
§deliverable_id: String
§

InvalidGraph

The submitted graph fails a structural invariant: duplicate ids, unknown prerequisite reference, cycle, empty owned_files, etc. The reason is the precise failure message.

Fields

§reason: String
§

BackendError(Error)

Catch-all for backend failures (DB unavailable, serialization errors against the persistence layer, etc.). Wraps the underlying anyhow::Error so the caller can introspect via source().

Trait Implementations§

Source§

impl Debug for PlannerError

Source§

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

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

impl Display for PlannerError

Source§

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

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

impl Error for PlannerError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. 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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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