pub struct Plan {
pub steps: Vec<Primitive>,
}Expand description
A proposed set of primitives to apply in order.
The plan is the unit of validation for the AI boundary. Individual
primitives can look sensible in isolation but fail as a sequence
(e.g. add_field twice, or remove_model followed by add_field
against the now-gone model). Plan::validate simulates the full
sequence against a shadow copy of the target schema and fails fast.
The struct is intentionally tiny. 0.4.0 does not execute plans; it just defines the contract every 0.5.0 executor is built to.
Fields§
§steps: Vec<Primitive>Implementations§
Source§impl Plan
impl Plan
pub fn new(steps: Vec<Primitive>) -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn validate(&self, initial: &Schema) -> Result<(), PrimitiveError>
pub fn validate(&self, initial: &Schema) -> Result<(), PrimitiveError>
Validate the entire plan against an initial schema state. Every step is first checked structurally, then checked against the shadow-applied schema, then applied to the shadow before the next step is considered.
The shadow is pure in-memory data — no filesystem, no DB. This stays consistent with the 0.4.0 boundary rule: no execution.
Additionally, any step whose primitive returns true from
Primitive::is_developer_only is rejected up front. Plans
represent the AI boundary; developer-only primitives
(currently CreateMigration) are reserved for direct tooling
use and must never appear in an AI-emitted plan.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Plan
impl<'de> Deserialize<'de> for Plan
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 StructuralPartialEq for Plan
Auto Trait Implementations§
impl Freeze for Plan
impl RefUnwindSafe for Plan
impl Send for Plan
impl Sync for Plan
impl Unpin for Plan
impl UnsafeUnpin for Plan
impl UnwindSafe for Plan
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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