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.
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.
LockExpired
The lock the caller is referencing has passed its TTL. The Planner is free to reclaim the deliverable for another caller.
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.
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.
PlanNotFound
The plan id supplied to a lookup or mutation does not correspond to any submitted plan.
DeliverableNotFound
The deliverable id supplied to a lookup or mutation does not correspond to any deliverable in the named plan.
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.
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
impl Debug for PlannerError
Source§impl Display for PlannerError
impl Display for PlannerError
Source§impl Error for PlannerError
impl Error for PlannerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()